I tried your code john, and I'm getting a GL_INVALID_ENUM error. I tried `glGetError()` right after both the `glGetFramebufferAttachmentParameteriv`calls you have, and I'm getting the same errors there. It's the same thing in my own code.
Does this say anything? From the docs, this error would only appear if the 1st or 3rd argument to that function is invalid, but I'm pretty sure the arguments are correct.
You might try changing GL_STENCIL to GL_STENCIL_ATTACHMENT or GL_DEPTH_STENCIL_ATTACHMENT.
Originally Posted by DragonautX
If those work, it's a bug in the driver; GL_STENCIL is the correct parameter name for the default framebuffer; the other two are correct for a FBO.
I tried changing GL_STENCIL to the other two. It didn't work. Ya, I'm pretty sure this is a bug in my drivers.
From mhagain's comment about pixel formats, I can't find anywhere that says you can set a pixel format in GLFW. But it gave me the idea to try to find a minimal win32 example of OpenGL where I could set the pixel format explicitly. I found a 'minimal.c' file here.
I was able to copy-paste it. Had to switch arguments of `ReleaseDC()` for some reason, but after that, the program worked. Changed the second argument of `SetPixelFormat()` to a pixel format integer id 3, which I knew had 8 stencil bits (from the OpenGL Extension Viewer). Then I tried `glGetIntegerv`with GL_STENCIL_BITS in the `display()` function the and wrote the value to a file. Still was 0. If I was able to control the pixel format and still get a 0 stencil bits value, I'm pretty sure it's my laptop's drivers.
(Also, my last post was a mistake. I ran the code on a "AMD Radeon HD 7570M/HD 7670M Graphics" graphics card instead of the Intel one. My laptop has switchable graphics. The AMD card produces a GL_INVALID_ENUM error, but the Intel card doesn't.)
Anyways, thanks everyone for the help. I learned about glGetError() and pixel formats,. I got to try making a win32 opengl file work too. Never did that before, that was pretty cool.