[SOLVED] Stencil Mask - Gets ignored on many PCs

Started by frissdiegurke, November 16, 2013, 11:32:04

Previous topic - Next topic

frissdiegurke

Hey,
I'm new to OpenGL and LWJGL and after some problems with the register-system of this board I'm finally able to post my question  ;D

I write a 2D-Game and need a layer mask to simulate daytime with some lights.
So I wanna draw the whole screen black (with alpha channel) without some circles.

What I got so far is the following groovy-code (G11 static imported):
// following two lines are used to prepare (not within each render-step)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

glEnable(GL_STENCIL_TEST)
glStencilFunc(GL_NEVER, 0x1, 0x1)
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP)
glStencilMask(0x1)
glClear(GL_STENCIL_BUFFER_BIT)
glColor3f(1, 1, 1)
// Drawing (filled) circles to disable black layer there
glStencilMask(0x0)
glStencilFunc(GL_EQUAL, 0x0, 0x1)
glColor4f(0, 0, 0, 1 - data.daylight)
// Drawing polygon of full screen
glDisable(GL_STENCIL_TEST)


My problem is that this works on my ultrabook, but not on any other PC I own ???

Some data of my PCs:
ultrabook (Asus UX31A) (here the code works as expected):
 Linux 3.11.6-1-ARCH x86_64 GNU/Linux
 java version "1.7.0_45"
 OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
 driver: intel-dri 9.2.3-1 x86_64 (Mesa drivers for Intel) driver=i915
an other PC:
 Linux 3.2.0-56-generic #86-Ubuntu x86_64 GNU/Linux
 java version "1.7.0_25"
 OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
 driver: NVIDIA 173.14.35
 GeForce 8600GT
On this PC (and all others I own) the code above fills the circles white and after this draws the black mask above the full viewport (without excluding the circles).
So it seems that every line which contains stencil-methods just gets ignored :o

I use the same jar-file and same natives (lwjgl-2.9.0).
I include the natives using -Djava.library.path as JVM-parameter

May the natives have differences between INTEL and ATI/NVIDIA graphic-cards?

Thanks for any help and sorry for my english :)
If you need any more information, feel free to ask ;)

spasi

Check your PixelFormat and make sure the framebuffer is configured with a stencil buffer on both machines.

frissdiegurke

Thanks :)
Didn't know anything about PixelFormat ^^
Some solutions can be so easy  ;D

lg FDG