I've been wrestling with this for a while now... I'm attempting to draw on a background texture with an overlay texture. Everything works fine until I set EntityAlpha to less than 1 - the background texture disappears entirely! Even an alpha setting of .99 causes this. Here is some code which demonstrates the problem:
The cube should be blue noise with a green square of noise in the middle of it, and alternate between being opaque and 50% translucent. On the three computers I've tested this on, the blue background texture disappears entirely when EntityAlpha drops below 1.
Graphics3D 800, 600, 0, 2 camera = CreateCamera() PositionEntity camera, 0, 0, -5 backdrop = CreateCube() ScaleEntity(backdrop, 10, 10, 1) PositionEntity(backdrop, 0, 0, 10) Const textureblend_ALPHA = 1, textureblend_MULTIPLY = 2, textureblend_ADD = 3 Const loadtexture_COLOUR = 1, loadtexture_ALPHA = 2, loadtexture_MASKED = 4 Const BLUE = 0, GREEN = 8, ALPHA = 24 t1 = CreateTexture(64, 64, loadtexture_COLOUR+loadtexture_ALPHA) TextureBlend(t1, textureblend_ALPHA) For x=0 To 63:For y=0 To 63 WritePixel(x,y,(Rand(255) Shl BLUE) + (255 Shl ALPHA),TextureBuffer(t1)) Next:Next t2 = CreateTexture(64, 64, loadtexture_COLOUR+loadtexture_ALPHA) TextureBlend(t2, textureblend_ALPHA) For x=0 To 63:For y=0 To 63 WritePixel(x,y,0,TextureBuffer(t2)) Next:Next For x=20 To 45:For y=20 To 45 WritePixel(x,y,(Rand(255) Shl GREEN) + (255 Shl ALPHA),TextureBuffer(t2)) Next:Next c = CreateCube() RotateEntity(c, -15, -20, 0) EntityTexture(c, t1, 0, 0) EntityTexture(c, t2, 0, 1) While Not KeyHit(1) EntityAlpha(c, 1) RenderWorld : Flip Delay 200 EntityAlpha(c, .5) RenderWorld : Flip Delay 200 Wend End
The cube should be blue noise with a green square of noise in the middle of it, and alternate between being opaque and 50% translucent. On the three computers I've tested this on, the blue background texture disappears entirely when EntityAlpha drops below 1.