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 OpenGL works (what are buffers, what is depth test for...) and basics of GLSL (attributes, uniforms, vertex/fragment shaders...). Deep knowledge of OpenGL API itself is not required, as Magnum wraps 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:
- Your first triangle live web demo — Basic rendering with builtin shaders.
- Primitives live web demo — Importing mesh data, 3D transformations and input handling.
- Textured triangle live web demo — Importing image data, texturing and custom shaders.
- Model viewer live web demo — Scene graph, resource manager and model importing.
- Triangle using plain GLFW — Shows how to use Magnum with custom platform integration APIs.
- Triangle using sokol_
gfx — Shows how to use custom renderers with Magnum.
The following consist of documented source code only:
- Area lights live web demo — Basic real-time area lights.
- Audio live web demo — Shows how to play spatialized audio with Magnum.
- Bullet Physics live web demo — Integration of Bullet Physics into Magnum.
- Cube map — Demonstrates usage of cube map textures and texture blending.
- Leap Motion — Integration of the LeapMotion SDK into Magnum.
- Motion blur — Accumulates multiple frames together to create a motion blur effect.
- Oculus VR — Integration of the Oculus SDK into Magnum.
- Object picking live web demo — Usage of multiple framebuffer attachments to implement object picking.
- Shadow map — Showcases the Parallel Split / Cascade shadow mapping technique.
- Text rendering live web demo — Showcase of Magnum distance-field text rendering.
- WebVR live web demo — Basic WebVR 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:/