I've been playing about with reflections and the stencil buffer for the first time the past few days and I've run into a problem again:
The reflected object (a sphere) also appears in the "void" around the "mirror" object.

So basically I have a plane and a sphere, and when I move the reflection off the plane, it becomes visible from beneath the plane.

If anyone can help me with this I'd be very happy http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by Structural (edited 01-04-2003).]

JustHanging

01-04-2003, 06:07 AM

Hi,

I'm not very sure about this, but my best guess is that you must have depth test enabled when using stencil. After all, the stencil operations depend on the result of the depth test.

Also, make sure you properly clear the stencil buffer. If you have many reflecting walls, use a different reference value for each. In that case you must change mask to 0, which means no mask. And last, make sure you request stencil buffer when creating the window, otherwise you won't get it.

-Ilkka

Structural

01-04-2003, 07:50 AM

Thank you,
I looked into the things you mentioned and I noticed that I was missing the most important thing: Request the stencil buffer on window creation.
This part isn't covered AT ALL in my book so no wonder I couldn't figure it out.