I have noticed that this function fails when I call it when it’s time to shutdown ie, when the app receives WM_DESTROY.
When I call wglMakeCurrent(NULL, NULL) it succeeds, but then trying to make it current again with my previous GL context fails.
So I wanted to see what the problem is.
I called GetLastError which gives some number.
Then I used FormatMessage (which usually works), but it doesn’t return anything. The lpMsgBuf parameter remains NULL!
This is on ATI. On NV, it’s working.
The message is sent when the window is beeing destroyed, but the handles are still valid. Also, every code I’ve seen do their cleanup during WM_DESTROY.
Where so you do your cleanup?
While I’ve never had trouble shutting down the GL in this way on NVIDIA hardware, the wording in the MSDN might give one pause. What exactly is meant by “removed from the sceen?”
As far as I can determine, they simply mean that the window is hidden and deactivated, but a window in every other respect.
You might try the GL shutdown before the window destruction, in the odd chance that it’s an ATI bug.
It had occured to me that doing it in WM_CLOSE is possible, but I think WM_DESTROY is fine. I’m trying to clarify MSDN’s statement.
Considering the fact that the Red Book, SDK’s provided by major vendors, thousands of tutorials and free code do this kind of thing or don’t delete GL resources at all, one has to wonder.
I’m trying to find out what is the "right thing to do"TM and what is "the correct behavior"TM
Why should one vendor’s driver report a failure when it works on another.
I’m interested in what other people think.
did u have a look at the source code for sdl/glut?
also perhaps the unreal source.