Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2010-01-10 19:37:47
Size: 884
Editor: SheenaSmith
Comment: added DRAFT to top for removal after page is edited
Revision 3 as of 2010-08-04 01:34:02
Size: 2181
Editor: SheenaSmith
Comment: update content (old wiki)
Deletions are marked like this. Additions are marked like this.
Line 21: Line 21:
Returns 0 on success or a negative error code on failure; call [[SDL_GetError]]() for more information. Returns 0 on success or ,,a negative error code,, ^* -1 *^ on failure; call [[SDL_GetError]]() for more information.
Line 24: Line 24:
*<<BR>>
Line 25: Line 26:
You can add your code example here SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) {
    fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
    SDL_Quit();
    return;
}
Line 27: Line 37:
<<BR>>*

<<Color2(green,Seems like the SDL_!SetVideoMode part of the example needs to be updated?)>>
Line 29: Line 42:
''You can add useful comments here'' *<<BR>>This function sets the OpenGL attribute '''attr''' to '''value'''. The requested attributes will take effect after ,,a call to SDL_SetVideoMode,, ^initializing the video driver^. You should use [[SDL_GL_GetAttribute]]() to check the values after ,,a call to SDL_SetVideoMode,, ^initializing the video driver^, 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. <<BR>>*

<<Color2(green,Should SDL_GL_DOUBLEBUFFER be hyperlinked to SDL_GLattr like [[SDL_GLattr|SDL_GL_DOUBLEBUFFER]]? It could also go to an anchor at that value specifically instead of just to the page. Is there a link for SDL_DOUBLEBUF? Does it still exist?)>>

DRAFT

SDL_GL_SetAttribute

Use this function to set an OpenGL window attribute before window creation.

Syntax

int SDL_GL_SetAttribute(SDL_GLattr attr,
                        int        value)

Function Parameters

attr

the SDL_GLattr to be set

value

the desired value for the attribute

Return Value

Returns 0 on success or a negative error code * -1 * on failure; call SDL_GetError() for more information.

Code Examples

*

SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) {
    fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
    SDL_Quit();
    return;
}


*

green

Remarks

*
This function sets the OpenGL attribute attr to value. The requested attributes will take effect after a call to SDL_SetVideoMode initializing the video driver. You should use SDL_GL_GetAttribute() to check the values after a call to SDL_SetVideoMode initializing the video driver, 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.
*

green


CategoryAPI, CategoryVideo

None: SDL_GL_SetAttribute (last edited 2015-04-26 19:19:56 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit