Stencil Buffer Won't Enable

For whatever reason my stencil buffer won’t enable. I call glEnable with GL_STENCIL_TEST and then do if glIsEnabled with GL_STENCIL_TEST != GL_TRUE then cout “asdf” and it always outputs “asdf” which would explain why none of the stencil buffer things I’ve been working with have been functional. Any reasons that this would happen?

Check what glGetInteger and GL_STENCIL_BITS returns. If it returns 0, I bet you forgot to ask for a stencil buffer when creating the pixel format.

That seems to be the problem, However I’m using qgl, and I don’t know how to request said bits in qgl. Does anyone?

I got it. For future reference to this question, under QGL there’s a class called QGLFormat that must be messed with to create every buffer except for the double and depth buffers. Create a QGLFormat, set flags with the set___(bool) calls and then call QGLFormat::setDefault() with your QGLFormat as the variable.