PDA

View Full Version : SDL and Stencil Buffer



3_of_8
19-02-2007, 09:25 AM
I'm using SDL to get an OpenGL-Handle. I told SDL to set the stencil buffer size to 8.

My problem is, that it seems like the stencil buffer is ignored: I fill it by drawing a quad and then setting glStencilFunc(GL_EQUAL, 1, 1) but OpenGL still renders the complete "mirror world". If I set glStencilFunc(GL_NEVER, 1, 1), it still renders the same, which means everything.

Is there anything important with SDL and the stencil buffer I might have forgotten or I might not know?

savage
19-02-2007, 09:32 AM
Can you clarify how you set the stencil buffer to 8 using SDL? Code please.

savage
19-02-2007, 10:27 AM
Run glxinfo and look at the visuals listed at the bottom of all that
data it dumps out. Check to see if you have a visual that supports a 8
bit stencil buffer along with all the other buffers you are asking for.
You might find that your card does not have a mode that supports a 8
bit stencil buffer.

To fix the problem you either have to use a mode your video card
supports or buy a video card that supports the mode you need.

3_of_8
19-02-2007, 11:02 AM
Like that:

SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);

I'll take a look at that later.

3_of_8
19-02-2007, 12:25 PM
It works just fine with the stencil buffer/mirror demo of Sascha Willems which does not use SDL. My code is quite the same as his one. So I suppose it's just some problem with SDL. Not with my graphics card.

3_of_8
19-02-2007, 02:27 PM
Alright, that one's fixed.

Next time I got problems with the stencil buffer, could anyone slap me and tell me to set the buffer sizes BEFORE I initialize the video mode?

technomage
20-02-2007, 12:29 PM
You should ahve checked out

http://www.cerebral-bicycle.co.uk/viewdoc.asp?doc=307&date=Y

Tells you all you need to know :wink: