E
E
Eirenliel2012-07-18 20:43:41
Java
Eirenliel, 2012-07-18 20:43:41

Stencil Buffer not working?

I understand terribly little about graphics programming, so please explain what I'm doing wrong. I write in Java in OpenGL via LWJGL. The crux of the problem is that Stencil Buffer just doesn't work.
There is a large and long program in which you need to hide a part of the graphics that will be drawn in one place. Having suffered with this buffer, I realized that something was wrong. Piece of code:

GL11.glEnable(GL11.GL_STENCIL_TEST);
GL11.glStencilFunc(GL11.GL_NEVER, 0, 0);

// Рисуем объекты

GL11.glDisable(GL11.GL_STENCIL_TEST);

Logic suggests that in general, all objects drawn in the specified piece of code will not be displayed. But it's not! The stencil buffer is not used anywhere else in the program. The code should be more complicated, with buffer filling, but even that doesn't work. What am I doing wrong and where do my hands come from?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sdevalex, 2012-07-19
@sdevalex

With such questions, it is better to contact the forum www.gamedev.ru/forum/
In general, there is an article that explains everything in some detail ... www.gamedev.ru/code/terms/StencilBuffer

E
Eirenliel, 2012-07-24
@Eirenliel

All these articles do not explain in any way how to set the depth of the stencilbuffer in LWJGL. Thank you very much, Bagobor, everything works.
99% of articles on OpenGL for all sorts of C ++ and glut, I don’t have this, so they only help on OpenGL functions and general principles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question