View Full Version : Alpha and back faces...

04-01-2002, 04:35 PM
I've been playing with alpha textures lately and I noticed something odd... I have a setup where I'm drawing a single quad, centered, with an RGB texture (no alpha) and then drawing the four vertical sides of a cube which would enclose the RGB quad. This outer cube is using an RGBA texture. The outside cube is rotating and the whole thing is viewed from a 30 degree angle, so I can see down through the top of the cube a bit.

Blending is enabled, and I'm using glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA )

The texture mode of the RGBA texture is GL_REPLACE.

I have back face culling turned off as I was interested to see if I could get away with rendering a piece of glass (or whatever) with a single quad rather than having a quad for each side. It seems that I can't get away with that, but not for any of the reason I expected.

The alpha on my RGBA texture does exactly what I would expect with regard to the RGB quad in the center of the scene and the clear color. The back faces of the cube though seem to only show through the alpha some of the time, other times the clear color shows where I should be able to see inside the cube.

What surprised me about this is that it's not consistant - or rather it's weirdly consistant. The same face will show consistant behaviour in the same position, but inconsistant behaviour over a range of positions.

I'm drawing all four faces of the cube with the same commands in a for loop and using the same texture.

Is this expected behaviour or...?

04-01-2002, 04:41 PM
Never mind... I'm an idiot.

Depth ordering was off because of the rotation... D'oh!

Now I understand.