PDA

View Full Version : wglcreatecontext failed



kliston
01-31-2002, 05:43 AM
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

Eric
01-31-2002, 05:52 AM
Have you installed new drivers for your graphics card recently ?

They may be the cause of your problems...

Regards.

Eric

kliston
01-31-2002, 06:20 AM
Nope. That's the mystery.

-Kathleen


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

They may be the cause of your problems...

Regards.

Eric

Eric
01-31-2002, 06:31 AM
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

Syslock
01-31-2002, 07:01 AM
What does GetLastError() return?

kliston
01-31-2002, 07:19 AM
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?

Eric
01-31-2002, 07:27 AM
Is your HDC valid ? Have you checked that the PIXELFORMAT for it is correct ?

Regards.

Eric

Ysaneya
01-31-2002, 09:34 AM
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.

Syslock
01-31-2002, 09:35 AM
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.

Ysaneya
01-31-2002, 11:34 PM
This is what i do and i also have an "operation completed successfully" message.

Y.

ScottManDeath
02-01-2002, 02:39 AM
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

DanO
02-01-2002, 06:04 AM
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.

kliston
02-01-2002, 06:54 AM
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:
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.

Ysaneya
02-02-2002, 03:19 AM
> 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.

ehart
02-02-2002, 05:13 AM
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?

jwatte
02-02-2002, 06:12 AM
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" :-)

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

Ysaneya
02-02-2002, 09:36 AM
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.

Gorg
02-02-2002, 11:57 AM
I had the same problem with an ATI Radeon(plain http://www.opengl.org/discussion_boards/ubb/smile.gif ).

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.

grady
02-02-2002, 12:33 PM
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?

jwatte
02-03-2002, 10:33 AM
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.

seu
02-06-2002, 03:35 AM
I have a similar problem. It's with Glut, but I think the may be related. My system es an Athlon 600 width Diamond Viper II. Sometimes after recompiling (VC++) my application throws an exception, or doesn't redraw the OpenGL window. What i do is to change the resolution of the screen (sometimes a couple of times). It seems to reset some internal values, because after doing it the app works ok.

sbennett
02-06-2002, 03:56 AM
I have ScottManDeath's problem, on an Athlon, GeForce 2MX, Win ME(Aaaargh). Any OpenGL app I've written will fail on ChoosePixelFormat the second time its run, unless UT was run previously. The ChoosePixelFormat call just seems to completely freeze the system, so I have to hit the reset switch, Ctrl-Alt-Del doesn't even work.

MikeCarter
06-25-2002, 07:00 AM
I am seeing the exact same problem that kliston describes on WinNT4SP5 with both ATI FireGL 8800 and nVIDIA Quadro4 XGL/900. I see wglCreateContext() return a NULL HGLRC and give one of the two windows errors: "Operation succeeded" or "Entry point not found". I am certain that the PFD has been chosen correctly; indeed I can manually go through _all_ the pixel formats on both cards and all of the accelerated ones fail in exactly the same manner. Unaccelerated PFD work, although at software rendering speed.

The conditions for bringing this failure about are as yet unknown, and not simple. A simple application succeeds fine, whereas a more complex application does not, even though both get the very same PFD.

Did anyone here ever come up with a satisfactory explanation of this problem, or even some hard facts surrounding it?

pbrown
06-25-2002, 07:16 PM
One quick note, which might be helpful, but probably isn't. One of the first bugs I looked at after starting to work at NVIDIA involved one of our GeForce3 demos crashing on exit on Win98, after which all OpenGL programs would crash 100% of the time.

This turned out to be a bug in the DX8.0 DirectSound implementation -- our DirectDraw driver was being unloaded incorrectly by DDHELP.EXE when it was cleaning up sound buffer resources. But the rest of the run-time didn't get the word, so it called our entry points at their old addresses thinking the DLL was still loaded. No crash in DX7.0. I think it might be fixed with DX8.1, but I'm not sure. Explicitly freeing the DirectSound buffers on exit eliminated this problem (though that won't help you if you crash for other reasons).