Thursday, 23 August 2012

SDL2.0 to create a modern OpenGL context.

I've been having difficulty finding documentation for SDL2.0 so I'm going to record the invocations here as I find them... (With thanks to everyone who's helped me find them)

Once I've got a better (and full) handle on it I might try to right a well written tutorial... For now I'll just record my findings.

Requesting a given version of OpenGL


This appears to disable the compatibility profile/enable the core profile only. I need to check this though.

Creating an OpenGL context...

int width = 640; int height = 480;
SDL_Window* pWindow;
SDL_GLContext context;
int other_flags = 0;

pWindow = SDL_CreateWindow("Title", 
width, height, 

context = SDL_GL_CreateContext(pWindow);

Verifying that the Context was created successfully...

const unsigned char* version = glGetString(GL_VERSION);
if (version == NULL) {
// Failed to initialise, error logging here

Flushing pipeline...


Todo: Figure out how to compile/link a shader.

No comments:

Post a Comment