add support for selecting an OpenGL context version via the SDL configuration object

This commit is contained in:
Gered 2013-08-17 23:49:23 -04:00
parent 9ecc28e61b
commit a914c2bcab
2 changed files with 6 additions and 0 deletions

View file

@ -427,6 +427,8 @@ namespace Blarg.GameFramework
throw new InvalidOperationException("Cannot create an OpenGL context without an existing window.");
// minimum requirements
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, config.glMajorVersion);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, config.glMinorVersion);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DOUBLEBUFFER, config.glDoubleBuffer ? 1 : 0);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_DEPTH_SIZE, config.glDepthBufferSize);
SDL.SDL_GL_SetAttribute(SDL.SDL_GLattr.SDL_GL_RED_SIZE, config.glRedSize);

View file

@ -10,6 +10,8 @@ namespace Blarg.GameFramework
public bool Fullscreen;
public bool Resizeable;
public int glMajorVersion;
public int glMinorVersion;
public bool glDoubleBuffer;
public int glDepthBufferSize;
public int glRedSize;
@ -24,6 +26,8 @@ namespace Blarg.GameFramework
Height = 480;
Fullscreen = false;
Resizeable = false;
glMajorVersion = 2;
glMinorVersion = 1;
glDoubleBuffer = true;
glDepthBufferSize = 24;
glRedSize = 8;