SDL_GL_SetAttribute
SDL_GL_SetAttribute -- Sets a special SDL/OpenGL attribute
Syntax
int SDL_GL_SetAttribute(SDL_GLattr attr, int value);
Description
This function sets the OpenGL attribute attr to value. The requested attributes will take effect after a call to SDL_SetVideoMode. You should use SDL_GL_GetAttribute to check the values after a SDL_SetVideoMode call, since the values obtained can differ from the requested ones.
Note : The SDL_DOUBLEBUF flag is not required to enable double buffering when setting an OpenGL video mode. Double buffering is enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute.
Parameters
attr [in]
The SDL OpenGL attribute to set. See SDL_GLattr for the full list of available attributes
value [in]
- The new value of the attribute
Return value
-1
- On error
0
- On success
See also
SDL_GL_GetAttribute, SDL_GLattr
Example
1 SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
2 SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
3 SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
4 SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
5 SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
6 if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) {
7 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
8 SDL_Quit();
9 return;
10 }
Requirements
Header |
SDL.h |
Version |
1.2.13 |
Shared object |
libSDL.so |
DLL |
SDL.dll |
