Pretty lame question, but its frustrating me since I don't know why it is not working.
I am trying to create a texture that contains a character from a specific, previously loaded font. So first I create an image with the right dimensions and color (black background with the character being white, basic alpha knowledge, am I right?)
This image is scaled so it uniformly fits in a 64x64 square, this is done in case the font used for this does not have a power of two size.
What I do next is to copyrect to a newly created texture, having the correct flags. What happens? the texture gets NO info.. it all being either transparent or not having alpha at all. Same happens with masked mode, whats going on here? please someone help me... it works when I don't assign the alpha flag, but that is obviously what I don't want here.
The following function creates the texture and returns its handle so you can then assign it to a texture handle, for use on 3D objects.
I am trying to create a texture that contains a character from a specific, previously loaded font. So first I create an image with the right dimensions and color (black background with the character being white, basic alpha knowledge, am I right?)
This image is scaled so it uniformly fits in a 64x64 square, this is done in case the font used for this does not have a power of two size.
What I do next is to copyrect to a newly created texture, having the correct flags. What happens? the texture gets NO info.. it all being either transparent or not having alpha at all. Same happens with masked mode, whats going on here? please someone help me... it works when I don't assign the alpha flag, but that is obviously what I don't want here.
The following function creates the texture and returns its handle so you can then assign it to a texture handle, for use on 3D objects.
Function Create_3Dtext_Char_Texture(leter$,font) Local image Local pastbuffer=GraphicsBuffer() Local texture Local cr=ColorRed() Local cg=ColorGreen() Local cb=ColorBlue() Local ow#,oh# leter=Mid(leter,1,1) SetFont font image=CreateImage(FontHeight(),FontHeight()) SetBuffer ImageBuffer(image) Color 0,0,0 Rect 0,0,256,256 Color 255,255,255 Text 0,0,leter SetBuffer pastbuffer ow=ImageWidth(image) oh=ImageHeight(image) ScaleImage image,(64.0*1.0)/ow,(64.0*1.0)/oh texture=CreateTexture(64,64,16+32+2) CopyRect 0,0,ImageWidth(image),ImageHeight(image),0,0,ImageBuffer(image),TextureBuffer(texture) TextureBlend texture,1 ;_______ FreeImage image Color cr,cg,cb Return texture End Function