Opengl 1.1 and transparent textures


does Microsoft’s implementation of OpenGL 1.1 support transparent textures?
In my application they don’t seem to work, so I would like to know if it’s a known limitation.

“transparent textures”… try glBlendFunc() with the corresponding blending coeficients that you want and then glEnable(GL_BLEND) before rendering the transparent primitives you want.

Also, take care about the depth testing (even though a texture is “transparent” it can still write to the depth buffer if you “let it”, which might not be what you want, because it will “hide” everything behind it, be it transparent or not).

sum-up (just one incomplete example, play with the params):

… …
… …


my code works with hardware acceleration, but it doesn’t work without it.

Here are the steps I do:

  1. I clear the scene with a alpha 0

gl.ClearColor(0, 0, 0, 0);

  1. draw some geometry

  2. read it into a texture:

gl.BindTexture(gl.TEXTURE_2D, myTexture);

gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA8, texSize, texSize, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);

gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.CopyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, texSize, texSize);

  1. clear again color and depth buffer

  2. draw my real scene

  3. draw the texture (created at step 3) over it:

gl.BindTexture(gl.TEXTURE_2D, myTexture);
// draw a Quad with the textures coordinates

The texture should be transparent in the empty areas (of step 2) but, if hdw acceleration if OFF, it is black and covers my scene.

With hdw acceleation on, the texture is correctly transparent.

The code above can only provide transparent area if you have a destinaton alpha on the framebuffer.
If you don’t ask for it explicitely, it may or may not be present.
See point here :

Ie. with Microsoft software implementation of OpenGL 1.1, there is no destination alpha.

Try using mesa3D instead.


but I’m not using DST_ALPHA anywhere…

Yes you do, indirectly :
2) draw some geometry
3) read it into a texture
… now DST_ALPHA from your first pass becomes SRC_ALPHA in the second pass.

Ok, thank you