SDL logs out my X session ( newbie question)

0 views
Skip to first unread message

Lysergic Acid

unread,
Nov 9, 2003, 2:03:46 AM11/9/03
to

This simple code logs out my x session ( rh9/gnome ) when run.

checking it in ddd, the logout occurs when setting the
SDL_FULLSCREEN mode. Any ideas why?

-------------

/* Example of initializing SDL, */

#include <SDL/SDL.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
SDL_Surface *screen;

/* Initialize SDL's video system and check for errors */
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
printf("Unable to initialize SDL: %s\n", SDL_GetError());
return 1;
}

/* Make sure SDL_Quit gets called when the program exits ! */
atexit(SDL_Quit);

/* Attempt to set a 640x480 hicolor video mode */
screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN); //throws logout
if(screen == NULL) {
printf("Unable to set video mode: %s\n", SDL_GetError());
return 1;
}

/* If we got this far, everything worked */
printf("Success!\n");

return 0;
}

Gernot Frisch

unread,
Nov 11, 2003, 4:12:22 AM11/11/03
to

"Lysergic Acid" <jab...@earthlink.net> schrieb im Newsbeitrag
news:pan.2003.11.09....@earthlink.net...


for OpenGL try this: It works on my SuSE 8.2/KDE 3.1.


video_flags = SDL_OPENGL | SDL_FULLSCREEN | SDL_NOFRAME;

/* Initialize the display */
switch (bpp) {
case 8:
rgb_size[0] = 3;
rgb_size[1] = 3;
rgb_size[2] = 2;
break;
case 15:
case 16:
rgb_size[0] = 5;
rgb_size[1] = 5;
rgb_size[2] = 5;
break;
default:
rgb_size[0] = 8;
rgb_size[1] = 8;
rgb_size[2] = 8;
break;
}
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, rgb_size[0] );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, rgb_size[1] );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL )
{
fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
SDL_Quit();
exit(1);
}

HTH,

-Gernot

In order to reply, revert my forename from:
tonreG.Frisch.at...@invalid.com
________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com


Reply all
Reply to author
Forward
0 new messages