OpenGL stopped working in my application today

Started by
16 comments, last by SteQve 19 years, 1 month ago
I updated my drivers from ATI yesterday. And my windows-application won't show any graphic anymore. I downloaded a NeHe demo, and it works fine. Although I cannot see the difference to my program. Calls to wglCreateContext and wglMakeCurrent works fine. And glGetError returns 0 on every call. The pixelformat is set without problems. How can I debug my program? All seems fine, but nothing works. WM_PAINT messages are received, so the graphics _should_ show up... I understand that this might be a complex problem. But the code has worked for months, and I checked it with SourceSafe and I didn't change any code after the driverupdate. Therefore there must be a bug in my program, but I just can't find it. Any ideas of where to start looking for the bug?
Advertisement
Post the code for the initialization of OpenGL in your window as well as your render function. Are you calling SwapBuffers at the end of each frame ?
Author Freeworld3Dhttp://www.freeworld3d.org

Pixelformat:
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP,
PFD_TYPE_RGBA,
32,
8,
16,
8,
8,
8,
0,
0,
0,
64,
16,
16,
16,
16,
32,
8,
0,
0,
0,
0,
0,
0 };



Before render:

wglMakeCurrent(m_hdc, m_hGLContext )
glLoadIdentity();
glViewport(0,0, 300, 300 );
glOrtho(0, 300, 0, 300, 1.0, -1.0);

Render:
I'm just trying to draw a line...

glBegin(GL_LINES);
glVertex2d(0, 0);
glVertex2d(100, 1000);
glEnd();


After render:

glFlush();
glFinish();
::SwapBuffers(m_hdc);

Anything else?
I noticed that you are using PFD_DRAW_TO_BITMAP AND PFD_DRAW_TO_WINDOW. I do not think that will work correctly. I looked it up in NeHe's code and he has this:
static	PIXELFORMATDESCRIPTOR pfd=				// pfd Tells Windows How We Want Things To Be	{		sizeof(PIXELFORMATDESCRIPTOR),				// Size Of This Pixel Format Descriptor		1,											// Version Number		PFD_DRAW_TO_WINDOW |						// Format Must Support Window		PFD_SUPPORT_OPENGL |						// Format Must Support OpenGL		PFD_DOUBLEBUFFER,							// Must Support Double Buffering		PFD_TYPE_RGBA,								// Request An RGBA Format		bits,										// Select Our Color Depth		0, 0, 0, 0, 0, 0,							// Color Bits Ignored		0,											// No Alpha Buffer		0,											// Shift Bit Ignored		0,											// No Accumulation Buffer		0, 0, 0, 0,									// Accumulation Bits Ignored		16,											// 16Bit Z-Buffer (Depth Buffer)  		0,											// No Stencil Buffer		0,											// No Auxiliary Buffer		PFD_MAIN_PLANE,								// Main Drawing Layer		0,											// Reserved		0, 0, 0										// Layer Masks Ignored	};


So try only using the PFD_DRAW_TO_WINDOW and see if that works correctly.

- Drew
That's your entire code for OpenGL Initialization ?
Author Freeworld3Dhttp://www.freeworld3d.org
Quote:Original post by oconnellseanm
That's your entire code for OpenGL Initialization ?


I'm not following. Is more code required?
Quote:Original post by Drew_Benton
I noticed that you are using PFD_DRAW_TO_BITMAP AND PFD_DRAW_TO_WINDOW. I do not think that will work correctly. I looked it up in NeHe's code and he has this:
*** Source Snippet Removed ***

So try only using the PFD_DRAW_TO_WINDOW and see if that works correctly.

- Drew


No, it didn't change anything.
Maybe calling glClear or something like that helps? Setting the color to glClearColor( 0,0,0,0 ) and then calling the clear each frame, just after the wglSetCurrent call.

Crafter 2D: the open source 2D game framework

?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]

Quote:Original post by jeroenb
Maybe calling glClear or something like that helps? Setting the color to glClearColor( 0,0,0,0 ) and then calling the clear each frame, just after the wglSetCurrent call.


No, still nothing. And glGetError only reports 0.
paste your full source code with [_source_] [_/source_] tags (without underscores)
try setting clear color to red, is your screen red then? If so its a drawing problem

hope that helps
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."

This topic is closed to new replies.

Advertisement