Hi,
I have some basic GL code working very well on Windows 7 + NVIDIA. The same code has different behavior on Windows Vista + Intel 945GM. My code used to work on both platforms, so I think I have a fundamental issue which I’m having trouble to find.
The first noticeable symptom is that the screen shows only the background color assigned to the registered WNDCLASSEX. I do not see any of the objects I draw and attempts to set the clear color are not changing the screen color.
The next symptom is that the app crashes when I cleanup with wglDeleteContext(rc).
I think something is flawed in my basic setup, but after researching for hours I do not see any difference with what is recommended and my code. My setup does the following:
1- register a class and create a window
2- get the device context
3- enumerate the pixel formats with DescribePixelFormat
4- use choosepixelformat and setpixelformat to setup the DC.
5- wglCreateContext & wglMakeCurrent
Does anyone see how it is possible for the background color to show or why destroying the render context causes a crash?
On a side note, I also made a temporary window and a temporary render context after the application created its regular window. The handle for the temporary context is 0x00010000. Destroying this context does not cause a crash. Then my app continues, and the render context created from the application’s window is 0x00020000, but again destroying this context DOES cause a crash. Why would using a different window to a create a context not also cause a crash?
Hi guys,
Yes, I’ve followed protocol when destroying the context. Like I said, I destroy the 1st context with no problems and this stuff all works fine on NVIDIA. Thanks for the suggestions.
I was able to get a little more info from gDEBugger. It says an error occurred when I create my 2nd GL context. gDEBugger must register something to catch that info because I see 0x00020000 returned from wglCreateContext and wglMakeCurrent(0x00020000) return TRUE (in my application).
Does the fact that gDEBugger shows I have an error when creating my 2nd context give any hints? Again, it seems like maybe I did not delete my 1st context properly, and I’ve tried the variations in the link posted by V-man.
To summarize again, only gDEBugger reports an error. However, my app does not run properly (cannot clear buffers, VBOs are NULL) and it crashes when destroying the HGLRC.
Accept for the fact that I create a temporary window and HGLRC to detect the capabilities before creating the window and HGLRC that my app will use, this is an extremely minimal GL application using the “Intel 945GM” renderer.
Here is the code I am using to create / destroy my HGLRC:
class GLContext
{
private:
DECLARE_REF_COUNTING
RefPtr<DeviceContext> _dc;
HGLRC _hglRC;
Would someone confirm that this is the correct protocol for managing a GL context? It seems obvious to me, but maybe I do not understand something?
Another idea I had is that maybe I am using the wrong format index when creating the original context. Could that be an issue? I enumerate a list of PixelFormatDescriptors using the Windows API. I am arbitrarily choosing one with the highest settings before I create my context.
I’m pretty sure I figured out the problem. It had nothing to do with GL. I was logging with a wostringstream and I think I added too much to the SS. It must have tripped some error and everything went wack. I’m lucky I found it. The only clue I had was that my log file was incomplete.