Experimental rewrite of OGLplus with the latest C++ features and a different design.
C++ CMake Python GLSL Makefile XSLT
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config Updated the run_test utility script Feb 28, 2017
example Added example requirement files Feb 17, 2017
implement Added biteset + minor changes in bindump Feb 18, 2017
test Added memcheck test for any_iterator Feb 28, 2017
third_party Updated to a newer version of GSL Feb 20, 2017
.gitignore Multiple changes Aug 5, 2016
.ycm_extra_conf.py Minor update in the YouCompleteMe script Aug 8, 2016
VERSION Started release-0.9.0 Feb 19, 2017



Author: Matúš Chochlík <chochlik@gmail.com>


OGLplus2 is an experimental wrapper for modern OpenGL, using latest C++ features and a different design and naming conventions than OGLplus. OGLplus2 is in a very early stage of development. Several examples showing the usage of OGLplus can be found in the example/ directory and its subdirectories.


A compiler supporting C++14, a python interpreter and the GLEW and GLFW libraries are required. Currently the only compiler known to work is clang++-3.6.0. Support for other libraries with similar functionality will be added in the future.

On Linux distributions with the apt package manager, the following should be enough to install most of the dependencies for the GLFW+GLEW configuration:

sudo apt-get install python cmake clang-3.6 libglew-dev libglfw-dev

For other configurations using SDL, wxWidgets, GLUT, etc. you need to install the appropriate packages (the names vary wildly between distrubutions or even between versions of the same distribution so they are not listed here).

The GSL library is also required; the third_party/GSL directory contains a git submodule which should be updated before building OGLplus2.


OGLplus2 uses a CMake-based build/configuration system. The library itself is header-only, which means that applications using it do not need to link to a compiled library, but need just to include the header files.

The build system handles several important tasks:

  • Detects if the necessary things are installed and makes a site-configuration header file
  • Detects the support for C++14 features and builds configuration headers
  • Builds several additional, automatically generated headers mostly for compiler deficiency workarounds.
  • Installs all header files to a directory specified by the install prefix
  • Configures and builds the example executables.
  • Configures the test suite.

User-friendly configuration script

The configure.py or oglplus-config scripts provide a more user-friendly way to invoke cmake and to specify additional parameters for the configuration process.

Some of the more important command-line options are described below:

--help Display the help screen.
--prefix PATH Specifies the installation prefix path for cmake (sets the value of the CMAKE_INSTALL_PREFIX variable). If this option is not specified, cmake's default prefix is used.
--include-dir PATH
 Specify additional directiories to search when looking for header files. It may be used multiple times to specify multiple directories. Headers are searched in the directories specified with this option in the same order in which they appear on the command-line and the default system header locations are searched only afterwards. The first header found is used, in case there are multiple versions of the searched header file.
--library-dir PATH
 Specify additional directiories to search when looking for compiled libraries. It may beused multiple times to specify multiple directories. Libraries are searched in the directories specified with this option in the same order in which they appear on the command-line and the default system library locations are searched afterwards. The first library found is used, in case there are multiple versions of the searched library.

See the --help option for the full description and detailed info on the usage of these scripts. Bash users can also do source config/configure.bash_complete to install a bash completion extension that allows to TAB-complete the command line arguments for the oglplus-config configuration script that invokes configure.py.

To configure and build the examples invoke oglplus-config in the following way:

./oglplus-config --build

Why rebooting OGLplus?

After several years of work on the original OGLplus library and after using it in multiple different applications, some issues were identified. OGLplus2 tries to address these issues:

  • Original OGLplus uses a naming convention which tries to match OpenGLs naming. This does not look very good when combined with other code using the naming conventions more typical for C++. OGLplus2 uses a more C++-ish naming convention similar to the one used by the standard library.
  • The enumeration types in the original OGLplus are rather verbose and require the library user to learn a lot of new names invented by OGLplus. In OGLplus2 the enumerations are still type-safe, but the enumeration values are directly based on the OpenGL constants. This allows for example to use gl.enable(GL.depth_test) instead of gl.Enable(Capability::DepthTest), or gl.begin(GL.triangles) instead of gl.Begin(CompatibilityPrimitiveType::Triangles), etc.
  • In OGLplus most of the functions eagerly throw an exception immediately after a GL error is detected. In OGLplus2 the GL-wrapping functions return an object which either handles the error by default in its destructor or this behavior can be overriden by specifying a user-defined error handler or even cancelled on per-call basis as necessary.
  • The original OGLplus defines several abstractions which diverge from the OpenGL 'programming model', which may be misleading in some cases. OGLplus2 tries to stay closer to how things are done in OpenGL.
  • OGLplus2 provides a more fine-grained control over GL object lifetime.
  • Some parts of OGLplus (for example the object naming registry, the limited value checkers, etc.) don't work very well in applications using multiple GL contexts.
  • In order to ensure backward compatiblity OGLplus source code is full of various workarounds which makes it rather messy. By using modern C++ many features can be implemented in a more straithtforward way without using lots of C++-feature-related #ifdefs.
  • The OALplus and EGLplus reuse some code defined in the original OGLplus. Here the common code like vectors, matrices, the framework for wrapping OpenGL or OpenAL objects, code related to error handling, etc. is implemented in the low-level eagine library and then reused by OGLplus and in the future by OALplus, EGLplus, possibly OVGplus, etc.
  • In OGLplus 'testing' was mostly done by trying out the various features in the examples. OGLplus2 brings a more comprehensive and more thorough testing suite.



Copyright Matus Chochlik, 2015. Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at