Results 1 to 3 of 3

Thread: Reading the stencil buffer

  1. #1
    Member Contributor
    Join Date
    May 2001
    Posts
    54

    Reading the stencil buffer

    Hello,

    I am having some trouble reading what is in the stencil buffer.

    Here is a small section of my code:
    GLVoid* pixels;

    glReadPixels(
    mpoint.x,
    mpoint.y,
    pixwidth,
    pixwidth,
    GL_STENCIL_INDEX,
    GL_FLOAT,pixels);

    mpoint is set with a mouseclick
    pixwidth is 100

    The damn thing crashes every time.

    Does anyone have an example of reading what is in the stencil buffer and outputting it into a file?

  2. #2
    Junior Member Newbie
    Join Date
    Oct 2001
    Location
    Denmark
    Posts
    4

    Re: Reading the stencil buffer

    You say that you only posted part of your code, so you may already be doing the following things.
    1. You didn't allocate any memory in your example, glReadPixels fills the array pointed to by the last parameter, so if is an illegal pointer that may be your problem
    2. Don't read stencil bits as floats, it may not be a problem, but they make no sense as floats so...

    I hope that helped you

    Cheers
    John

  3. #3
    Member Contributor
    Join Date
    May 2001
    Posts
    54

    Re: Reading the stencil buffer

    Thnx for the reply...

    I thought that pixels would be filled by the function call....guess not. I will try allocating memory beforehand....

    later

    Jeremy

Similar Threads

  1. Replies: 1
    Last Post: 09-11-2013, 11:35 AM
  2. copy app generated stencil data to stencil buffer
    By guilder in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 12-23-2010, 06:46 PM
  3. Trouble reading stencil buffer
    By Jeff McWilliams in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 10-10-2005, 07:03 AM
  4. :( trouble reading back the stencil buffer
    By uto in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 08-11-2005, 01:14 PM
  5. Reading the stencil buffer
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-27-2001, 06:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean