Lazy Foo' Productions  Using SDL with OpenGL 2.1  Last Updated
8/6/12 There's a point where SDL's rendering just isn't enough.
When you need more power, speed, and flexibility, it's time to
move onto OpenGL.  While we won't cover how to use OpenGL here
(I hear there's a tutorial for that) we will cover how to use
SDL to render OpenGL. #include "SDL/SDL.h" #include
"SDL/SDL_opengl.h" First we need to remember to include the SDL
OpenGL header so we can use OpenGL's rendering. bool init() {
//Initialize SDL if( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) {
return false; } //Create Window if( SDL_SetVideoMode(
SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_OPENGL ) == NULL )
{ return false; } //Initialize OpenGL if( initGL() == false ) {
return false; } //Set caption SDL_WM_SetCaption( "OpenGL Test",
NULL ); return true; } Here is our init() function.  First we
initialize SDL as we always do. Then we create our OpenGL window
with an OpenGL context. When we want to use OpenGL we pass the
SDL_OPENGL flag to SDL_SetVideoMod