I am a new member of the forum seeking a help from openGL seniors out there
Currently, I am doing an assignment about shadowing drawing using stencil buffer. The algorithm is alright, but it seems that when I wrote it in the Win32 Console framework , the stencil buffer was not working/disabled somehow, even when I used glEnable(GL_STENCIL_TEST), leaving no shadow rendered. When I use the framework used in all NeHe popular tutorials - he used WIN32 API to create real windows application to draw, there is a function having an argument to control the stencil buffer (0 - disable, 1- enable) , then my code can run and the shadow is displayed.
I want to ask what is the real cause of this issue and can I enable stencil buffer manually in console environment ?
Thanks for the help guys , really appreciate it. @_arts: Your code setup is for Windows application, which is pretty similar to NeHE I think. Do you know how to create the same effect with Console environment, when you do not use such WIN API function.
@kyle_: When I use your function to print out the value , I see a bunch of zero. My initial call is glClearStencil(1.0f). Is it normal ?
If get integer with GL_STENCIL_BITS returns zero, it means you are on pixel format without stencil.
Also, how do you even create your context if you dont use winapi???
For that you need a handle to a window (well, DC) on which SetPixelFormat was called with pixel format id of pixel format that does have stencil - what arts said.