Create an OpenGL context with OpenSceneGraph? Mac?

I am having trouble compiling C # version 140 or higher GLSL shaders. Ideally I would like to compile the GLSL shaders that are #version 410. I believe OSG should create an OpenGL context for this, which is 4.1, but all I've tried to create is a (very old!) 2.1 context, Please help!

  • I am using OpenSceneGraph 3.3.3.

  • I'm working on a Macbook Air 11 "(2013) with Mac OS X 10.10.3. From Apple's website , downloading the OpenGL Extensions Viewer and writing the benchmark in raw OpenGL, I'm pretty sure my machine supports OpenGL 4.1.

  • I tried to compile and run osgsimplegl3 . Although it compiles, it does not run successfully because it cannot have its own shaders, which are labeled #version 330. This is confirmed by the fact that when I print the OpenGL version while the program is running (after I did not compile the shaders), it prints as OpenGL 2.1.

  • I've tried setting CMake flags. I'm a bit new to CMake, but I tried to add this to my CMakeLists.txt at the top level.

    SET (OSG_GL3_AVAILABLE ON) SET (OSG_GL1_AVAILABLE OFF) SET (OSG_GL2_AVAILABLE OFF) SET (OSG_GLES1_AVAILABLE OFF) SET (OSG_GLES2_AVAILABLE OFF) SET (OSG_GL_DISPLAYLISTS_AVAILABLE OFF) SET (OSG_GL_FIXED_FUNCTION_AVAILABLE OFF) SET (OSG_GL_MATRICES_AVAILABLE OFF) SET (OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE OFF) SET (OSG_GL_VERTEX_FUNCS_AVAILABLE OFF)

I have also tried the cmake command as such.

cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug \
-D OSG_GL3_AVAILABLE:BOOL=1 \
-D OSG_GL1_AVAILABLE:BOOL=0 \
-D OSG_GL2_AVAILABLE:BOOL=0 \
-D OSG_GLES1_AVAILABLE:BOOL=0 \
-D OSG_GLES2_AVAILABLE:BOOL=0 \
-D OSG_GL_DISPLAYLISTS_AVAILABLE:BOOL=0 \
-D OSG_GL_FIXED_FUNCTION_AVAILABLE:BOOL=0 \
-D OSG_GL_MATRICES_AVAILABLE:BOOL=0 \
-D OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE:BOOL=0 \
-D OSG_GL_VERTEX_FUNCS_AVAILABLE:BOOL=0 \
.. "$@"

      

  • I dug up the source to find the - gl-version flag in osg / src / DisplaySettings.cpp on line 754 . I tried to run my program (which is / osgsimplegl 3 examples) with -gl version 4.1. While the line I am told is indeed 4.1, the actual version that is being used is 2.1 and my shaders are still not compiled.

Now I am at my end. Upon final investigation, it appears that the OpenGLContext is created in osg / src / osgViewer / GraphicsWindowCocoa.mm at line 1219 , but t seems to be taking glContextVersion into account in the GraphicsContext :: Traits object . I don't see anywhere in the code where glContextVersion is used other than osg / src / osgViewer / GraphicsWindowWin32.cpp .

How do I create an OpenGL 4.1 context with OpenSceneGraph on a Mac?

+3


source to share





All Articles