May 2015 updates to Magnum
The Magnum C++11/C++14 and OpenGL graphics engine gained OpenGEX format support, a bunch of new importer plugins, cross-platform extension loader, transform feedback support and new features from OpenGL ES 3.1 and OpenGL 4.5, among other things. » pernament link
The new release comes almost a whole year after the previous one, mainly due to the fact that I'm currently full-time employed and I have less free time than I expected. Nevertheless the project accumulated quite a lot of changes over the year, so this changelog may be a bit overwhelming. I plan to do one smaller release in a few months to polish and clean up some more things and then I'll probably start breaking stuff in never-before-seen ways to make Vulkan support a reality.
The May 2015 snapshot is available under snapshot-2015-05 tag in Corrade, Magnum, Magnum Plugins, Magnum Integration and Magnum Examples GitHub repositories. This article will describe the most important changes, for all the commits that went to master branches since the June 2014 snapshot (tagged snapshot-2014-06) see logs in Corrade, Magnum, Magnum Plugins and Magnum Integration, respectively.
For compatibility branch there is tag snapshot-2015-05-compatibility in Corrade, Magnum, Magnum Plugins and Magnum Examples repositories.
Plugin aliases, smart importers and new format support
In an ongoing attempt to make the engine useful even without a slew of external library dependencies, I added a bunch of dependency-less plugins for loading common scene and image formats (see the changelog below for a complete list). I had a firsthand experience about how crazy hard it is to get working Freetype, HarfBuzz or even libPNG binary for Windows, so there are more plugins planned (especially for dependency-less font handling), stay tuned.
In addition to this, the plugin loader now supports aliases. It means that, to load PNG images, for example, you no longer need to worry about which particular plugin might be available on given platform and just always request PngImporter plugin:
PluginManager::Manager<Trade::AbstractImporter> manager{MAGNUM_PLUGINS_IMPORTER_DIR}; std::unique_ptr<Trade::AbstractImporter> importer = manager.loadAndInstantiate("PngImporter"); // ...
Now, if the PngImporter plugin is not available, it tries to load any other plugin that aliases with PngImporter. Currently it might be for example StbImageImporter, in future releases possibly also Sdl2ImageImporter or WebGlImageImporter.
Lastly, there are now smart image and scene loaders, named AnyImageImporter and AnySceneImporter. They try to detect file type from filename and then redirect the operation to dedicated importer plugin (so if you load image.tga, for example, it tries to load it with TgaImporter, if you load texture.png, it tries to load it with PngImporter etc.). In combination with plugin aliases this makes a fairly powerful importer framework.
Initial OpenDDL/OpenGEX support
Possibly the biggest new importer plugin is the OpenGEX format importer. If you haven't heard about it yet, it is a fairly new 3D scene file format based on the cleanly designed OpenDDL language. It aims to be a better alternative to the bloated XML-based COLLADA format and currently there are exporters from 3Ds Max, Maya and Blender.
Current OpenGEX importer implementation in Magnum covers the same feature set as the ColladaImporter plugin, but with faster and more robust implementation and hopefully with less bugs and uncovered corner cases. The future of the COLLADA importer is uncertain and it will probably be deprecated in favor of the new OpenGEX importer, because COLLADA support in 3D modelling software is far from ideal and the XML parser is hell to implement.
The underlying OpenDDL parser that powers the plugin is currently only a private part of the plugin, but if it is seen to be useful outside of the plugin, I may move it into a publicly usable library. Here's an example how OpenDDL file parsing can look like:
OpenDdl::Document d; /* Parse the document */ if(!d.parse(data, OpenGex::structures, OpenGex::properties)) { // ... } /* Validate its structure */ if(!d.validate(OpenGex::rootStructures, OpenGex::structureInfo)) { // ... } /* Parse all meshes */ for(OpenDdl::Structure geometryObject: d.childrenOf(OpenGex::GeometryObject)) { /* Decide about primitive */ if(std::optional<OpenDdl::Property> primitive = geometryObject.findPropertyOf(OpenGex::primitive)) { auto&& str = primitive->as<std::string>(); if(str == "triangles") { // ... } else if(str == "lines") { // ... } // ... } else { // default primitive ... } /* Parse vertex array */ OpenDdl::Structure vertexArray = geometryObject.firstChildOf(OpenGex::VertexArray); auto&& attrib = vertexArray.propertyOf(OpenGex::attrib).as<std::string>(); if(attrib == "position") { // ... } else if(attrib == "normal") { // ... } /* Parse vertex array data */ Containers::ArrayReference<const Float> vertexData = vertexArray.firstChild().asArray<Float>(); // ... }
The Viewer example was also updated to support loading OpenGEX files and it is now also available online through Emscripten.

New extension loader, extension loading for OpenGL ES
I was being more and more dissatisfied with the state of glLoadGen (which was originally mean to replace the even worse GLEW) and switched to flextGL. If you don't know it yet, it is very flexible and customizable extension loader generator and consists of just a single very clean Python file. Switching to it resulted in much shorter generated code (which means faster build times) and after a few minor changes I managed to add OpenGL ES support to it. So it is now finally possible to use extensions on both desktop GL and OpenGL ES. The only platforms which don't have any notion of traditional extension loading are WebGL and NaCl, on which the extension handling is not yet fully implemented.
OpenGL 4.5, OpenGL ES 3.1 support
In August 2014, OpenGL 4.5 was released, which was understood as some sort of a cleanup release with no radically new functionality. The most essential addition is ARB_direct_state_acccess, which finally cleans up some rough corners of the old EXT_direct_state_access extension and puts it in the core specification. Magnum currently implements both extensions and prefers the ARB one. Some API changes were needed to accomodate to the new design, mainly in construction of query objects and cube map texture data uploads. The other minor features include ability to query only a part of texture image, inverted conditional rendering etc., see below for complete list.
Thanks to the new extension loader it was also finally possible to implement OpenGL ES 3.1 support. Unlike the ES 2.0/3.0 switch, there is no compile-time option to enable OpenGL ES 3.1, the library is compiled for both 3.0 and 3.1 and the new features are enabled based on version reported by the driver.
IRC channel
In addition to all other communication channels there is now a IRC channel: join the discussion at #magnum-engine on Freenode.
Corrade
New features
- Support for plugin aliases in PluginManager library.
- Range-based-for support in Containers::LinkedList.
- Added convenience PluginManager::Manager::loadAndInstantiate() function.
- Added Containers::*Array::slice() and friends.
- Added Utility::String::beginsWith() and Utility::String::endsWith().
Changes
- TestSuite::Compare::Container is now able to compare non-copyable containers such as Containers::ArrayReference (see GitHub Pull Request 9).
- Using const char instead of const unsigned char for raw binary data.
- Better algorithm for comparing floating-point values in TestSuite.
Build system
- CMake now always installs FindCorrade.cmake to library-specific location, making it usable without providing own copy of the file in depending projects. The WITH_FIND_MODULE option is no longer needed.
- Displaying all header files, plugin metadata files and resource files in project view to make use of some IDEs less painful (such as QtCreator).
- Gentoo ebuild (see GitHub Pull Request #16).
Bug fixes
- Removed static initializers to avoid memory corruption in static builds (see GitHub Issue #90).
- Plugin manager now correctly folows dependency order when unloading plugins.
Deprecated APIs
No API was deprecated in this release.
Removed APIs and features
- Removed unused plugin replacement feature, as it had questionable benefits and no real use.
- All functionality deprecated in January 2014 snapshot has been removed, namely:
- Removed deprecated ability to use relative includes (e.g. #include <Utility/Debug.h>), use absolute paths (#include <Corrade/Utility/Debug.h>) instead.
- Removed deprecated Utility::String::split() overload, use either split() or splitWithoutEmptyParts() instead.
Magnum
New features
- Proper extension loading for OpenGL ES 2.0, 3.0 and 3.1 using flextGL.
- Enabled already implemented functionality on OpenGL ES 3.1.
- Support for new OpenGL functionality:
- Support for ARB_direct_state_acccess (OpenGL 4.5) everywhere except in Mesh.
- Support for ARB_conditional_render_inverted (OpenGL 4.5) in SampleQuery.
- Support for ARB_get_texture_sub_image (OpenGL 4.5) in *Texture::subImage().
- Support for EXT_transform_feedback, ARB_transform_feedback2 (OpenGL 3.0, 4.0, OpenGL ES 3.0) in new TransformFeedback class, added Renderer::Feature::RasterizerDiscard.
- Support for ARB_robustness_isolation in Renderer::graphicsResetStatus().
- Support for ARB_framebuffer_sRGB (OpenGL 3.0) in Renderer::Feature::FramebufferSRGB.
- Support for OES_texture_npot ES extension.
- Support for debug groups from KHR_debug (OpenGL 4.5) and EXT_debug_marker extensions in DebugGroup class.
- Added CubeMapTexture::*image() that returns all six faces together.
- Added Primitives::Cube::solidStrip().
- Added AbstractShaderProgram::attachShaders() as a list-based complement to Shader::compile() and AbstractShaderProgram::link().
- Separated Renderer::setFeature() into shorter Renderer::enable() and Renderer::disable().
- Added tau(), piHalf(), e(), nan() and inf() to Math::Constants.
- Added Math::Matrix[34]::shearing*().
- Added Math::Matrix4::lookAt() (see GitHub Pull Request #88).
- Added Math::Vector::pad().
- Added Math::div().
- Using range-based-for to traverse object children and features in SceneGraph and screens in Platform::ScreenedApplication.
- Convenience overload for *Framebuffer::read() and *Texture::image() that returns the queried image by value instead of as parameter.
- Added Buffer::uniformOffsetAlignment() and Mesh::maxElementIndex() limit queries.
- Added AbstractTexture::unbind() for unbinding range of texture units.
- Added SceneGraph::AbstractObject::addFeature() and SceneGraph::Object::addChild() functions (see GitHub Issue #86).
- VSync support in Platform::Sdl2Application.
- Added Platform::*Context libraries for users which want to use custom windowing toolkits instead of the ones provided.
- Improved documentation about Shaders namespace, added sample image for each.

Changes
- Using flextGL instead of glLoadGen for OpenGL extension loading.
- Platform::Sdl2Application now tries to create core context on all platforms, not just OSX (see GitHub Issue #80).
- Buffer::bind(), Buffer::unbind() and Buffer::Target is now used for indexed buffer binding only.
- Moved static binary operations from Math classes into free functions for more convenient usage (see GitHub Issue #74).
- Better algorithm for comparing floating-point values.
- Ensuring that all OpenGL objects are properly created before using them.
- Using const char instead of const unsigned char for raw binary data.
- Removed annoying restriction when adding reference-counted resources to ResourceManager.
- Extension querying cleanup:
- Removed APPLE_flush_buffer_range extension.
- Replaced APPLE_vertex_array_object with ARB_vertex_array_object.
- Replaced NV_half_float with ARB_half_float_vertex.
- Replaced EXT_framebuffer_sRGB with ARB_framebuffer_sRGB.
- Documentation cleanup, fixes and improvements.
Build system
- CMake now always installs FindMagnum.cmake to library-specific location, making it usable without providing own copy of the file in depending projects. The WITH_FIND_MODULE option is no longer needed.
- CMake now handles inter-library dependencies automatically without manually specifying each and every one (see GitHub Issue #73).
- Ability to control static build of plugins separately using BUILD_PLUSING_STATIC.
- Displaying all header files, plugin metadata files and resource files in project view to make use of some IDEs less painful (such as QtCreator).
- Gentoo ebuild (see GitHub Pull Request #69).
Bug fixes
- Fixed TextureTools::distanceField() to work in GLSL < 4.20 (see GitHub Issue #62).
- Fixed Shaders::MeshVisualizer to work in GLSL ES.
- Fixed Shaders::*Vector on Intel GPUs.
- Fixed assertion on contexts without default framebuffer (see GitHub Issue #93).
- Fixed cases where shader would use extension that is not advertised by the driver.
- Properly handle case where glVertexArrayVertexAttribDivisorEXT is not available in the driver (see GitHub Pull Request #77).
- Removed superfluous level argument from Framebuffer::attachTexture*() overloads for texture types that don't support mipmapping.
- Proper no-op fallback for *Framebuffer::invalidate() on platforms where the extensions is not supported.
- Fixed garbage characters in shader compilation output (see GitHub Pull Request #87).
- Fixed memory corruption on MSVC 2013 (see GitHub Issue #70).
- Fixed potential memory corruption errors with static build (see GitHub Issue #79).
- Fixed aspect-ratio-corrected projection with inverted Y in SceneGraph::Camera*D.
- Fixed wheel direction in Platform::Sdl2Application (see GitHub Pull Request #69).
- Fixed matrix to quaternion conversion algorithm.
Deprecated APIs
- The Magnum/Query.h header is deprecated, use one of Magnum/PrimitiveQuery.h, Magnum/SampleQuery.h or Magnum/TimerQuery.h instead.
- Using Buffer::Target as constructor or Buffer::setTargetHint() parameter is deprecated, use Buffer::TargetHint instead.
- The SceneGraph::TransformationType enum is depracted, use separate <transform>() and <transform>Local() variants instead.
- SceneGraph::AbstractObject::hasFeatures(), firstFeature(), lastFeature(), SceneGraph::Object::hasChildren(), firstChild() and lastChild() are deprecated, use methods on linked list returned by SceneGraph::AbstractObject::features() and SceneGraph::Object::children() instead.
- Platform::ScreenedApplication::frontScreen() and Platform::ScreenedApplication::backScreen() are deprecated, use methods on linked list returned by Platform::ScreenedApplication::screens() instead.
- *Framebuffer::read() functions taking two vectors are deprecated, use overload taking Range2Di instead.
- The Mesh::maxVertexAttributes() function is deprecated, use AbstractShaderProgram::maxVertexAttributes() instead.
- Math::Vector::dot(), Math::Complex::dot(), Math::Quaternion::dot(), Math::Vector::angle(), Math::Complex::angle(), Math::Quaternion::angle(), Math::Quaternion::lerp(), Math::Quaternion::slerp(), Math::Vector2::cross() and Math::Vector3::cross() are deprecated, use Math::dot(), Math::angle(), Math::lerp(), Math::slerp() and Math::cross() instead.
- The *Framebuffer::bind(FramebufferTarget) function is deprecated, use parameter-less *Framebuffer::bind() instead.
- The FramebufferTarget::ReadDraw enum value is deprecated, use separate FramebufferTarget::Read and FramebufferTarget::Draw values instead.
- CubeMapTexture::imageSize() with explicit face parameter is deprecated, use overload that returns one value for all faces instead.
- The Magnum/DebugMessage.h header is deprecated, use Magnum/DebugOutput.h instead.
- The DebugMessage::Severity enum is deprecated, use DebugOutput::Severity instead.
- The DebugMessage::Callback typedef, DebugMessage::setCallback() and DebugMessage::setDefaultCallback() function is deprecated, use DebugOutput::Callback, DebugOutput::setCallback() and DebugOutput::setDefaultCallback() instead.
- The DebugMessage::maxLoggedMessages() and DebugMessage::maxMessageLength() functions are deprecated, use DebugOutput::maxLoggedMessages() and DebugOutput::maxMessageLength() instead.
- The DebugMessage::setEnabled() function and related values from DebugMessage::Source enum are deprecated, use DebugOutput::setEnabled() along with DebugOutput::Source, DebugOutput::Type and DebugOutput::Severity instead.
- Parameter-less *Query constructor and parametrized *Query::begin() function are deprecated, use constructor with parameter and parameter-less *Query::begin() instead.
Removed APIs and functionality
- All functionality deprecated in January 2014 snapshot has been removed, namely:
- Removed deprecated ability to use relative includes (e.g. #include <Mesh.h>), use absolute paths (#include <Magnum/Mesh.h>) instead.
- Removed deprecated Mesh::Primitive enum, use MeshPrimitive instead.
- Removed deprecated Sampler::maxAnisotropy() function, use Sampler::maxMaxAnisotropy() instead.
- Removed deprecated Math::Geometry::Rectangle class, use Math::Range instead.
- Removed deprecated SceneGraph::Animable::group() function, use SceneGraph::Animable::animables() instead.
- Removed deprecated Shaders/magnumShadersResourceImport.hpp file, use Shaders/resourceImport.hpp instead.
- Removed deprecated Text::TextRenderer alias, use Text::Renderer instead.
- Removed long-deprecated BufferImage::setData() overload, use the other one instead.
Performance improvements
- Faster vector multiplication in Math::Quaternion.
- Saved one swizzle in Math::cross().
- Allocation-free overloads of functions that took std::string just to pass its contents to OpenGL.
Magnum Plugins
New features
- New OpenDDL parser and OpenGexImporter plugin for importing OpenGEX files.
- New StanfordImporter plugin for importing Stanford (*.ply) files.
- New StbImageImporter plugin for importing BMP, GIF, HDR, JPEG, PIC, PNG, PSD, TGA and more formats using stb_image.
- New StbPngImageConverter plugin for exporting PNG files using stb_image_write.
- New AnyImageImporter plugin that detects image file type and delegates the loading to plugin dedicated for given format (see GitHub Issue #61).
- New AnySceneImporter plugin that detects scene file type and delegates the loading to plugin dedicated for given format.
- Plugin aliases, as explained above.
Removed APIs and functionality
- All functionality deprecated in January 2014 snapshot has been removed, namely removed deprecated ability to use relative includes (e.g. #include <PngImporter/PngImporter.h>), use absolute paths (#include <MagnumPlugins/PngImporter/PngImporter.h>) instead.
Build system
- CMake now always installs FindMagnumPlugins.cmake to library-specific location, making it usable without providing own copy of the file in depending projects. The WITH_FIND_MODULE option is no longer needed.
- Displaying all header files, plugin metadata files and resource files in project view to make use of some IDEs less painful (such as QtCreator).
- Gentoo ebuild (see GitHub Pull Request #5).
Magnum Integration
Build system
- CMake now always installs FindMagnumIntegration.cmake to library-specific location, making it usable without providing own copy of the file in depending projects. The WITH_FIND_MODULE option is no longer needed.
- Displaying all header files, plugin metadata files and resource files in project view to make use of some IDEs less painful (such as QtCreator).
- Gentoo ebuild (see GitHub Pull Request #2).
Removed APIs and functionality
- All functionality deprecated in January 2014 snapshot has been removed, namely removed deprecated ability to use relative includes (e.g. #include <BulletIntegration/Integration.h>), use absolute paths (#include <Magnum/BulletIntegration/Integration.h>) instead.
Deprecated APIs
No API was deprecated in this release.
Removed APIs
No deprecated API was removed in this release.
Magnum Examples
Changes
- Reworked and simplified the Viewer example, updated it to work with virtually any file format.
Bug fixes
- Removed unneeded requirement for ARB_invalidate_subdata from cubemap example (see GitHub Issue #63).
Build system
- All examples are now installable in a way similar to Magnum itself.
- Displaying all header files, plugin metadata files and resource files in project view to make use of some IDEs less painful (such as QtCreator).
- Added ArchLinux, Debian and Gentoo packages (see GitHub Pull Request #8).
Magnum Bootstrap
No user-visible changes in this release, except for updates of CMake modules.
June updates to Magnum
The Magnum C++11 and OpenGL/OpenGL ES/WebGL graphics engine gained experimental Android support, windowless applications on OS X and Windows, uses SDL2 as the default toolkit, adds new texture and mesh features, improves build system and got huge documentation review. » pernament link
How to draw a red square in Magnum — in one statement
After reading the "How to draw a red square in Qt Quick" blog post showcasing the simplicity of Qt API I thought it would be interesting to try something similar in Magnum for comparison. » pernament link
02/14/2014
Happy Valentine's Day... » pernament link
January updates to Magnum
Since the previous October snapshot Magnum gained Visual Studio port, font conversion utility, improved text rendering along with example application, support for OpenGL debug output, documentation updates, better test coverage and many more usability improvements and fixes. » pernament link
Reducing C++ compilation time in Magnum: code optimizations
Large C++ projects often suffer with very long times for both full and incremental compilation, severely hurting productivity. The following series will overview some techniques employed in Magnum to make iteration times smaller, this article focuses on code-based optimizations. » pernament link
October updates to Magnum
Summary of changes during the first two months after public release. Two new ports, usability improvements, OpenGL limit queries and introduction of API deprecation. » pernament link
Static and dynamic polymorphism in Magnum
Thanks to generic programming and other features exclusive to C++ it is possible to handle polymorphism the most effective way for each use case. As a result, virtual calls are in Magnum used very sparingly. » pernament link
C++11 features in Magnum: Simplifying daily workflow
While the previous part was focused on C++11 features improving performance, here I will describe features which are used just to simplify your life by writing more concise code with less mistakes. » pernament link
C++11 features in Magnum: Better memory management
Regardless to what language you use, you always need to think about memory management. Garbage collectors might give you a sense that it's done automagically, but to get more performance you need to have control over heap usage in code running at 60 FPS. C++11 helps to avoid many heap allocations without sacrificing usability. » pernament link


