PDA

View Full Version : copying stencil buffer into a texture



canuckle
09-13-2005, 03:45 PM
How do I copy the stencil buffer into a texture? I would like to avoid glReadPixels() because I don't need the values in main memory, but would rather keep them on the video card.

I am able to copy the depth values into a texture with:


glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24,
nWidth, nHeight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0);

glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, left,
bottom, width, height);However, I'm not sure what the Stencil equivalent would be. Using GL_STENCIL_INDEX8_EXT and GL_STENCIL_INDEX did not work.

Hlz
09-17-2005, 09:42 AM
I think it's because GL_STENCIL_INDEX is an invalid format for glTexImage2D.