Last active
February 15, 2020 13:45
-
-
Save gwaldron/a56b0e77e7fa8587b698717d21f9366d to your computer and use it in GitHub Desktop.
Building OSG and osgEarth in GL CORE profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here are the steps for building OSG in the OpenGL CORE Profile | |
once you have configured CMake as usual. | |
1. Download the GL CORE include folder from Khronos: | |
https://www.khronos.org/registry/OpenGL/api/GL/ | |
2. Put it in a folder somewhere. You can put it in a folder called glcore, or | |
you can make a "GL" folder in the include folder of the OSG repository and | |
put it there. | |
3. In CMake, set the OPENGL_PROFILE property to GLCORE. | |
4. Set the GLCORE_GLCOREARB_HEADER property to the location of your | |
new "GL" folder containing the CORE ARB include files. For example if your | |
include file is at "C:/devel/glcore/GL/glcorearb.h", set this variable to | |
C:/devel/glcore. | |
5. Set the following variables ON: | |
OSG_GL3_AVAILABLE | |
6. Set the following variables OFF: | |
OSG_GL1_AVAILABLE | |
OSG_GL2_AVAILABLE | |
OSG_GLES1_AVAILABLE | |
OSG_GLES2_AVAILABLE | |
OSG_GL_DISPLAYLISTS_AVAILABLE | |
OSG_GL_FIXED_FUNCTION_AVAILABLE | |
OSG_GL_MATRICES_AVAILABLE | |
OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE | |
OSG_GL_VERTEX_FUNCS_AVAILABLE | |
7. Configure and build OSG. | |
8. If you are building osgEarth, set the same GLCORE_GLCOREARB_HEADER | |
variable as you did for OSG (to the folder containing your "GL" | |
directory). Configure and build osgEarth. | |
9. Run "osgearth_version --caps" to test. You should see osgEarth report | |
Core Profile = yes | |
If you don't, try setting your envvar OSG_GL_CONTEXT_VERSION=3.3 | |
(or whichever version you want to use) | |
If you want to disable the CORE profile, set the environment variable | |
OSG_GL_CONTEXT_PROFILE_MASK to 2. This requests a compatibility mode | |
context. | |
Enjoy! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shortcut for new osg build:
git clone https://github.com/openscenegraph/OpenSceneGraph.git
cd OpenSceneGraph
mkdir build
cd build
cmake .. -G "Visual Studio 15 2017 Win64"
-DCMAKE_BUILD_TYPE=Release
-DWIN32_USE_MP=ON
-DOSG_GL3_AVAILABLE=ON
-DOPENGL_PROFILE="GLCORE"
-DGLCORE_ROOT=c:\path_to\glarb\
Setting profile to GLCORE will execute the cmake setup for GL3 which includes turning off all the variables in #6. I submitted a PR to fix the context version because right now it still needs to be set to 3.3 but cmake should set it to 3.3 when OSG_GL3_AVAILABLE is set to ON.
And for vcpkg builds, also include -DCMAKE_TOOLCHAIN_FILE=[vcpkg root]\scripts\buildsystems\vcpkg.cmake