This is my code to initialize video in my game.

[pascal] // Init Video Mode + Joysticks //
if (SDL_Init(SDL_INIT_VIDEO + SDL_INIT_JOYSTICK) <> 0) then
Halt;

// Set the title bar in environments that support it
SDL_WM_SetCaption('Garland''s Quest ' + EDITION_NAME + ' ' + VERSION_NUMBER, nil);

////////////////////////////////Some Extra Setup\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//Get Video Info
videoInfo := SDL_GetVideoInfo;
flags := SDL_OPENGL; //Enable OpenGL in SDL
flags := flags or SDL_DOUBLEBUF; //Enable double buffering
flags := flags or SDL_HWPALETTE; //Store the palette in hardware
// flags := Flags or SDL_RESIZABLE; //Enable window resizing?
if (GO_FULLSCREEN) then
flags := flags + SDL_FULLSCREEN;

// This checks to see if surfaces can be stored in memory
if ( videoInfo.hw_available <> 0 ) then
flags := flags or SDL_HWSURFACE
else
flags := flags or SDL_SWSURFACE;

// This checks if hardware blits can be done
if ( videoInfo.blit_hw <> 0 ) then
flags := flags or SDL_HWACCEL;

SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
// SDL_GL_SetAttribute( SDL_GL_SWAP_CONTROL, 1 ); // Needs SDL version 1.2.10.0 and up!

////////////////////////////////////////////////////////////////////////////////

GameScreen := SDL_SetVideoMode(ScreenWidth, ScreenHeight, 32, flags);[/pascal]

GameScreen is the surface of which resides as my primary screen buffer. (or secondary, depending on how you think about double buffering ) And I've obviously only just added the SDL_GL_SWAP_CONTROL line.