glCopyTexImage2D and transparent clear color.

Hi All,

Is it possible that using the following pixel format on a generic software OpenGL implementation, if I read the framebuffer using glCopyTexImage2D() I don’t read alpha bits?

I clear the color buffer using:

glClearColor(0, 0, 0, 0);

I read the framebuffer using:

glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, textureSize, textureSize, 0);

Here is the choosen pixel format:

| ID | Type| Flags    | Buffer | pType| Color            |Dept|Alph|Sten| Accum         |
|  7 | GEN | 00000465 | DOUBLE | RGBA | 32 ( 8- 8- 8- 8) | 32 |  8 | 64 | (16-16-16-16) |



I have also checked just before the glCopyTexImage2D call the availabilty of alpha bits using:


and returns 8.

I think we should be able to get transparency here, don’t you?



“generic software OpenGL implementation”

Did you create your original texture with GL_RGBA8 internal format?
Or perhaps it only accepts a number like 4.

If that doesn’t work, use as your generic software rasterizer.

glBindTexture(GL_TEXTURE_2D, sharpTextureName);
glTexImage2D(GL_TEXTURE_2D, 0, gl.RGBA8, textureSize, textureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);

glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 0, 0, textureSize, textureSize, 0);

I don’t understand why if the pixel format supports 32 8-8-8-8 I should try GL_RGBA4, by the way I’ll try.



Nothing to do: I am working on windows and don’t like the idea to add a different OpenGL implementation.

Considering that if I use a green background (instead of a transparent one) I get a perfect texture, is there a way to swap the Green component with the Alpha one in a texture?

One more thought: is it possible that the original texture color is black and reading a 0,0,0,0 color don’t affect the texture color?!?



No, what I means is, instead of GL_RGBA8, use 4. 1, 2, 3, 4 are the GL 1.0 texture internal formats and perhaps that’s what the MS implementation wants. It is pretty old since MS wrote it in 1995.

glTexImage2D(GL_TEXTURE_2D, 0, 4, textureSize, textureSize, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);

if that doesn’t work, I can’t help you further.

No, nothing. I can’t believe it, from 1995 nobody spot this bug: glCopyTexImage2D can’t read alpha bits on Windows.

Any workaround?



Microsoft never updated their implementation. Mesa did.
Nothing to add.

Thanks ZbuffeR,

Now I know it is not possible, so I can stop trying.

Thanks again,