Jump to content
  • Advertisement
Sign in to follow this  
kujneki

Lesson 26: Reflections using stencil buffer

This topic is 3714 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've downloaded the code (port for LWJGL) from the tutorial and ran the program. Here is what I get: http://freeweb.t-2.net/vision/stencil.gif I don't think it's supposed to be like that, but since that's the code from the tutorial I'm getting really confused. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
This looks as if the stencil buffer is not enabled, because you can see the sphere below the surface.

Try to enable it using the Display.create(myPixelFormat) method with a Pixelformat which requires a stencil buffer (http://www.lwjgl.org/javadoc/org/lwjgl/opengl/PixelFormat.html).

so perhaps Display.create(new PixelFormat(8,8,8));

Hope that helps
Carsten

Share this post


Link to post
Share on other sites
Whilst I cant comment on what this program does or what source your are referring to - have you tried some debugging steps.

The first of which is to query OpenGL to determine the number of allocated stencil bits that you actually have.

try something like this:

int _iStencilBits=0;
glStencilMask(0xFFFFFFFF); // resets the stencil mask
glGetIntegerv (GL_STENCIL_BITS, &_iStencilBits);

If you find you dont have any stencil bit allocated then look at your device context code, ensure your setup includes a request for Stencil.
Also, in your render loop - the clear buffers command - ensure you clear the COLOR+DEPTH+STENCIL bits.

Share this post


Link to post
Share on other sites
Thank you both! It was what Caste said. After creating Display with PixelFormat it worked like a charm.

p.s. - if owner of the site is reading this, please update the LWJGL code from Lesson 26, because it doesn't work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!