[SDL] Minimal SDLLoop using SDL_GL_Swapbuffers freezes gfx (fwd)

Boy Maas m4nic at preg.org
Thu Jan 29 07:16:01 PST 2004


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

<prog>
#include <stdio.h>
#include <stdlib.h>

#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;
}
</prog>

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

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

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




More information about the SDL mailing list