title: How to create and initialize a SDL 2.0 window to support 3D rendering with OpenGL 3.0+?
body: <p>I am fairly new to SDL and I am trying to only use version 2.0. I believe that in previouse versions of SDL (1.2 and 1.3) creating a window was done with <code>SDL_SetVideoMode</code>, however that has since been droped <a href="http://wiki.libsdl.org/moin.fcg/MigrationGuide#Screen.28s.29" rel="nofollow">source</a>. So how do you create a window for rendering 3D OpenGL 3.0+ with SDL 2.0? (with a programmable pipeline of course)</p>
  
  <p>My first gess was <code>SDL_CreatWindow</code> then <code>SDL_GetWindowSurface</code> then <code>SDL_CreateRenderer</code> as the code below:</p>
  
  <pre><code>    SDL_Window*   window   = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);
      SDL_Surface*  s        = SDL_GetWindowSurface(window);
      SDL_Renderer* renderer = SDL_CreateRenderer(window,  -1, flags);
      SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
  </code></pre>
  
  <p>However, the documentation on <code>SDL_GetWindowSurface</code> says that it cannot be used for "3D or the rendering API on this window" <a href="http://wiki.libsdl.org/moin.fcg/SDL_GetWindowSurface#Remarks" rel="nofollow">source</a>.</p>
  
  <p>Is there some other way to render 3D OpenGL 3.0+ in SDL 2.0, or should I just use SDL 1.2 because SDL 2.0 is only in Release Candidate status?</p>