Learn by example to get quickly up to speed.
The examples assume that you have at least basic knowledge about graphics (what are homogeneous coordinates, what is mesh, vertex, texture...), how GPU APIs work (what are buffers, what is depth test for...) and basics of GLSL (attributes, uniforms, vertex/fragment shaders...). Deep knowledge of OpenGL / Vulkan APIs themselves is not required, as Magnum wraps most of the functionality in its own classes.
Full source code for all examples is available in the GitHub repository, see Downloading and building examples for more information. The ports branch contains additional patches for mobile and web platform support that aren't present in
master in order to keep the example code as simple as possible.
The following examples explain the basic principles and have fully documented tutorials:
Basic rendering with builtin shaders.
Importing mesh data, 3D transformations and input handling.
Importing image data, texturing and custom shaders.
Scene graph, resource management and model importing.
Shows how to use Magnum with custom platform integration APIs.
Shows how to use custom renderers with Magnum.
The following consist of documented source code only:
Basic real-time area lights.
Shows how to play spatialized audio with Magnum.
2D fluid simulation using the APIC method.
SPH fluid simulation with a dynamic boundary.
Simple iterative CPU ray tracing.
Loose octree for accelerating collision detection.
Intuitive camera control with smooth navigation.
Advanced depth-aware mouse interaction for navigating a scene.
Playing back an animated GIF. On the GPU or in a terminal.
Accumulates multiple frames together to create a motion blur effect.
Demonstrates usage of cube map textures and texture blending.
Showcases the Parallel Split / Cascade shadow mapping technique.
Usage of multiple framebuffer attachments to implement object picking.
Showcase of Magnum distance-field text rendering.
Directly using Vulkan with hand-written SPIR-V to produce a triangle offscreen.
Basic WebXR application.
There are also examples for the Corrade library itself.
While Magnum itself and its documentation is licensed under the MIT/Expat license, all example code is put into public domain (or UNLICENSE) to free you from any legal obstacles when reusing the code in your apps:
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http:/