2 * $Source: /cvs/cvsroot/d2x/video/ogl_sdl.c,v $
5 * $Date: 2001-10-09 08:17:07 $
7 * Graphics functions for SDL-GL.
9 * $Log: not supported by cvs2svn $
10 * Revision 1.3 2001/10/09 02:58:20 bradleyb
11 * Added window caption, hide mouse cursor
13 * Revision 1.2 2001/01/29 13:47:52 bradleyb
14 * Fixed build, some minor cleanups.
32 static int gl_initialized = 0;
34 void ogl_do_fullscreen_internal(void){
39 screen = SDL_GetVideoSurface();
40 SDL_WM_ToggleFullScreen(screen);
45 inline void ogl_swap_buffers_internal(void){
48 int ogl_init_window(int x, int y){
54 if (SDL_Init(SDL_INIT_VIDEO) < 0)
56 Error("SDL library video initialisation failed: %s.",SDL_GetError());
58 video_flags = SDL_OPENGL;
60 if (ogl_fullscreen) video_flags |= SDL_FULLSCREEN;
62 SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
63 SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
64 SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
65 // SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 1 );
66 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, bpp );
67 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
69 SDL_WM_SetCaption(DESCENT_VERSION, "Descent II");
71 if ( SDL_SetVideoMode( x, y, bpp, video_flags ) == NULL ) {
72 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
79 printf( "Vendor : %s\n", glGetString( GL_VENDOR ) );
80 printf( "Renderer : %s\n", glGetString( GL_RENDERER ) );
81 printf( "Version : %s\n", glGetString( GL_VERSION ) );
82 printf( "Extensions : %s\n", glGetString( GL_EXTENSIONS ) );
88 void ogl_destroy_window(void){