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

Thread: glClearStencil () question

  1. #1
    Intern Contributor
    Join Date
    May 2002
    Location
    Irvine, CA, USA
    Posts
    51

    glClearStencil () question

    If I have the following code:

    glStencilMask (0xFF);
    glClearStencil (0xFF);
    unsigned char id;
    glReadPixels (0, 0, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, &id);

    Why is it that I get a value 0 for id? Do I have to wait for the clear to actually happen? Is there a client state that needs to be enabled for the clear to function properly?

  2. #2
    Member Regular Contributor
    Join Date
    Oct 2001
    Location
    Princeton, NJ
    Posts
    391

    Re: glClearStencil () question

    if my memory serves me, glClearStencil sets the value to clear the stencil buffer to, you need to call glClear(GL_STENCIL_BUFFER_BIT) to actually clear it

  3. #3
    Intern Contributor
    Join Date
    May 2002
    Location
    Irvine, CA, USA
    Posts
    51

    Re: glClearStencil () question

    Yup, that was it. That was why it was always wrong only on the first frame.

    Thanks!

Posting Permissions

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