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 SDL_SetVideoMode
, however that has since been droped source. So how do you create a window for rendering 3D OpenGL 3.0+ with SDL 2.0? (with a programmable pipeline of course)
My first gess was SDL_CreatWindow
then SDL_GetWindowSurface
then SDL_CreateRenderer
as the code below:
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);
However, the documentation on SDL_GetWindowSurface
says that it cannot be used for "3D or the rendering API on this window" source.
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?