From 1aa0a80de7f0afeb044098637216a80752e4ab07 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 24 Apr 2018 16:22:13 +0100 Subject: [PATCH] Added OSG_GL_CONTEXT_STRING cmake variable to set include/osg/GL headers that sets Traits::glContextVersion. --- CMakeLists.txt | 4 ++++ src/osg/DisplaySettings.cpp | 2 +- src/osg/GL.in | 1 + src/osg/GraphicsContext.cpp | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3006fa5c..91718422c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -556,9 +556,13 @@ ELSE() OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON) ENDIF() +SET(OSG_GL_CONTEXT_STRING "1.0" CACHE STRING "GL Context String to pass when creaing graphics contexts") # Map the OSG_GL*_AVAILABLE settings to OpenGL header settings IF (OSG_GL3_AVAILABLE) + + SET(OSG_GL_CONTEXT_STRING "3.3") + IF (APPLE) SET(OPENGL_HEADER1 "#include " CACHE STRING "#include<> line for OpenGL Header") SET(OPENGL_HEADER2 "#include " CACHE STRING "#include<> line for additional OpenGL Headers if required") diff --git a/src/osg/DisplaySettings.cpp b/src/osg/DisplaySettings.cpp index 1fd685b33..7aa9964c1 100644 --- a/src/osg/DisplaySettings.cpp +++ b/src/osg/DisplaySettings.cpp @@ -240,7 +240,7 @@ void DisplaySettings::setDefaults() _implicitBufferAttachmentRenderMask = DEFAULT_IMPLICIT_BUFFER_ATTACHMENT; _implicitBufferAttachmentResolveMask = DEFAULT_IMPLICIT_BUFFER_ATTACHMENT; - _glContextVersion = "1.0"; + _glContextVersion = OSG_GL_CONTEXT_STRING; _glContextFlags = 0; _glContextProfileMask = 0; diff --git a/src/osg/GL.in b/src/osg/GL.in index 89c6bace4..ac4a97fe6 100644 --- a/src/osg/GL.in +++ b/src/osg/GL.in @@ -39,6 +39,7 @@ #define OSG_GLES1_FEATURES @OSG_GLES1_FEATURES@ #define OSG_GLES2_FEATURES @OSG_GLES2_FEATURES@ #define OSG_GLES3_FEATURES @OSG_GLES3_FEATURES@ +#define OSG_GL_CONTEXT_STRING "@OSG_GL_CONTEXT_STRING@" #ifndef WIN32 diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index e73ec3e6a..409790f29 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -239,7 +239,7 @@ GraphicsContext::Traits::Traits(DisplaySettings* ds): swapBarrier(0), useMultiThreadedOpenGLEngine(false), useCursor(true), - glContextVersion("1.0"), + glContextVersion(OSG_GL_CONTEXT_STRING), glContextFlags(0), glContextProfileMask(0), sharedContext(0),