Stencil buffer problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Stencil buffer problem

Loicus
Dear all,

I am trying to use the stencil buffer for the first time,
and my test is not really succesfull so far...

Here is the code I've been added in my "init" function.  I am working in Java with JOGL, but I don't think that this is the issue.
After this code, I would expect that nothing can be drawn on my screen..., since:
1) I clear the buffer with "1"
2) I use the glStencilFunc with GL_NEVER.

[CODE]
gl.glEnable(GL2GL_STENCIL_TEST);
gl.glClearStencil(0x1);
gl.glClear(GL2.GL_STENCIL_BUFFER_BIT);    
gl.glStencilFunc(GL2.GL_NEVER, 0x1, 0x1);    
gl.glStencilOp(GL2.GL_KEEP, GL2.GL_KEEP, GL2.GL_KEEP);
[/CODE]


Unfortunately, I can change whatever I want to the stencil function,
I always have all my objects being displaied on screen.
What am I missing ?

Thanks for help,
Loic
Reply | Threaded
Open this post in threaded view
|

Re: Stencil buffer problem

gouessej
Administrator
Hi

There is a working example in this tutorial (in C), the source code is in the bottom of the page:
http://gritche.chez-alice.fr/OpenGL/Ombre_reflet.html

This one uses JOGL 1 but it should be easy to port it to JOGL 2:
http://jerome.jouvie.free.fr/opengl-tutorials/Tutorial23.php
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Stencil buffer problem

Loicus
never mind,
it seems that the problem is due to the fact that I can not create a canvas with simultaniously the Stencil buffer and the Stereo (Quard) Buffers
If I disable the Stereo flag, it works fine