Problem with my 3D texture label command?

Blitz3D Forums/Blitz3D Beginners Area/Problem with my 3D texture label command?

Guy Fawkes(Posted 2013) [#1]
Hi, why exactly can't I see my text as a texture with the selected font & font color?

What am I doing wrong here?

I'm trying to create a 3D label function library so I can easily pivot the player's name tag above his or her head in 3D form. I also need to know how to make it so that the texture does not have a background color so I can just plaster the text onto the texture without it changing my mesh's color.

Also, one last thing I might mention. The text on the texture for some reason, is backwards. ><



Thank You!


Bobysait(Posted 2013) [#2]
in function Create_Label_Texture()
-> Set_Buffer_Which(ent_tex_img, tex)
ent_tex_img is not defined in the function, so your "Set_Buffer_Which" will not set the drawing buffer to the texturebuffer.


in the "main"
-> Set_Label(cube, label)
the default stage is set to "1", it should be "0" (else it might not draw anything until the layers are "filled" to the current texture stage (kind of a bug, but here it is).


an other point :
(not a reason that makes the texture not applyed but it's still ugly)
-> font = LoadFont(label_font$, label_font_size)
First : you load fonts on this kind of function ? ... load your fonts in the main and store them, you can reuse them when you need, it will prevent from loading 10 times the same font just for drawing some text.
And .... Where is the fu****ing FreeFont ?
same thing in the "Reset_Buffer()"
It's just a crazy thing to load a default font this function.
And as the font handle is local, you can't release it anymore once it is loaded.



ps :
BTW, "Text TextureWidth(tex)/2-StringWidth(label$)/2, TextureHeight(tex)/2-StringHeight(label$)/2, label$"
...

There is 2 optionals parameters to center your text in the Text function.
-> Text TextureWidth(tex)/2, TextureHeight(tex)/2, label$, true,true



ps2 : according to the ... weird code you provide and what you're expecting to do in here and in other topics, have you really an idea of what you're doing ?
it really looks like a patchwork of some function found here and there.
At least try to release the maximum of stuff you load, else you'll have a lot of memory leaks every where and it will be almost impossible to remove them.


ps3 : to remove the background of the texture, you have 2 solutions
1 - use Textureblend 3 or entityblend 3 (lightblend)
2 - use a texture mask (but I think you're really not ready to go on this kind of trick as it deals with Read and Writepixels with an alpha channel.