Features » Extra Functionality

The fol­low­ing lib­rar­ies provide ad­di­tion­al func­tion­al­ity on top of core Mag­num APIs. They com­ple­ment each oth­er for a well-bal­anced ex­per­i­ence, how­ever none of them are strictly re­quired and it’s pos­sible to use any sub­set that matches your par­tic­u­lar use case.

Plu­gin man­age­ment

Used ex­tens­ively by vari­ous oth­er parts of Mag­num, provides a way to ex­tend func­tion­al­ity at runtime, im­ple­ment hot code re­load­ing or al­ter be­ha­vi­or of already de­ployed ap­plic­a­tions without need­ing to modi­fy the bin­ar­ies them­selves.

  • Plu­gin man­ager hand­ling de­pend­en­cies, in­her­it­ance and ali­ases through the same API on all plat­forms
  • Ver­sion­ing plu­gin API and ABI for grace­ful hand­ling of runtime er­rors
  • Both dy­nam­ic­ally and stat­ic­ally loaded plu­gins

Sig­nals and slots

In­spired by Qt’s sig­nals and slots API, provides an easy-to-use design pat­tern to con­nect listen­ers to events. Macro-less syn­tax us­ing C++11 vari­ad­ic tem­plates, with full type safety and no need for any pre­pro­cessor.

  • Light­weight im­ple­ment­a­tion with fo­cus on de­bug per­form­ance and trans­par­ency
  • Sig­nals are mem­ber func­tions, slots can be mem­bers, free func­tions or lambdas
  • Abil­ity to equip third-party classes with sig­nal/slot func­tion­al­ity us­ing mul­tiple in­her­it­ance

Test­ing and bench­mark­ing

Bor­row­ing ini­tial ideas from Qt’s QTest, gives the user a clear API for cre­at­ing auto­mated unit tests, in­teg­ra­tion tests and bench­marks with min­im­al use of mac­ros and no opaque ma­gic be­hind the scenes.

  • Fo­cus on clar­ity of test out­put and dia­gnostics with col­ors, pretty print­ers and rich com­mand-line op­tions for test white/black­list­ing, re­peat­ing and shuff­ling
  • Equi­val­ent work­flow on desktop, iOS/An­droid and web plat­forms, mak­ing auto­mated test­ing a no-brain­er
  • Ex­tens­ible with com­par­at­ors for spe­cial data types, bench­mark­ing of cus­tom meas­ured data

An­im­a­tion frame­work

Layered ar­chi­tec­ture ex­pos­ing everything from dir­ect value in­ter­pol­a­tion over key­frame struc­tures up to high-level an­im­a­tion-driv­en be­ha­vi­or and play­back dir­ectly from loaded scene data.

  • De­faults to easy-to-use high-level APIs but al­lows for fine-tun­ing of all para­met­ers in­clud­ing in­ter­pol­at­or func­tions and ex­tra­pol­a­tion be­ha­vi­or
  • De­signed for cache-ef­fi­cient memory ac­cess
  • Abil­ity to use dif­fer­ent types for an­im­a­tion in­put and out­put (for spline in­ter­pol­a­tion or on-the-fly key­frame data de­com­pres­sion)
  • Abil­ity to use dif­fer­ent glob­al time type and an­im­a­tion track time type

OpenGL wrap­ping lay­er

Ab­stracts away plat­form dif­fer­ences and ex­ten­sions, res­ult­ing in a single API cov­er­ing desktop OpenGL, OpenGL ES and WebGL. De­pend­ing on the GPU driver, the backend se­lects the most suit­able fea­ture im­ple­ment­a­tion, giv­ing pri­or­ity to re­cent ex­ten­sions.

  • OpenGL 2.1 to 4.6, OpenGL ES 2.0, 3.0–3.2, WebGL 1 / 2 + ex­ten­sions
  • DSA-like API with state track­ing, elim­in­a­tion of re­dund­ant GL calls, fea­ture emu­la­tion on older drivers
  • Can co-ex­ist with oth­er ren­der­ers shar­ing the same OpenGL con­text, ex­change live OpenGL ob­jects with third-party code

Vulkan wrap­ping lay­er

In pro­gress. Sub­scribe to mosra/mag­num#234 for up­dates.

  • Con­ver­sion between Mag­num format enums and Vulkan equi­val­ents for easi­er as­set man­age­ment
  • In­teg­ra­tion of Vulkan math types

Plat­form in­teg­ra­tion

Wraps plat­form-spe­cif­ic or gen­er­ic win­dow­ing toolkits in a thin lay­er to provide con­sist­ent ac­cess to OpenGL con­text and in­put events across vari­ous sys­tems, util­it­ies for plat­form cap­ab­il­ity in­tro­spec­tion.

  • In­teg­rates SDL2, GLFW, Xlib, An­droid nat­ive activ­it­ies and more
  • Ab­strac­tion lay­er to provide OpenGL con­text to com­mand-line tools in a cross-plat­form way
  • Com­pletely opt-in lay­er, you can in­stead hook Mag­num dir­ectly in­to your own win­dow, con­text and event hand­ling

