add support for selecting an OpenGL context version via the SDL configuration object
This commit is contained in:
parent
9ecc28e61b
commit
a914c2bcab
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Reference in a new issue