From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

OpenGL Build Options

I have added the following options to the build system (only CMake at this time actually). Each option is meant to be cumulative, that is, each one adds a new option to Blender. No checking is done to see if any particular combination will work, so you simply have to build Blender to see if it works.

The options let you use a modified version of GLEW that is needed to support ES, choose how to initialize OpenGL, and determine which profiles can be used. On Windows it is also possible to link with the ANGLE implementation of OpenGL ES 2.0 based on Direct3D.

Obviously, if one enables initializing ES contexts then one also needs to enable ES profiles. However, the different options are not cleanly parallel, so at this time contexts and profiles are enabled separately.

Note: If I was doing Blender from scratch today I'd start with implementing Blender on top of ES 2.0 and EGL, then add OpenGL Core on extended CGL/XGL/WGL.

Experimental GLEW

WITH_GLEW_ES

This option is intended to be temporary. Enabling it cases Blender to build with a modified version of GLEW that contains support for OpenGL ES. Hopefully the new version of GLEW will replace the one in Blender and also be accepted upstream into the GLEW project.

ON will use the extern/glew-es directory while OFF will use the extern/glew directory.

No effect if WITH_SYSTEM_GLEW is selected.

Defaults to OFF

System Library

The system library is what creates OpenGL contexts and fundamentally determines what functionality can be accessed. There are basically three ways to initialize OpenGL.

WITH_GL_SYSTEM_LEGACY

Enabling this option means to allow Blender to use unextended system libraries (AGL/CGL/WGL/XGL) to initialize OpenGL contexts. The unextended libraries only allow access to pre 3.1 OpenGL functionality. (However, certain functionality like multisampling, which already uses extensions to initialize will still work.)

This should be deprecated because there is no need to maintain two different initialization paths, although I can imagine keeping support for a platform that does not have an alternative.

Defaults to ON

WITH_GL_SYSTEM_DESKTOP

Enabling this option means to use a platforms extended system library (AGL/CGL/WGL/XGL) to initialize OpenGL contexts. With extensions these libraries are capable of initializing OpenGL 3.1+ contexts and choosing between different profiles (core/compatibility/es). Each platform is associated with only one particular library (although OS X has Carbon and Cocoa platforms, so there are two platforms on one OS...).

This should be the default for desktop systems, but only after it is has been thoroughly tested.

Defaults to OFF

WITH_GL_SYSTEM_EMBEDDED

Enabling this option means to use the EGL library to initialize OpenGL contexts. This can be enabled by itself (without desktop or legacy) in order to target embedded systems and to test ES drawing on desktop systems (useful for development). Also, this could be enabled along with desktop and legacy to allow a single Blender build to support both backends (also potentially useful for development).

It will probably be tedious to get both ANGLE and the system OpenGL working in the same build of Blender, so enabling multiple system libraries is not a priority on Windows, but it may work well enough on other systems.

Defaults to OFF

Profiles

Profiles determine which subset of OpenGL are initialized and if code that requires them are even compiled.

WITH_GL_PROFILE_COMPATIBILITY

If the legacy system is used to create a context then using the compatibility profile means to enable deprecated functionality. If the legacy interface is available then this should not fail.

If the desktop system is used to create a context then this means to check for the availability of the compatibility profile and use that if it is available. This can fail if using a driver that does not provide the compatibility extension.

This option has no meaning if the embedded system (EGL) is used to create a context. Although OpenGL ES 1 has similar functionality to deprecated/compatibility OpenGL, no effort has been made to limit compatibility to OpenGL ES 1 (more like OpenGL 2.1).

Defaults to ON

WITH_GL_PROFILE_CORE

If the legacy system is used then this has no meaning. There is no way to create a core context using the legacy interface.

If the desktop system is used then a context using the core profile is initialized and used. This allows the application to use features of OpenGL 3.1 and greater. If the compatibility profile is enabled, but not core, then Blender would be in the odd position of using an OpenGL 3 or 4 context but not using any new functionality because it was removed at compile time.

This option has no meaning if the embedded system (EGL) is used to create a context. Although there is overlap between OpenGL ES 2.0 and OpenGL 3.1 core functionality, no effort is made at this level to pretend they are the same.

Defaults to OFF

WITH_GL_PROFILE_ES20

If the legacy system is used then this has no meaning. There is no way to create an es context using the legacy interface.

If the desktop system is used then a context using the es20 profile is initialized and used. This allows a desktop version of Blender to use OpenGL ES 2.0 without also having to link with an EGL library. (Currently this seems to only be supported by AMD cards.)

This is the only option that has meaning the embedded system (EGL) is used to create a context. Other versions of ES could be supported in the future though.

Defaults to OFF

ANGLE

ANGLE is an implementation of OpenGL ES 2.0 implemented for Windows based on Direct3D. It is maintained by Google for use in Chrome to provide support for OpenGL and WebGL.

I'll provide a link to a pre-built copy of ANGLE at some point. This should be temporary until it can be added to the lib directory.

WITH_ANGLE

Enables linking with ANGLE instead of the system OpenGL. It would probably be tedious to support both ANGLE and opengl32.dll in the same executable, so enabling ANGLE means that non-ES options won't work anymore.

Defaults to OFF

ANGLE_LIBRARY

Until I get ANGLE into the lib directory, this is the path to the library file containing ANGLE.

ANGLE_INCLUDE_PATH

Until I get ANGLE into the lib directory, this is the path to the include directory containing ANGLE's header files.