Minimal SDLLoop using SDL_GL_Swapbuffers freezes gfx (fwd)

First of all, thx for the great lib SDL guys. Good work!

#include #include

#include <GL/gl.h>
#include <SDL/SDL.h>

int main(int argc, char *argv[])
{

if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
	exit(1);
}

SDL_Surface *screen;
screen=SDL_SetVideoMode(640,480,32,SDL_OPENGL);
if ( ! screen )
{
	SDL_Quit();
	exit(2);
}

SDL_WM_SetCaption("Min_SDL", "min_sdl");

int done = 0;
Uint8 *keys;
while(!done)
{
	// flush event queue
	SDL_Event event;
	while ( SDL_PollEvent(&event) )
	{
		switch(event.type) {
			case SDL_QUIT:
				done = 1;
				break;
		}
	};

	keys = SDL_GetKeyState(NULL);

	if ( keys[SDLK_ESCAPE] ) {
		done = 1;
	}
	SDL_GL_SwapBuffers();
}

SDL_Quit();
return 0;

}

Hope anybody can help me with this one. Been struggling with it for days
:confused:

If I compile the above loop, X freezes. No input possible, BUT box still
functions :confused:

I can ssh to it, kill (-9) the process and the problem dissapears. No
errors no nothing.

I’ve brought is down to the SDL_GL_SwapBuffers call, if I place it
outside the loop there is no problem.

NOW IT GET’S INTERESTING

If I compile the SDLgears program (with exactly the same params), which
does much more than this minimal loop. The SDL_GL_SwapBuffers works
perfectly.

Normal precompiled SDL programs also work great on my system, so whats
up with that ?

if I put a SDL_Delay in the loop, the SDL_GL_SwapBuffers works as expected.

NEED HELP!!

Hardware:
00:01.4 Multimedia audio controller: Silicon Integrated Systems [SiS] SiS PCI Audio Accelerator (rev 02)
01:00.0 VGA compatible controller: Silicon Integrated Systems [SiS] SiS630 GUI Accelerator+3D (rev 31)

On debian linux:
ii libsdl-mixer1. 1.2.5-3 mixer library for Simple DirectMedia Layer 1
ii libsdl-mixer1. 1.2.5-3 development files for SDL1.2 mixer library
ii libsdl1.2-dev 1.2.6-2 Simple DirectMedia Layer development files
ii libsdl1.2debia 1.2.6-2 Simple DirectMedia Layer
ri libsdl1.2debia 1.2.6-2 Simple DirectMedia Layer (with all available
ic libsdl1.2debia 1.2.6-2 Simple DirectMedia Layer (with X11 and OSS o

Boy Maas wrote:

First of all, thx for the great lib SDL guys. Good work!

#include #include

#include <GL/gl.h>
#include <SDL/SDL.h>

int main(int argc, char *argv[])
{

if ( SDL_Init(SDL_INIT_VIDEO) < 0 )
{
exit(1);
}

SDL_Surface *screen;
screen=SDL_SetVideoMode(640,480,32,SDL_OPENGL);
if ( ! screen )
{
SDL_Quit();
exit(2);
}

SDL_WM_SetCaption(“Min_SDL”, “min_sdl”);

int done = 0;
Uint8 *keys;
while(!done)
{
// flush event queue
SDL_Event event;
while ( SDL_PollEvent(&event) )
{
switch(event.type) {
case SDL_QUIT:
done = 1;
break;
}
};

  keys = SDL_GetKeyState(NULL);

  if ( keys[SDLK_ESCAPE] ) {
  	done = 1;
  }
  SDL_GL_SwapBuffers();

}

SDL_Quit();
return 0;
}

Hope anybody can help me with this one. Been struggling with it for days
:confused:

I doesn’t freeze anything here, I can quit nicely (I’m using
linux/X11/Nvidia)

you should use the following #includes for portability :

#include “SDL.h”
#include “SDL_opengl.h”

Maybe it’s related to your hardware/software setup. You should see with
other SiS owners if they have the same problem.

Stephane

Thanx for checking it, I’ve searched the web but didn’t find anything
there. I was hoping someone would recognize the problem here …

thx anyways …> I doesn’t freeze anything here, I can quit nicely (I’m using

linux/X11/Nvidia)

you should use the following #includes for portability :

#include “SDL.h”
#include “SDL_opengl.h”

Maybe it’s related to your hardware/software setup. You should see with
other SiS owners if they have the same problem.

Stephane


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl