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 7 of 7

Thread: PBuffer - depth component

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    5

    PBuffer - depth component

    Hi,

    is it possible to use glReadPixels from the pbuffer (wglCreatePbufferARB) in the same way like from the frame buffer? i'd like to read DEPTH_COMPONENT but i have the blank buffer after the rendering.
    (NVIDIA GeForce4 MX440, true color).

    greetings,
    josiph

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    807

    Re: PBuffer - depth component

    Did you remember to request a depth buffer when creating your pbuffer? If so, how many bits do you request?

    -- Tom

  3. #3
    Intern Contributor
    Join Date
    Jul 2001
    Location
    NY
    Posts
    85

    Re: PBuffer - depth component

    you also must remember to enable depth testing for the pbuffer (glEnable(GL_DEPTH_TEST)), or else rendering will have no effect on the depth buffer, even if it does in fact exist.

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    748

    Re: PBuffer - depth component

    It's also worth noting that depending on how you set up your Frustum and how you render you geometry, the variation in z-values may be very subtle. It might look like you have a blank (eg. white) pbuffer, but it may simply be that the precision isn't there to see the different values.

    For testing, move your far plane in (and/or your near plane out) so that your geometry fills up more of the space between the two planes. That'll make the variation more obvious.

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    5

    Re: PBuffer - depth component

    i asked for 32 in the ChoosePixelFormat, but i obtained just 16 bits in truecolor mode.
    so i set the depth bits to 16 (higher values did not work):
    WGL_DEPTH_BITS_ARB, 16

    complete atributes array for the wglChoosePixelFormatARB looks like this:
    WGL_SUPPORT_OPENGL_ARB, TRUE,
    WGL_DRAW_TO_PBUFFER_ARB, TRUE,
    WGL_COLOR_BITS_ARB, 32,
    WGL_DEPTH_BITS_ARB, 16,
    WGL_DOUBLE_BUFFER_ARB, TRUE,
    WGL_PBUFFER_WIDTH_ARB, n_width,
    WGL_PBUFFER_HEIGHT_ARB, n_height,

    the array of pbuffer attributes for the wglCreatePbufferARB is empty (just zero terminated).

    did i omit something?

    josiph

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    748

    Re: PBuffer - depth component

    Your settings look reasonable. Try calling glError() during your setup code to see if you are getting any errors.

    IIRC 32 bit z-depth may not be supported by your card. 24bit is most likely the maximum. (That leaves 8bits for stencil if you want it). I could be wrong though, perhaps some cards will let you use 32bit as long as you don't ask for stencil.

    24 bits should work on your card.

  7. #7
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    5

    Re: PBuffer - depth component

    > 24 bits should work on your card.

    yes, you're right. when i asked for 24 depth bits in ChoosePixelFormat i got them.
    also pbuffer with 24 bits was created afterwards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •