wglcreatecontext failed

Suddently all opengl apps are returning this error on my machine. The app we write also fails and it turns out that the wglcreatecontext call returns null (the device context is not null), but there is no apparent source of the error. Worked one minute, then not the next. Does anyone have any potential sources? processes to look for, dll’s to replace, driver issues. It’s now happening on a customer’s computer and we can’t identify the source. Any help is much appreciated.

Thank you, Kathleen Liston

Have you installed new drivers for your graphics card recently ?

They may be the cause of your problems…

Regards.

Eric

Nope. That’s the mystery.

-Kathleen

Originally posted by Eric:
[b]Have you installed new drivers for your graphics card recently ?

They may be the cause of your problems…

Regards.

Eric[/b]

Which OS are you using ? Could it be the same problem that most people had after installing Quake 3 ??? It happened under Win98 and the solution was to comment a line that said “DVA=0” in the “win.ini” file IIRC…

Can’t see why it would affect you only now though…

Regards.

Eric

What does GetLastError() return?

GetLastError() returned “operation completed successfully.” Again, this is after:
-----------m_hRC returns NULL value

HDC hDC = m_pDC->GetSafeHdc();
m_hRC = ::wglCreateContext(hDC) ; /00Dec29jdn/

if (m_hRC == NULL) {    
	::AfxMessageBox("wglCreateContext failed.");

------------this returns the “operation completed successfully”
define DBG_WGL_FAIL
#ifdef DBG_WGL_FAIL
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Process any inserts in lpMsgBuf.
// …
// Display the string.
::AfxMessageBox((LPCTSTR)lpMsgBuf);
// Free the buffer.
LocalFree( lpMsgBuf );
#endif

-Kathleen

Originally posted by Syslock:
What does GetLastError() return?

Is your HDC valid ? Have you checked that the PIXELFORMAT for it is correct ?

Regards.

Eric

I have the same problem on a Radeon 8500 + Win 98, latest official drivers installed. After a couple of times (~20 times i’d say), all OpenGL applications fail to create a valid context. Maybe a memory leak in the driver ?

Y.

It is best to store the GetLastError() result immediately after the
function call in question.

GetLastError() may be saying that your call to MessageBox() was
completed successfully.

This is what i do and i also have an “operation completed successfully” message.

Y.

Hi

i have a similar problem with win98se, geforce2mx nvidia 23.11 drivers.When I start my applications they run fine a first time. then after recompiling they fail after choosepixelformat.I get a messagebox with something like memory fault and the msgbox title is “DDHELP.EXE”. Then all other opengl and direct x apps fail to start. I have to reboot.This only happens sometimes ?

Then sometimes opengl falls back to software when testing the win98 opengl screensavers afte some messageboxes.

But the amazing thing is, when i start unreal tournament before start my apps all works fine. I recognized that ut lets a process from ddhelp.exe running after quiting. a friend told me that he had heard that ut incrases stability for 3d apps through some memory tweaking. Does anyone know if something is there about

Bye
ScottManDeath

Ysaneya,

I haven’t heard of this problem before with the 8500. Does the problem go away when you restart the system? Can you tell me a little more about your system and what apps you’re running before this problem starts to occur? Any details would help us figure out what’s going on.

I have a Dell Inspiron 8000, ATI Mobility M4. This problem suddenly appeared and then after about a day or so disappeared. One of my customers still can’t get rid of it. I wish I knew whether it was a memory leak or whether there was some way to prevent before it happens again.

-Kathleen Liston

Originally posted by DanO:
[b]Ysaneya,

I haven’t heard of this problem before with the 8500. Does the problem go away when you restart the system? Can you tell me a little more about your system and what apps you’re running before this problem starts to occur? Any details would help us figure out what’s going on.[/b]

> Does the problem go away when you restart the system?

Fortunately, yes. But i still have to reboot every hour or so (i develop a lot in opengl). Pretty annoying. I have a PIII-500, Win98 and 256 Mb of RAM. I’m running applications of my own before the problem start to occur, but when the problem starts, no other opengl application will work. They’ll all fail on the wglCreateContext call, returning NULL, and GetLastError returning an operation completely successfully. I’m suspecting a memory leak in the driver. I must admit, my applications generally don’t exit “properly” (most of the time i alt-f4 or stop the debugguer). Hope that helps.

Y.

That last bit seems like a bit of a hint, have you ever seen this occur when you are correctly closing the context and shutting down the app?

The upgrade to Windows XP is $99. It’s well worth it, if you’re currently developing on Win98, as WinXP cleans up much better from application termination. (Linux does this too, but is, uh, “different” :slight_smile:

Beware that WinXP, out of the box, doesn’t support OpenGL very well until you get and install new graphics drivers from the vendor.

It’s not a money problem. I often swap video cards, so XP is not a very good solution if every month or so i need to register again.

I’ll try to see if it still happens when i gracefully shut the application down.

Y.

I had the same problem with an ATI Radeon(plain ).

When my software would crash, after a couple times, I could not create contexts. If my application closed gracefully, I never had any problems.

This only happened on Win98 and not on Win2k.

It seems like often times, if I’m running and rerunning one of my programs that is leaking device contexts or something the icons on the desktop will start to all be assigned one incorrect icon and the desktop wall paper will not appear. Its like everything has the outlook express icon and the background is solid grey. Do you notice any absurd side effects like this happening?

So get Win2k if you phear the registration. Developing on Win98 for longer than three days was the most painful thing I ever did in my life, and I will not do it again. Life’s just too short.

Note that now and then, you have to break down and do a three-day stint on Win98 to ensure compatibility. But as long as you can localize that to specific Win98 issues (while the program is healthy, running fine on Win2k/XP) then it’s at least bearable.