PDA

View Full Version : Reading the stencil buffer



Jeeeez
10-24-2001, 06:12 AM
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?

juleman
10-24-2001, 09:45 AM
You say that you only posted part of your code, so you may already be doing the following things.


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

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

Jeeeez
10-25-2001, 10:02 AM
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