globjects 1.0.0 released

CG Internals released globjects version 1.0.0. globjects is a cross-platform, object-oriented open source library for the OpenGL API. It facilitates a modern, less cluttered, and less error-prone use of the OpenGL API: e.g., it reduces the amount of OpenGL code required for rendering and facilitates coherent OpenGL use by means of a type-safe abstraction layer based on glbinding and OpenGL Mathematics (GLM). Common rendering processes are automated and missing features of specific OpenGL drivers are partially simulated or emulated at run-time.

what-is-globjects

OpenGL uses the concept of states (e.g., point size, rasterization state) and objects (e.g., textures and shaders) by design. Since OpenGL is a C API, objects are referenced classically using handles. globjects replaces these handles with classes for each object and exposes their associated OpenGL functions and provides additional tools for convenience. For example, a globjects texture encapsulates OpenGL texture creation, initialization, modification, and deletion, as well as a default texture setup.

The following code snippet shows an exemplary use of the OpenGL API:

auto program = glCreateProgram();
auto vertexShader = glCreateShader(GL_VERTEX_SHADER);
auto fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);

glShaderSource(vertexShader, 1, &vertexShaderSource, nullptr);
glShaderSource(fragmentShader, 1, &fragmentShaderSource, nullptr);

glCompileShader(vertexShader);
glCompileShader(fragmentShader);

glAttachShader(program, vertexShader);
glAttachShader(program, fragmentShader);

glLinkProgram(program);

glUseProgram(program);
glUniform2f(glGetUniformLocation(program, "extent"), 1.0f, 0.5f);

Using globjects, the example can be reduced to the following code:

auto program = new globjects::Program();

program->attach(
  globjects::Shader::fromString(GL_VERTEX_SHADER, vertexShaderSource), 
  globjects::Shader::fromString(GL_FRAGMENT_SHADER, fragmentShaderSource));

program->setUniform("extent", glm::vec2(1.0f, 0.5f)));

globjects can be used in rendering frameworks and engines as a rendering API wrapper for ease of use. Furthermore, it is well suited for learning OpenGL and its concepts as it communicates modern OpenGL (and automatically uses fallback implementations within unified interfaces).

globjects is well documented and available as Windows installer, Homebrew package, and Ubuntu PPA package. The full list of its features is available on GitHub.


Press Release created by Willy Scheibel, 18. November 2016.