Mesh, tex­ture and shader tools

Col­lec­tion of es­sen­tial mesh, tex­ture and im­age al­gorithms. Simple in­put/out­put func­tions work­ing on plain data types for easy in­teg­ra­tion in­to ex­ist­ing pipelines.

  • Mesh op­tim­iz­a­tion, in­dexed mesh hand­ling, ver­tex trans­form­a­tions, nor­mal, sub­di­vi­sion al­gorithms and at­trib­ute (de)in­ter­leav­ing
  • Tex­ture at­las pack­ing
  • Dis­tance field cal­cu­la­tion, avail­able also through a com­mand-line util­ity

Shader tools are com­ing soon. Sub­scribe to mosra/mag­num#234 for up­dates.

As­set man­age­ment

Defines data types and in­ter­faces for im­port of gen­er­ic scene formats and hand­ling of un­com­pressed and com­pressed im­ages.

  • Scene hier­archy, mesh data, ma­ter­i­al, cam­era, light and tex­ture prop­er­ties
  • Com­mand-line util­ity for im­age con­ver­sion, com­pres­sion and de­com­pres­sion
  • Not re­quired to be used when im­ple­ment­ing your own as­set load­ing, provides just a ready-to-use API for the gen­er­al case

De­bug­ging and pro­to­typ­ing

Go-to tool­box for when you are play­ing around, ex­plor­ing new tech­niques, pro­to­typ­ing a game, de­bug­ging a glitch or meas­ur­ing your app per­form­ance.

  • Set of built­in prim­it­ives for place­hold­er ob­jects, ma­ter­i­al test­ing or de­bug wire­frames
  • Shaders to give your ob­ject a ba­sic look or to visu­al­ize par­tic­u­lar mesh prop­er­ties
  • Pro­fil­ing, visu­al­iz­a­tion and auto­mat­ic test­ing aids

Scene graph func­tion­al­ity

Ar­ranges scene data in a tree with auto­mat­ic ob­ject life­time man­age­ment, trans­form­a­tion in­her­it­ance and abil­ity to at­tach any num­ber of fea­tures to scene ob­jects.

  • Choice of dif­fer­ent trans­form­a­tion im­ple­ment­a­tions de­pend­ing on de­sired flex­ib­il­ity and speed/ac­cur­acy tradeoff
  • Cam­era ob­ject im­ple­ment­a­tion with con­veni­ent hand­ling of pro­jec­tion and cam­era matrices

Text and UI

GPU-centered text ren­der­ing us­ing a pre-pop­u­lated glyph cache tex­ture with abil­ity to use ar­bit­rary third-party text lay­outers for kern­ing and oth­er ad­vanced text shap­ing and lay­out­ing sup­port.

  • Ren­der­ing from either pixel-per­fect or dis­tance field glyph cache
  • Ex­per­i­ment­al UI lib­rary fo­cused on ef­fi­cient ren­der­ing, min­im­al foot­print and fast it­er­a­tion times
  • La­bel, but­ton, in­put wid­gets, mod­al­ity sup­port


Wraps Open­AL in a fash­ion sim­il­ar to the OpenGL wrap­ping lay­er; defines data types and in­ter­faces for au­dio data im­port.

  • Full sup­port of stock Open­AL 1.1 API with vari­ous ex­ten­sions
  • Play­er and listen­er ob­jects for scene graph in­teg­ra­tion
  • Com­mand-line util­ity for plat­form cap­ab­il­ity in­tro­spec­tion

In­teg­ra­tion lib­rar­ies

Con­veni­ence util­it­ies, wrap­per types, data con­ver­sion and in­ter­faces that im­prove in­ter­op­er­ab­il­ity with third-party lib­rar­ies.

  • Par­tial or full API wrap­ping de­pend­ing on what’s needed for seam­less in­teg­ra­tion of giv­en lib­rary
  • Bul­let Phys­ics math type con­ver­sion, de­bug ren­der­er im­ple­ment­a­tion and scene graph in­teg­ra­tion
  • DART Dy­nam­ics An­im­a­tion and Ro­bot­ics Toolkit math type con­ver­sion and ren­der­er for DART worlds
  • Oculus SDK math type con­ver­sion and wrap­per classes for full Oculus VR sup­port in Mag­num
  • Ei­gen math lib­rary in­teg­ra­tion with con­ver­sion for all types
  • GLM math lib­rary in­teg­ra­tion with con­ver­sion for all types and de­bug out­put
  • Dear ImGui in­teg­ra­tion with Mag­num-backed ren­der­er and HiDPI sup­port