I’m having problems with OpenGL and SDL. It seems that X11_GL_Shutdown()
isn’t working properly, and is leaving my video card’s memory still mapped in
my program’s address space.
If I call SDL_SetVideoMode with the opengl flag, then without the opengl flag,
and then with the opengl flag, address space usage stays normal(though it
isn’t what it should be after I call setvideomode without the opengl flag, it
is correct after the second call to setvideomode with the opengl flag set).
However, if I call SDL_QuitSubSystem(SDL_INIT_VIDEO) and then
SDL_InitSubSystem(SDL_INIT_VIDEO) in between the calls to SDL_SetVideoMode(),
address space usage is almost twice what it should be after the 3rd call to
SDL_SetVideoMode().
This behavior is interfering with the usability of the program I’m developing,
so it is a real problem for me. I’d like to know if anyone else(ATI-card
users?) has this problem.
Here’s a little test program:
#include <SDL/SDL.h>
main()
{
SDL_Init(SDL_INIT_VIDEO);
SDL_SetVideoMode(256,256,0,SDL_OPENGL);
//SDL_QuitSubSystem(SDL_INIT_VIDEO);
//SDL_InitSubSystem(SDL_INIT_VIDEO);
getchar();
SDL_SetVideoMode(256,256,0,0);
//SDL_QuitSubSystem(SDL_INIT_VIDEO);
//SDL_InitSubSystem(SDL_INIT_VIDEO);
getchar();
SDL_SetVideoMode(256,256,0,SDL_OPENGL);
getchar();
}
xodnizel wrote:
I’m having problems with OpenGL and SDL. It seems that X11_GL_Shutdown()
isn’t working properly, and is leaving my video card’s memory still mapped in
my program’s address space.
If I call SDL_SetVideoMode with the opengl flag, then without the opengl flag,
and then with the opengl flag, address space usage stays normal(though it
isn’t what it should be after I call setvideomode without the opengl flag, it
is correct after the second call to setvideomode with the opengl flag set).
However, if I call SDL_QuitSubSystem(SDL_INIT_VIDEO) and then
SDL_InitSubSystem(SDL_INIT_VIDEO) in between the calls to SDL_SetVideoMode(),
address space usage is almost twice what it should be after the 3rd call to
SDL_SetVideoMode().
This behavior is interfering with the usability of the program I’m developing,
so it is a real problem for me. I’d like to know if anyone else(ATI-card
users?) has this problem.
I have this problem too (running Nvidia drivers 44.96).
It disappears as soon as you link with OpenGL. So if I compile your code
using :
gcc prog.c sdl-conifig --libs --cflags
I have the problem, whereas with :
gcc prog.c sdl-conifig --libs --cflags
-L/usr/X11R6/lib -lGL
I don’t see it anymore.
Btw, does this cause other problems than reporting using too many RAM in
’top’ ? Does your processe happen to map too much memory ?
Stephane
Hmm, that does work. I think the problem in my “real” program started when I
moved to using SDL_GL_LoadLibrary() and SDL_GL_GetProcAddress(), and no
longer linked with GL; mainly so that I could have OpenGL support compiled
in, and not worry about some Win32 systems not having the library.
I can have GL linked in on the Linux build, since I don’t distribute Linux
binaries and most distributions should have some implementation of OpenGL
installed anyway, but I don’t feel good about leaving a possible bug in
SDL/NVidia drivers intact. -_-
Oh well. Thanks for the tip.
I have this problem too (running Nvidia drivers 44.96).
It disappears as soon as you link with OpenGL. So if I compile your code
using :
gcc prog.c sdl-conifig --libs --cflags
I have the problem, whereas with :
gcc prog.c sdl-conifig --libs --cflags
-L/usr/X11R6/lib -lGL
I don’t see it anymore.
Yes, and OpenGL fails to initialize.> Btw, does this cause other problems than reporting using too many RAM in
‘top’ ? Does your processe happen to map too much memory ?
Stephane
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
xodnizel wrote:
Hmm, that does work. I think the problem in my “real” program started when I
moved to using SDL_GL_LoadLibrary() and SDL_GL_GetProcAddress(), and no
longer linked with GL; mainly so that I could have OpenGL support compiled
in, and not worry about some Win32 systems not having the library.
I can have GL linked in on the Linux build, since I don’t distribute Linux
binaries and most distributions should have some implementation of OpenGL
installed anyway, but I don’t feel good about leaving a possible bug in
SDL/NVidia drivers intact. -_-
Well, judging by the behaviour, it seems to be something in Nvidia.
Maybe you could ask their tech support.
Stephane