Stencil buffer hardware-dependant?

Hello,

I’ve developed an application using JOGL and the OpenGL stencil buffer and I’m pleased with the result on my computer. Testing the program on other machines I realized that the stencil process does not work correctly on all computers. The problem seems to occur only on machines with low-end graphics hardware. AFAIK these computers use OpenGL 1.4.
I thought that all GL implementations guarantee the full GL functionality. Is it that some implementations simply leave out some functionality? Is there a way to identify the capabilities of a system in advance (without running the JOGL-program)?

Any help appreciated,

Stefan

Stencil buffer capability is not guaranteed in any implementation. You must specifically request a pixel format with a number of stencil bits; if the drivers are able to deliver a pixel format with the number of stencil bits you’re OK; otherwise it should barf and say “No, can’t give you that.”

Cas :slight_smile:

Also, try checking the returned framebuffer:

            // Log the created canvas' framebuffer format
            int[] redBits = new int[1];
            int[] greenBits = new int[1];
            int[] blueBits = new int[1];
            int[] alphaBits = new int[1];
            int[] stencilBits = new int[1];
            int[] depthBits = new int[1];
            gl.glGetIntegerv(GL.GL_RED_BITS, redBits);
            gl.glGetIntegerv(GL.GL_GREEN_BITS, greenBits);
            gl.glGetIntegerv(GL.GL_BLUE_BITS, blueBits);
            gl.glGetIntegerv(GL.GL_ALPHA_BITS, alphaBits);
            gl.glGetIntegerv(GL.GL_STENCIL_BITS, stencilBits);
            gl.glGetIntegerv(GL.GL_DEPTH_BITS, depthBits);

…and even if you get frame buffer with requested format, on some cards (especially depends on screen resolution and amount of memory on the card) you can get very low performance of stencil buffer operations (OK, at least I get it with GeForce 440 Go 32 Mb 1600x1200 32bpp)

Yuri

it would have been just to nice having a guaranteed standard…
Thanks for enlightening (and disillusioning ;-)) me.

Stefan

If you’re getting deathly slow performance it’s because the driver has punted you back into software mode. (We don’t allow that in LWJGL so it never happens to us)

Only a few “well known” configurations exist for stencil buffers which consumer-class hardware supports. Can’t remember exactly what they are off the top of my head but generally you are only going to get an 8-bit stencil, and you’ll probably need to ask for at least a 16-bit depth buffer.

Cas :slight_smile:

Yeah - and its all unfortunately very hardware and driver dependant with respect to what you will actually get back from the system.