Does anyone know about any issues with OpenGL with SDL under Windows 2000?
The following program crashes on me inside of SDL_Quit():
int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return 1;
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
if (SDL_SetVideoMode(800, 600, 16, SDL_OPENGL) == 0) {
SDL_Quit();
return 2;
}
SDL_Quit(); // crashes here
return 0;
}
My call stack looks like this:
NTDLL! 77f9f9df()
NTDLL! 77fb4966()
NTDLL! 77fb3bdc()
NTDLL! 77fa7131()
NTDLL! 77fca4cb()
KERNEL32! 77e9e334()
3DFXOGL! 690099bb()
3DFXOGL! 6902f886()
3DFXOGL! 69090d31()
3DFXOGL! 69073efe()
3DFXOGL! 6901242f()
3DFXOGL! 6900a8a9()
3DFXOGL! 6900bb51()
OPENGL32! 695296de()
SDL! 1003ea7b()
SDL! 10025ef7()
SDL! 1003c0a1()
SDL! 10001234()
SDL! 10001269()
SDL_main(int 1, char * * 0x0012fed0) line 191
SAURCON! main + 306 bytes
SAURCON! WinMain at 16 + 413 bytes
SAURCON! WinMainCRTStartup + 308 bytes
KERNEL32! 77e87903()
Maybe this has something to do with my 3dfx driver? But I’ve never had any
other OpenGL program ever crash on exit like this. Has anyone else run into
this problem before?
-Jason
Here’s some more info on this. Since I have current SDL from CVS, I decided
to build a debug version of it to see where it’s hitting the proble. It’s
happening in file SDL_wingl.c, function WIN_GL_ShutDown(), line 121, which
looks like this:
this->gl_data->wglDeleteContext(GL_hrc);
The call stack looks more like this:
WIN_GL_ShutDown(SDL_VideoDevice * 0x00813ff0) line 122
DX5_VideoQuit(SDL_VideoDevice * 0x00813ff0) line 2205 + 9 bytes
SDL_VideoQuit() line 1248 + 10 bytes
SDL_QuitSubSystem(unsigned int 65535) line 198
SDL_Quit() line 214 + 10 bytes
Btw, I guess it’s not really a crash, but rather it’s hitting an int 3 CPU
instruction, which is the same as a breakpoint really in MSVC.
Looking at the MSVC online help for wglDeleteContext(), it says
GetLastError() can be used to get any error that occured, so I put a call to
that in after line 121, and the result is ERROR_INVALID_HANDLE. Kind of
interesting. However, if an error occurs, wglDeleteContext() is supposed to
return false, but it returned true. So I’m not exactly sure what’s going on
here.
-Jason> ----- Original Message -----
From: jason@hoffoss.com (Jason Hoffoss)
To:
Sent: Friday, March 22, 2002 10:49 AM
Subject: [SDL] OpenGL crash
Does anyone know about any issues with OpenGL with SDL under Windows 2000?
The following program crashes on me inside of SDL_Quit():
int main(int argc, char *argv[])
{
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return 1;
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
if (SDL_SetVideoMode(800, 600, 16, SDL_OPENGL) == 0) {
SDL_Quit();
return 2;
}
SDL_Quit(); // crashes here
return 0;
}
My call stack looks like this:
NTDLL! 77f9f9df()
NTDLL! 77fb4966()
NTDLL! 77fb3bdc()
NTDLL! 77fa7131()
NTDLL! 77fca4cb()
KERNEL32! 77e9e334()
3DFXOGL! 690099bb()
3DFXOGL! 6902f886()
3DFXOGL! 69090d31()
3DFXOGL! 69073efe()
3DFXOGL! 6901242f()
3DFXOGL! 6900a8a9()
3DFXOGL! 6900bb51()
OPENGL32! 695296de()
SDL! 1003ea7b()
SDL! 10025ef7()
SDL! 1003c0a1()
SDL! 10001234()
SDL! 10001269()
SDL_main(int 1, char * * 0x0012fed0) line 191
SAURCON! main + 306 bytes
SAURCON! WinMain at 16 + 413 bytes
SAURCON! WinMainCRTStartup + 308 bytes
KERNEL32! 77e87903()
Maybe this has something to do with my 3dfx driver? But I’ve never had
any
other OpenGL program ever crash on exit like this. Has anyone else run
into
this problem before?
-Jason
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Hi Jason!
Last thing I read sounds like you should try this:
SDL_Surface *whatever;
whatever = SDL_SetVideoMode(blahblah);
if(whatever==0) …
and then proceed as your previous code.
If there’s an INVALID_HANDLE, then it might be because you didn’t assign it
- so it probably wasn’t saved in any variable, and windows didn’t know
which context to delete.
Hopefully this is it …
St0fF.
At 12:12 23.03.2002 -0500, you wrote:
Well, I’m using this:
if (SDL_SetVideoMode(800, 600, 16, SDL_OPENGL) == 0) {
SDL_Quit();
return 2;
}
and then proceed as your previous code.
If there’s an INVALID_HANDLE, then it might be because you didn’t assign
it
- so it probably wasn’t saved in any variable, and windows didn’t know
which context to delete.
Hopefully this is it …
St0fF.
SDL_Quit() doesn’t take any parameters, so it must track the screen surface
internally I’m assuming. So doesn’t really matter if I keep track of it or
not. None of the OpenGL functions seem to take a surface to work with
either. It’s all hard wired to work on the screen surface directly I guess.
Seems like you’re right. I just tried this variation for setting up the
video mode in my demo. The only difference: I use 32bpp. It worked fine
and didn’t crash upon quitting. Did you do some rendering after
initializing the OGL-context? Well, I did … Anyhow, I guess I can’t
help you with this any further. Just have a try putting a
SDL_GL_SwapBuffers() right before SDL_quit(), so that some pseudo-rendering
occured.
Best wishes,
St0fF.> -Jason
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
Here’s some more info on this. Since I have current SDL from CVS, I decided
to build a debug version of it to see where it’s hitting the proble. It’s
happening in file SDL_wingl.c, function WIN_GL_ShutDown(), line 121, which
looks like this:
this->gl_data->wglDeleteContext(GL_hrc);
The call stack looks more like this:
WIN_GL_ShutDown(SDL_VideoDevice * 0x00813ff0) line 122
DX5_VideoQuit(SDL_VideoDevice * 0x00813ff0) line 2205 + 9 bytes
SDL_VideoQuit() line 1248 + 10 bytes
SDL_QuitSubSystem(unsigned int 65535) line 198
SDL_Quit() line 214 + 10 bytes
Btw, I guess it’s not really a crash, but rather it’s hitting an int 3 CPU
instruction, which is the same as a breakpoint really in MSVC.
Looking at the MSVC online help for wglDeleteContext(), it says
GetLastError() can be used to get any error that occured, so I put a call to
that in after line 121, and the result is ERROR_INVALID_HANDLE. Kind of
interesting. However, if an error occurs, wglDeleteContext() is supposed to
return false, but it returned true. So I’m not exactly sure what’s going on
here.
Did you ever figure this out? I tried your sample code, and it worked here.
-Sam Lantinga, Software Engineer, Blizzard Entertainment
No. I think it’s just the way things are with the 3dfx drivers or
something. That’s my theory right now anyway. I should be getting a new
video card soon, so we’ll see if it goes away. Only happens in debug mode
too. Right now, when I quit, it breaks, and then I hit F5 to continue
running and it finishes shutting down at that point and exits fine. So it’s
just more of an annoyance than anything really.
-Jason> ----- Original Message -----
From: slouken@devolution.com (Sam Lantinga)
To:
Sent: Saturday, March 30, 2002 9:56 PM
Subject: Re: [SDL] OpenGL crash
Here’s some more info on this. Since I have current SDL from CVS, I
decided
to build a debug version of it to see where it’s hitting the proble.
It’s
happening in file SDL_wingl.c, function WIN_GL_ShutDown(), line 121,
which
looks like this:
this->gl_data->wglDeleteContext(GL_hrc);
The call stack looks more like this:
WIN_GL_ShutDown(SDL_VideoDevice * 0x00813ff0) line 122
DX5_VideoQuit(SDL_VideoDevice * 0x00813ff0) line 2205 + 9 bytes
SDL_VideoQuit() line 1248 + 10 bytes
SDL_QuitSubSystem(unsigned int 65535) line 198
SDL_Quit() line 214 + 10 bytes
Btw, I guess it’s not really a crash, but rather it’s hitting an int 3
CPU
instruction, which is the same as a breakpoint really in MSVC.
Looking at the MSVC online help for wglDeleteContext(), it says
GetLastError() can be used to get any error that occured, so I put a
call to
that in after line 121, and the result is ERROR_INVALID_HANDLE. Kind of
interesting. However, if an error occurs, wglDeleteContext() is
supposed to
return false, but it returned true. So I’m not exactly sure what’s
going on
here.
Did you ever figure this out? I tried your sample code, and it worked
here.
-Sam Lantinga, Software Engineer, Blizzard Entertainment
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl