From a914c2bcabfd0e9023713be2b4f3b3675da08071 Mon Sep 17 00:00:00 2001 From: gered Date: Sat, 17 Aug 2013 23:49:23 -0400 Subject: [PATCH] add support for selecting an OpenGL context version via the SDL configuration object --- Blarg.GameFramework.SDL2/SDLApplication.cs | 2 ++ Blarg.GameFramework.SDL2/SDLConfiguration.cs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/Blarg.GameFramework.SDL2/SDLApplication.cs b/Blarg.GameFramework.SDL2/SDLApplication.cs index 6cb52dd..e058207 100644 --- a/Blarg.GameFramework.SDL2/SDLApplication.cs +++ b/Blarg.GameFramework.SDL2/SDLApplication.cs @@ -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); diff --git a/Blarg.GameFramework.SDL2/SDLConfiguration.cs b/Blarg.GameFramework.SDL2/SDLConfiguration.cs index 412dac5..5c1f787 100644 --- a/Blarg.GameFramework.SDL2/SDLConfiguration.cs +++ b/Blarg.GameFramework.SDL2/SDLConfiguration.cs @@ -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;