-
glCopyTexImage2D
Hi.
I want to be able to copy from the framebuffer the alpha buffer.
I do this:
glBindTexture(GL_TEXTURE_2D, tex);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 512, 512, 0);
but does not work.
I verify this using blending with GL_DST_ALPHA function.
The alpha is allways 1.
Please tell me what is happening and what to do about it.
Thanks.
-
Senior Member
OpenGL Guru
Re: glCopyTexImage2D
You probably don't have an alpha channel in the frame buffer. Call glGetInteger with GL_ALPHA_BITS to see how many alpha bits you have in the frame buffer.
-
Re: glCopyTexImage2D
Hi!
I've done what you said and the result was 0. Is strange because if I render my viewport with an alpha texture and then if I use alpha blending with GL_DST_ALPHA, and GL_ONE_MINUS_DST_ALPHA I get the expected result - mean transparency.
Pls tell me how should I get alpha bits.
Thanks
-
Re: glCopyTexImage2D
Hi!
I found the problem, was my pixel format structure. I didn't ask for alpha channel (was 0 before).
Hope someone find this useful.
Thanks.
PIXELFORMATDESCRIPTOR pfd={
sizeof(PIXELFORMATDESCRIPTOR), // Size of this structure
1, // Version of this structure
PFD_DRAW_TO_WINDOW | // Draw to a window (not bitmap)
PFD_SUPPORT_OPENGL | // Support OpenGL in window
PFD_DOUBLEBUFFER, // Double-buffered mode
PFD_TYPE_RGBA, // RGBA color mode
24, // RGB = 24 bits
0,0, // # of bits and shift for Red channel.
0,0, // # of bits and shift for Green channel.
0,0, // # of bits and shift for Blue channel.
8,0, // # of bits and shift for Alpha channel.
0, // No use of accumulation buffer
0,0,0,0, // # of Red, Green, Blue and Alpha bits in the accumulation buffer.
32, // Size of depth buffer
0, // No stancil buffer
0, // No auxiliary buffer
PFD_MAIN_PLANE, // Draw in main plane // seems that this is ignored
0, // Reserved
0, // Ignored only in earlier implementations of OpenGL
0, // Used only in index mode
0 }; // Ignored only in earlier implementations of OpenGL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules