Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: glCopyTexImage2D

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    10

    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.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    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.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    10

    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

  4. #4
    Junior Member Newbie
    Join Date
    Jun 2002
    Posts
    10

    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
  •