1SDL_GL_SetAttribute(3)         SDL API Reference        SDL_GL_SetAttribute(3)
2
3
4

NAME

6       SDL_GL_SetAttribute - Set a special SDL/OpenGL attribute
7

SYNOPSIS

9       #include "SDL.h"
10
11       int SDL_GL_SetAttribute(SDL_GLattr attr, int value);
12

DESCRIPTION

14       Sets  the  OpenGL attribute attr to value. The attributes you set don't
15       take effect until after a call  to  SDL_SetVideoMode.  You  should  use
16       SDL_GL_GetAttribute to check the values after a SDL_SetVideoMode call.
17

RETURN VALUE

19       Returns 0 on success, or -1 on error.
20

EXAMPLE

22       SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
23       SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
24       SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
25       SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
26       SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
27       if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) {
28         fprintf(stderr, "Couldn't set GL mode: %s
29       ", SDL_GetError());
30         SDL_Quit();
31         return;
32       }
33
34              Note:
35
36              The  SDL_DOUBLEBUF flag is not required to enable double buffer‐
37              ing when setting an  OpenGL  video  mode.  Double  buffering  is
38              enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute.
39

SEE ALSO

41       SDL_GL_GetAttribute, GL Attributes
42
43
44
45SDL                         Tue 11 Sep 2001, 23:01      SDL_GL_SetAttribute(3)
Impressum