Browse Source

Merge pull request #1 from mosra/master

1
pull/183/head
MiUishadow 10 years ago
parent
commit
8bc77969c8
  1. 92
      CMakeLists.txt
  2. 2
      CONTRIBUTING.md
  3. 2
      COPYING
  4. 3
      CREDITS.md
  5. 5
      Doxyfile
  6. 3
      README.md
  7. 2
      doc/best-practices.dox
  8. 76
      doc/building.dox
  9. 58
      doc/cmake.dox
  10. 2
      doc/coding-style.dox
  11. 2
      doc/compilation-speedup.dox
  12. 4
      doc/debug-tools.dox
  13. 2
      doc/features.dox
  14. 25
      doc/generated/CMakeLists.txt
  15. 2
      doc/generated/configure.h.cmake
  16. 2
      doc/generated/hello.cpp
  17. 2
      doc/generated/shaders.cpp
  18. 13
      doc/getting-started.dox
  19. 6
      doc/mainpage.dox
  20. 53
      doc/matrix-vector.dox
  21. 2
      doc/method-chaining.dox
  22. 92
      doc/namespaces.dox
  23. 2
      doc/openal-support.dox
  24. 2
      doc/openal.dox
  25. 23
      doc/opengl-mapping.dox
  26. 27
      doc/opengl-support.dox
  27. 2
      doc/opengl-wrapping.dox
  28. 2
      doc/opengl.dox
  29. 32
      doc/platform.dox
  30. 4
      doc/plugins.dox
  31. 8
      doc/portability.dox
  32. 2
      doc/scenegraph.dox
  33. 2
      doc/shaders.dox
  34. 2
      doc/shapes.dox
  35. 2
      doc/tips.dox
  36. 2
      doc/transformations.dox
  37. 2
      doc/troubleshooting.dox
  38. 10
      doc/types.dox
  39. 2
      doc/utilities.dox
  40. 2
      modules/CMakeLists.txt
  41. 521
      modules/FindCorrade.cmake
  42. 45
      modules/FindEGL.cmake
  43. 67
      modules/FindGLFW.cmake
  44. 969
      modules/FindMagnum.cmake
  45. 15
      modules/FindNodeJs.cmake
  46. 58
      modules/FindOpenGLES2.cmake
  47. 51
      modules/FindOpenGLES3.cmake
  48. 70
      modules/FindSDL2.cmake
  49. 2
      modules/MagnumConfig.cmake
  50. 5
      package/archlinux/PKGBUILD
  51. 1
      package/archlinux/PKGBUILD-android-arm
  52. 1
      package/archlinux/PKGBUILD-android-x86
  53. 5
      package/archlinux/PKGBUILD-clang
  54. 5
      package/archlinux/PKGBUILD-clang-libc++
  55. 4
      package/archlinux/PKGBUILD-emscripten
  56. 1
      package/archlinux/PKGBUILD-emscripten-webgl2
  57. 2
      package/archlinux/PKGBUILD-es2
  58. 5
      package/archlinux/PKGBUILD-es2desktop
  59. 2
      package/archlinux/PKGBUILD-es3
  60. 5
      package/archlinux/PKGBUILD-es3desktop
  61. 5
      package/archlinux/PKGBUILD-gcc47
  62. 2
      package/archlinux/PKGBUILD-nacl-glibc
  63. 2
      package/archlinux/PKGBUILD-nacl-newlib
  64. 7
      package/archlinux/PKGBUILD-release
  65. 13
      package/ci/appveyor.yml
  66. 24
      package/ci/jenkins-android.xml
  67. 1
      package/ci/jenkins-clang-analyzer.xml
  68. 1
      package/ci/jenkins-clang-sanitizer.xml
  69. 1
      package/ci/jenkins-emscripten.xml
  70. 12
      package/ci/jenkins-gltests.xml
  71. 1
      package/ci/jenkins-nacl.xml
  72. 1
      package/ci/jenkins.xml
  73. 21
      package/ci/travis.yml
  74. 2
      package/debian/changelog
  75. 7
      package/debian/rules
  76. 20
      package/homebrew/magnum.rb
  77. 16
      src/CMakeLists.txt
  78. 51
      src/Magnum/AbstractFramebuffer.cpp
  79. 2
      src/Magnum/AbstractFramebuffer.h
  80. 12
      src/Magnum/AbstractObject.cpp
  81. 2
      src/Magnum/AbstractObject.h
  82. 12
      src/Magnum/AbstractQuery.cpp
  83. 2
      src/Magnum/AbstractQuery.h
  84. 2
      src/Magnum/AbstractResourceLoader.h
  85. 204
      src/Magnum/AbstractShaderProgram.cpp
  86. 230
      src/Magnum/AbstractShaderProgram.h
  87. 360
      src/Magnum/AbstractTexture.cpp
  88. 128
      src/Magnum/AbstractTexture.h
  89. 8
      src/Magnum/Array.h
  90. 2
      src/Magnum/Attribute.cpp
  91. 2
      src/Magnum/Attribute.h
  92. 2
      src/Magnum/Audio/AbstractImporter.cpp
  93. 2
      src/Magnum/Audio/AbstractImporter.h
  94. 2
      src/Magnum/Audio/Audio.cpp
  95. 2
      src/Magnum/Audio/Audio.h
  96. 2
      src/Magnum/Audio/Buffer.cpp
  97. 2
      src/Magnum/Audio/Buffer.h
  98. 13
      src/Magnum/Audio/CMakeLists.txt
  99. 9
      src/Magnum/Audio/Context.cpp
  100. 33
      src/Magnum/Audio/Context.h
  101. Some files were not shown because too many files have changed in this diff Show More

92
CMakeLists.txt

@ -1,7 +1,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -23,18 +23,28 @@
# DEALINGS IN THE SOFTWARE. # DEALINGS IN THE SOFTWARE.
# #
cmake_minimum_required(VERSION 2.8.9) cmake_minimum_required(VERSION 2.8.12)
project(Magnum) project(Magnum)
# Find Corrade first so we can check on the target # CMake policies: enable MACOSX_RPATH by default
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
# Don't treat imported targets with :: as files
if(POLICY CMP0028)
cmake_policy(SET CMP0028 NEW)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")
find_package(Corrade REQUIRED)
# Find Corrade first so we can check on the target
find_package(Corrade REQUIRED PluginManager Utility)
include(CMakeDependentOption) include(CMakeDependentOption)
# If targeting Android, NaCl, Emscripten or Windows RT, set explicit OpenGL ES # If targeting iOS, Android, NaCl, Emscripten or Windows RT, set explicit
# support # OpenGL ES support
if(NOT CORRADE_TARGET_ANDROID AND NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL AND NOT CORRADE_TARGET_WINDOWS_RT) if(NOT CORRADE_TARGET_IOS AND NOT CORRADE_TARGET_ANDROID AND NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL AND NOT CORRADE_TARGET_WINDOWS_RT)
option(TARGET_GLES "Build for OpenGL ES / WebGL" OFF) option(TARGET_GLES "Build for OpenGL ES / WebGL" OFF)
else() else()
set(TARGET_GLES ON) set(TARGET_GLES ON)
@ -42,21 +52,43 @@ endif()
cmake_dependent_option(TARGET_GLES2 "Build for OpenGL ES 2 / WebGL 1.0" ON "TARGET_GLES" OFF) cmake_dependent_option(TARGET_GLES2 "Build for OpenGL ES 2 / WebGL 1.0" ON "TARGET_GLES" OFF)
cmake_dependent_option(TARGET_DESKTOP_GLES "Build for OpenGL ES on desktop" OFF "TARGET_GLES" OFF) cmake_dependent_option(TARGET_DESKTOP_GLES "Build for OpenGL ES on desktop" OFF "TARGET_GLES" OFF)
option(TARGET_HEADLESS "Build command-line utilities for use on a headless machines" OFF)
# Magnum Info (currently only using GLX, CGL, WGL/EGL on Windows or on NaCl)
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_NACL OR CORRADE_TARGET_WINDOWS)
option(WITH_MAGNUMINFO "Build magnum-info utility" OFF)
endif()
# Utilities (currently only using GLX, CGL or WGL)
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS)
cmake_dependent_option(WITH_FONTCONVERTER "Build magnum-fontconverter utility" OFF "NOT TARGET_GLES" OFF)
cmake_dependent_option(WITH_DISTANCEFIELDCONVERTER "Build magnum-distancefieldconverter utility" OFF "NOT TARGET_GLES" OFF)
endif()
# Plugins
option(WITH_WAVAUDIOIMPORTER "Build WavAudioImporter plugin" OFF)
option(WITH_MAGNUMFONT "Build MagnumFont plugin" OFF)
cmake_dependent_option(WITH_MAGNUMFONTCONVERTER "Build MagnumFontConverter plugin" OFF "NOT TARGET_GLES" OFF)
option(WITH_OBJIMPORTER "Build ObjImporter plugin" OFF)
cmake_dependent_option(WITH_TGAIMAGECONVERTER "Build TgaImageConverter plugin" OFF "NOT WITH_MAGNUMFONTCONVERTER" ON)
cmake_dependent_option(WITH_TGAIMPORTER "Build TgaImporter plugin" OFF "NOT WITH_MAGNUMFONT" ON)
# Parts of the library # Parts of the library
option(WITH_AUDIO "Build Audio library" OFF) cmake_dependent_option(WITH_AUDIO "Build Audio library" OFF "NOT WITH_WAVAUDIOIMPORTER" ON)
option(WITH_DEBUGTOOLS "Build DebugTools library" ON) option(WITH_DEBUGTOOLS "Build DebugTools library" ON)
cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "NOT WITH_DEBUGTOOLS;NOT WITH_OBJIMPORTER" ON) cmake_dependent_option(WITH_MESHTOOLS "Build MeshTools library" ON "NOT WITH_DEBUGTOOLS;NOT WITH_OBJIMPORTER" ON)
cmake_dependent_option(WITH_PRIMITIVES "Builf Primitives library" ON "NOT WITH_DEBUGTOOLS" ON) cmake_dependent_option(WITH_PRIMITIVES "Builf Primitives library" ON "NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_SCENEGRAPH "Build SceneGraph library" ON "NOT WITH_DEBUGTOOLS;NOT WITH_SHAPES" ON) option(WITH_SHAPES "Build Shapes library" ON)
cmake_dependent_option(WITH_SCENEGRAPH "Build SceneGraph library" ON "NOT WITH_SHAPES" ON)
cmake_dependent_option(WITH_SHADERS "Build Shaders library" ON "NOT WITH_DEBUGTOOLS" ON) cmake_dependent_option(WITH_SHADERS "Build Shaders library" ON "NOT WITH_DEBUGTOOLS" ON)
cmake_dependent_option(WITH_SHAPES "Build Shapes library" ON "NOT WITH_DEBUGTOOLS" ON) cmake_dependent_option(WITH_TEXT "Build Text library" ON "NOT WITH_MAGNUMFONT;NOT WITH_MAGNUMFONTCONVERTER" ON)
option(WITH_TEXT "Build Text library" ON)
cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON) cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON)
# EGL context, available everywhere except on platforms which don't support extension loading # EGL context and windowless EGL application, available everywhere except on
# platforms which don't support extension loading
if(NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL) if(NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL)
option(WITH_EGLCONTEXT "Build EglContext library" OFF) option(WITH_EGLCONTEXT "Build EglContext library" OFF)
option(WITH_WINDOWLESSEGLAPPLICATION "Build WindowlessEglApplication library" OFF)
endif() endif()
# NaCl-specific application libraries # NaCl-specific application libraries
@ -68,6 +100,10 @@ if(CORRADE_TARGET_NACL)
elseif(CORRADE_TARGET_ANDROID) elseif(CORRADE_TARGET_ANDROID)
option(WITH_ANDROIDAPPLICATION "Build AndroidApplication library" OFF) option(WITH_ANDROIDAPPLICATION "Build AndroidApplication library" OFF)
# iOS-specific application libraries
elseif(CORRADE_TARGET_IOS)
option(WITH_WINDOWLESSIOSAPPLICATION "Build WindowlessIosApplication library" OFF)
# OS X-specific application libraries # OS X-specific application libraries
elseif(CORRADE_TARGET_APPLE) elseif(CORRADE_TARGET_APPLE)
cmake_dependent_option(WITH_WINDOWLESSCGLAPPLICATION "Build WindowlessCglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON) cmake_dependent_option(WITH_WINDOWLESSCGLAPPLICATION "Build WindowlessCglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON)
@ -92,29 +128,11 @@ endif()
# Platform-independent (almost) application libraries # Platform-independent (almost) application libraries
if(NOT CORRADE_TARGET_NACL AND NOT CORRADE_TARGET_ANDROID) if(NOT CORRADE_TARGET_NACL AND NOT CORRADE_TARGET_ANDROID)
option(WITH_GLFWAPPLICATION "Build GlfwApplication library")
cmake_dependent_option(WITH_GLUTAPPLICATION "Build GlutApplication library" OFF "NOT TARGET_GLES" OFF) cmake_dependent_option(WITH_GLUTAPPLICATION "Build GlutApplication library" OFF "NOT TARGET_GLES" OFF)
option(WITH_SDL2APPLICATION "Build Sdl2Application library" OFF) option(WITH_SDL2APPLICATION "Build Sdl2Application library" OFF)
endif() endif()
# Magnum Info (currently only using GLX, CGL, WGL/EGL on Windows or on NaCl)
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_NACL OR CORRADE_TARGET_WINDOWS)
option(WITH_MAGNUMINFO "Build magnum-info utility" OFF)
endif()
# Utilities (currently only using GLX, CGL or WGL)
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS)
cmake_dependent_option(WITH_FONTCONVERTER "Build magnum-fontconverter utility" OFF "NOT TARGET_GLES" OFF)
cmake_dependent_option(WITH_DISTANCEFIELDCONVERTER "Build magnum-distancefieldconverter utility" OFF "NOT TARGET_GLES" OFF)
endif()
# Plugins
cmake_dependent_option(WITH_MAGNUMFONT "Build MagnumFont plugin" OFF "WITH_TEXT" OFF)
cmake_dependent_option(WITH_MAGNUMFONTCONVERTER "Build MagnumFontConverter plugin" OFF "NOT MAGNUM_TARGET_GLES;WITH_TEXT" OFF)
option(WITH_OBJIMPORTER "Build ObjImporter plugin" OFF)
cmake_dependent_option(WITH_TGAIMAGECONVERTER "Build TgaImageConverter plugin" OFF "NOT WITH_MAGNUMFONTCONVERTER" ON)
cmake_dependent_option(WITH_TGAIMPORTER "Build TgaImporter plugin" OFF "NOT WITH_MAGNUMFONT" ON)
cmake_dependent_option(WITH_WAVAUDIOIMPORTER "Build WavAudioImporter plugin" OFF "WITH_AUDIO" OFF)
option(BUILD_DEPRECATED "Include deprecated API in the build" ON) option(BUILD_DEPRECATED "Include deprecated API in the build" ON)
if(BUILD_DEPRECATED) if(BUILD_DEPRECATED)
set(MAGNUM_BUILD_DEPRECATED 1) set(MAGNUM_BUILD_DEPRECATED 1)
@ -126,6 +144,7 @@ option(BUILD_PLUGINS_STATIC "Build static plugins (default are dynamic)" OFF)
option(BUILD_TESTS "Build unit tests" OFF) option(BUILD_TESTS "Build unit tests" OFF)
cmake_dependent_option(BUILD_GL_TESTS "Build unit tests for OpenGL code" OFF "BUILD_TESTS" OFF) cmake_dependent_option(BUILD_GL_TESTS "Build unit tests for OpenGL code" OFF "BUILD_TESTS" OFF)
if(BUILD_TESTS) if(BUILD_TESTS)
find_package(Corrade REQUIRED TestSuite)
enable_testing() enable_testing()
endif() endif()
@ -181,9 +200,18 @@ endif()
if(TARGET_DESKTOP_GLES) if(TARGET_DESKTOP_GLES)
set(MAGNUM_TARGET_DESKTOP_GLES 1) set(MAGNUM_TARGET_DESKTOP_GLES 1)
endif() endif()
if(TARGET_HEADLESS)
set(MAGNUM_TARGET_HEADLESS 1)
endif()
if(BUILD_GL_TESTS) if(BUILD_GL_TESTS)
if(CORRADE_TARGET_APPLE) if(MAGNUM_TARGET_HEADLESS)
set(WITH_WINDOWLESSEGLAPPLICATION ON)
set(GL_TEST_LIBRARIES Magnum MagnumWindowlessEglApplication)
elseif(CORRADE_TARGET_IOS)
set(WITH_WINDOWLESSIOSAPPLICATION ON)
set(GL_TEST_LIBRARIES Magnum MagnumWindowlessIosApplication)
elseif(CORRADE_TARGET_APPLE)
set(WITH_WINDOWLESSCGLAPPLICATION ON) set(WITH_WINDOWLESSCGLAPPLICATION ON)
set(GL_TEST_LIBRARIES Magnum MagnumWindowlessCglApplication) set(GL_TEST_LIBRARIES Magnum MagnumWindowlessCglApplication)
elseif(CORRADE_TARGET_UNIX AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)) elseif(CORRADE_TARGET_UNIX AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES))

2
CONTRIBUTING.md

@ -44,7 +44,7 @@ Code contribution
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Copyright © YEAR YOUR_NAME <your@mail.com> Copyright © YEAR YOUR_NAME <your@mail.com>

2
COPYING

@ -1,4 +1,4 @@
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

3
CREDITS.md

@ -32,7 +32,8 @@ Contributors to Magnum library
* [@wivlaro](https://github.com/wivlaro) -- numerous bug reports, Mac OS X * [@wivlaro](https://github.com/wivlaro) -- numerous bug reports, Mac OS X
fixes, feature improvements fixes, feature improvements
* Jonathan Hale ([@Squareys](https://github.com/Squareys)) -- Audio library * Jonathan Hale ([@Squareys](https://github.com/Squareys)) -- Audio library
enhancements, bug reports, documentation improvements enhancements, GlfwApplication implementation, bug reports, documentation
improvements
* Gerhard de Clercq -- Windows RT (Store/Phone) port * Gerhard de Clercq -- Windows RT (Store/Phone) port
Big thanks to everyone involved! Big thanks to everyone involved!

5
Doxyfile

@ -266,7 +266,7 @@ ALIASES = \
"extension{2}=<a href=\"http://www.opengl.org/registry/specs/\1/\2.txt\"><tt>\1_\2</tt></a>" \ "extension{2}=<a href=\"http://www.opengl.org/registry/specs/\1/\2.txt\"><tt>\1_\2</tt></a>" \
"extension2{2}=<a href=\"http://www.opengl.org/registry/specs/\1/\1_\2.txt\"><tt>\1_\2</tt></a>" \ "extension2{2}=<a href=\"http://www.opengl.org/registry/specs/\1/\1_\2.txt\"><tt>\1_\2</tt></a>" \
"extension3{3}=<a href=\"http://www.opengl.org/registry/specs/\1/\3.txt\"><tt>\1_\2</tt></a>" \ "extension3{3}=<a href=\"http://www.opengl.org/registry/specs/\1/\3.txt\"><tt>\1_\2</tt></a>" \
"requires_gles20=@xrefitem requires-gles20 \"Requires OpenGL ES 2.0 / WebGL 1.%\" \"Functionality requiring OpenGL ES 2.0 or WebGL 1.0\"" \ "requires_gles20=@xrefitem requires-gles20 \"Requires OpenGL ES 2.0 / WebGL 1.0\" \"Functionality requiring OpenGL ES 2.0 or WebGL 1.0\"" \
"requires_gles30=@xrefitem requires-gles30 \"Requires OpenGL ES 3.0\" \"Functionality requiring OpenGL ES 3.0\"" \ "requires_gles30=@xrefitem requires-gles30 \"Requires OpenGL ES 3.0\" \"Functionality requiring OpenGL ES 3.0\"" \
"requires_gles31=@xrefitem requires-gles31 \"Requires OpenGL ES 3.1\" \"Functionality requiring OpenGL ES 3.1\"" \ "requires_gles31=@xrefitem requires-gles31 \"Requires OpenGL ES 3.1\" \"Functionality requiring OpenGL ES 3.1\"" \
"requires_es_extension=@xrefitem requires-es-extension \"Requires OpenGL ES extension\" \"Functionality requiring specific OpenGL ES extension\"" \ "requires_es_extension=@xrefitem requires-es-extension \"Requires OpenGL ES extension\" \"Functionality requiring specific OpenGL ES extension\"" \
@ -282,7 +282,8 @@ ALIASES = \
"def_alc{1}=`ALC_\1`" \ "def_alc{1}=`ALC_\1`" \
"requires_al_extension=@xrefitem requires-al-extension \"Requires OpenAL extension\" \"Functionality requiring specific OpenAL extension\"" \ "requires_al_extension=@xrefitem requires-al-extension \"Requires OpenAL extension\" \"Functionality requiring specific OpenAL extension\"" \
"al_extension{2}=<a href=\"http://icculus.org/alextreg/index.php?operation=op_showext&extname=AL_\1_\2\"><tt>AL_\1_\2</tt></a>" \ "al_extension{2}=<a href=\"http://icculus.org/alextreg/index.php?operation=op_showext&extname=AL_\1_\2\"><tt>AL_\1_\2</tt></a>" \
"alc_extension{2}=<a href=\"http://icculus.org/alextreg/index.php?operation=op_showext&extname=ALC_\1_\2\"><tt>ALC_\1_\2</tt></a>" "alc_extension{2}=<a href=\"http://icculus.org/alextreg/index.php?operation=op_showext&extname=ALC_\1_\2\"><tt>ALC_\1_\2</tt></a>" \
"experimental=@note This functionality is still experimental and may change in the future without keeping full backwards compatibility."
# This tag can be used to specify a number of word-keyword mappings (TCL only). # This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class" # A mapping has the form "name=value". For example adding "class=itcl::class"

3
README.md

@ -56,6 +56,7 @@ Platforms:
SDL2 or GLUT toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum) SDL2 or GLUT toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
* **Windows** natively or using ANGLE (through SDL2 or GLUT toolkit) [![Build status](https://ci.appveyor.com/api/projects/status/5b477m034cfaskse/branch/master?svg=true)](https://ci.appveyor.com/project/mosra/magnum/branch/master) * **Windows** natively or using ANGLE (through SDL2 or GLUT toolkit) [![Build status](https://ci.appveyor.com/api/projects/status/5b477m034cfaskse/branch/master?svg=true)](https://ci.appveyor.com/project/mosra/magnum/branch/master)
* **OS X** (through SDL2 toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum) * **OS X** (through SDL2 toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
* **iOS** (through SDL2 toolkit)
* **Android** 2.3 (API Level 9) and higher * **Android** 2.3 (API Level 9) and higher
* **Windows RT** (Store/Phone) using ANGLE (through SDL2 toolkit) * **Windows RT** (Store/Phone) using ANGLE (through SDL2 toolkit)
* **Google Chrome** (through [Native Client](https://developers.google.com/native-client/), * **Google Chrome** (through [Native Client](https://developers.google.com/native-client/),
@ -93,7 +94,7 @@ Minimal dependencies
On Windows you can also use **MinGW-w64**. GCC 4.6, 4.5, 4.4 and MSVC 2013 On Windows you can also use **MinGW-w64**. GCC 4.6, 4.5, 4.4 and MSVC 2013
support involves some ugly workarounds and thus is available only in support involves some ugly workarounds and thus is available only in
`compatibility` branch. `compatibility` branch.
* **CMake** >= 2.8.9 * **CMake** >= 2.8.12
* **Corrade** - Plugin management and utility library. You can get it at * **Corrade** - Plugin management and utility library. You can get it at
https://github.com/mosra/corrade. https://github.com/mosra/corrade.

2
doc/best-practices.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

76
doc/building.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -37,7 +37,7 @@ Minimal set of tools and libraries required for building is:
On Windows you can also use **MinGW-w64**. GCC 4.6, 4.5, 4.4 and MSVC 2013 On Windows you can also use **MinGW-w64**. GCC 4.6, 4.5, 4.4 and MSVC 2013
support involves some ugly workarounds and thus is available only in support involves some ugly workarounds and thus is available only in
`compatibility` branch. `compatibility` branch.
- **CMake** >= 2.8.9 - **CMake** >= 2.8.12
- **Corrade** - Plugin management and utility library. See - **Corrade** - Plugin management and utility library. See
@ref building-corrade "Corrade download and installation guide" for more @ref building-corrade "Corrade download and installation guide" for more
information. information.
@ -162,11 +162,16 @@ By default the engine is built for desktop OpenGL. Using `TARGET_*` CMake
parameters you can target other platforms. Note that some features are parameters you can target other platforms. Note that some features are
available for desktop OpenGL only, see @ref requires-gl. available for desktop OpenGL only, see @ref requires-gl.
- `TARGET_GLES` - Target OpenGL ES. - `TARGET_GLES` -- Target OpenGL ES.
- `TARGET_GLES2` - Target OpenGL ES 2.0. Currently enabled by default when - `TARGET_GLES2` -- Target OpenGL ES 2.0. Currently enabled by default when
`TARGET_GLES` is set. `TARGET_GLES` is set.
- `TARGET_DESKTOP_GLES` - Target OpenGL ES on desktop, i.e. use OpenGL ES - `TARGET_DESKTOP_GLES` -- Target OpenGL ES on desktop, i.e. use OpenGL ES
emulation in desktop OpenGL library. Might not be supported in all drivers. emulation in desktop OpenGL library. Might not be supported in all drivers.
- `TARGET_HEADLESS` -- Build command-line utilities for use on a headless
machine. Basically it means that EGL with no display attachment is being
used everywhere instead of platform-specific toolkits like CGL, GLX or WGL.
Supported mainly on OpenGL ES drivers, for desktop OpenGL the only driver
that supports this configuration is NVidia >= 355.
The features used can be conveniently detected in depending projects both in The features used can be conveniently detected in depending projects both in
CMake and C++ sources, see @ref cmake and @ref Magnum/Magnum.h for more CMake and C++ sources, see @ref cmake and @ref Magnum/Magnum.h for more
@ -201,13 +206,16 @@ need at least one). Choose the one which suits your requirements and your
platform best: platform best:
- `WITH_ANDROIDAPPLICATION` - @ref Platform::AndroidApplication "AndroidApplication" - `WITH_ANDROIDAPPLICATION` - @ref Platform::AndroidApplication "AndroidApplication"
- `WITH_GLFWAPPLICATION` - @ref Platform::GlfwApplication "GlfwApplication"
- `WITH_GLUTAPPLICATION` - @ref Platform::GlutApplication "GlutApplication" - `WITH_GLUTAPPLICATION` - @ref Platform::GlutApplication "GlutApplication"
- `WITH_GLXAPPLICATION` - @ref Platform::GlxApplication "GlxApplication" - `WITH_GLXAPPLICATION` - @ref Platform::GlxApplication "GlxApplication"
- `WITH_NACLAPPLICATION` - @ref Platform::NaClApplication "NaClApplication" - `WITH_NACLAPPLICATION` - @ref Platform::NaClApplication "NaClApplication"
- `WITH_SDL2APPLICATION` - @ref Platform::Sdl2Application "Sdl2Application" - `WITH_SDL2APPLICATION` - @ref Platform::Sdl2Application "Sdl2Application"
- `WITH_XEGLAPPLICATION` - @ref Platform::XEglApplication "XEglApplication" - `WITH_XEGLAPPLICATION` - @ref Platform::XEglApplication "XEglApplication"
- `WITH_WINDOWLESSCGLAPPLICATION` - @ref Platform::WindowlessCglApplication "WindowlessCglApplication" - `WITH_WINDOWLESSCGLAPPLICATION` - @ref Platform::WindowlessCglApplication "WindowlessCglApplication"
- `WITH_WINDOWLESSEGLAPPLICATION` - @ref Platform::WindowlessEglApplication "WindowlessEglApplication"
- `WITH_WINDOWLESSGLXAPPLICATION` - @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication" - `WITH_WINDOWLESSGLXAPPLICATION` - @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication"
- `WITH_WINDOWLESSIOSAPPLICATION` - @ref Platform::WindowlessIosApplication "WindowlessIosApplication"
- `WITH_WINDOWLESSNACLAPPLICATION` - @ref Platform::WindowlessNaClApplication "WindowlessNaClApplication" - `WITH_WINDOWLESSNACLAPPLICATION` - @ref Platform::WindowlessNaClApplication "WindowlessNaClApplication"
- `WITH_WINDOWLESSWGLAPPLICATION` - @ref Platform::WindowlessWglApplication "WindowlessWglApplication" - `WITH_WINDOWLESSWGLAPPLICATION` - @ref Platform::WindowlessWglApplication "WindowlessWglApplication"
- `WITH_WINDOWLESSWINDOWSEGLAPPLICATION` - @ref Platform::WindowlessWindowsEglApplication "WindowlessWindowsEglApplication" - `WITH_WINDOWLESSWINDOWSEGLAPPLICATION` - @ref Platform::WindowlessWindowsEglApplication "WindowlessWindowsEglApplication"
@ -330,6 +338,13 @@ This will compile binary and development packages, which will then appear in
parent directory. If you need to modify CMake flags (enabling/disabling some parent directory. If you need to modify CMake flags (enabling/disabling some
features, for example), modify the last entry in `debian/rules`. features, for example), modify the last entry in `debian/rules`.
@subsection building-packages-brew Homebrew formulas
OS X Homebrew formulas are in `package/homebrew` directory. Either use the
`*.rb` files directly or use the tap at https://github.com/mosra/homebrew-magnum:
brew install --HEAD mosra/magnum/magnum
@section building-windows-angle Building for ANGLE on Windows @section building-windows-angle Building for ANGLE on Windows
Magnum is able to run on ANGLE OpenGL-to-D3D translator. Download the code from Magnum is able to run on ANGLE OpenGL-to-D3D translator. Download the code from
@ -362,6 +377,10 @@ contents in `toolchains/` subdirectory.
git submodule init git submodule init
git submodule update git submodule update
Note that CMake for some reason treats `CMAKE_PREFIX_PATH` and
`CMAKE_INSTALL_PREFIX` differently while crosscompiling and you may need to set
also `CMAKE_FIND_ROOT_PATH` to make it able to find the dependencies.
@subsection building-cross-winrt Crosscompiling for Windows RT @subsection building-cross-winrt Crosscompiling for Windows RT
As said above, you need native build of `corrade-rc` executable. The below As said above, you need native build of `corrade-rc` executable. The below
@ -444,7 +463,6 @@ in `CMAKE_PREFIX_PATH`.
mkdir build-nacl-x86-32 && cd build-nacl-x86-32 mkdir build-nacl-x86-32 && cd build-nacl-x86-32
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="/absolute/path/to/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/NaCl-newlib-x86-32.cmake" \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/NaCl-newlib-x86-32.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr/nacl \ -DCMAKE_PREFIX_PATH=/usr/nacl \
@ -455,7 +473,6 @@ in `CMAKE_PREFIX_PATH`.
mkdir build-nacl-x86-64 && cd build-nacl-x86-64 mkdir build-nacl-x86-64 && cd build-nacl-x86-64
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="/absolute/path/to/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/NaCl-newlib-x86-64.cmake" \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/NaCl-newlib-x86-64.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr/nacl \ -DCMAKE_PREFIX_PATH=/usr/nacl \
@ -494,7 +511,6 @@ equivalent) by disabling `TARGET_GLES2`.
mkdir build-emscripten && cd build-emscripten mkdir build-emscripten && cd build-emscripten
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="/absolute/path/to/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \ -DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
@ -515,6 +531,40 @@ information.
See @ref Platform::Sdl2Application documentation for more information about See @ref Platform::Sdl2Application documentation for more information about
building your projects for Emscripten. building your projects for Emscripten.
@subsection building-cross-ios Crosscompiling for iOS
You will need OSX and Xcode installed.
Set `CMAKE_OSX_ROOT` to SDK you want to target and enable all desired
architectures in `CMAKE_OSX_ARCHITECTURES`. The toolchain needs access to its
platform file, so be sure to properly set **absolute** path to `modules/`
directory containing `Platform/iOS.cmake`. Set `CMAKE_INSTALL_PREFIX` to prefix
where you store other iOS dependencies such as Corrade or SDL2.
As every application is in its own sandbox, it doesn't make sense to build
shared libraries (although it is supported). Enable `BUILD_STATIC` to build
static libraries. You might also have problems using dynamic plugins, enable
`BUILD_PLUGINS_STATIC` to build also plugins as static. OpenGL ES 2.0 is
enabled by default, switch to 3.0 by disabling `TARGET_GLES2`.
mkdir build-ios && cd build-ios
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk \
-DCMAKE_OSX_ARCHITECTURES="arm64;armv7;armv7s" \
-DCMAKE_INSTALL_PREFIX=~/ios-libs \
-DBUILD_STATIC=ON -DBUILD_PLUGINS_STATIC=ON \
-DTARGET_GLES2=OFF \
-DWITH_SDL2APPLICATION=ON \
-G Xcode
cmake --build .
Then you can install the library using `cmake --build . --target install` to
make it available for depending projects.
See @ref Platform::Sdl2Application documentation for more information about
building your projects for iOS.
@subsection building-cross-android Crosscompiling for Android ARM and x86 @subsection building-cross-android Crosscompiling for Android ARM and x86
You will need [Android NDK](https://developer.android.com/tools/sdk/ndk/index.html) You will need [Android NDK](https://developer.android.com/tools/sdk/ndk/index.html)
@ -537,7 +587,6 @@ built for OpenGL ES 2.0 by default, switch to 3.0 by disabling `TARGET_GLES2`.
mkdir build-android-arm && cd build-android-arm mkdir build-android-arm && cd build-android-arm
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="/absolute/path/to/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-ARM.cmake" \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-ARM.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-arm/usr \ -DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-arm/usr \
@ -548,7 +597,6 @@ built for OpenGL ES 2.0 by default, switch to 3.0 by disabling `TARGET_GLES2`.
mkdir build-android-x86 && cd build-android-x86 mkdir build-android-x86 && cd build-android-x86
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="/absolute/path/to/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-x86.cmake" \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Android-x86.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-x86/usr \ -DCMAKE_PREFIX_PATH=/opt/android-ndk/platforms/android-19/arch-x86/usr \
@ -597,8 +645,8 @@ replace `localhost:8080` with your server name, replace `update-job` with
java -jar ~/jenkins-cli.jar -s http://localhost:8080 update-job Magnum-GLTests < package/ci/jenkins-gltests.xml java -jar ~/jenkins-cli.jar -s http://localhost:8080 update-job Magnum-GLTests < package/ci/jenkins-gltests.xml
Build is done using **Ninja** build system and everything possible is enabled, Build is done using **Ninja** build system and everything possible is enabled,
thus you need also **SDL2**, **GLUT** and **OpenAL** libraries. It expects thus you need also **SDL2**, **GLFW**, **GLUT** and **OpenAL** libraries. It
that **GCC** >= 4.9, 4.8, 4.7 and **Clang** are installed and there expects that **GCC** >= 4.9, 4.8, 4.7 and **Clang** are installed and there
are **OpenGL**, **OpenGL ES 2.0** and **OpenGL ES 3.0** librares as it tries to are **OpenGL**, **OpenGL ES 2.0** and **OpenGL ES 3.0** librares as it tries to
compile the library with every combination of them. You can add/remove the axes compile the library with every combination of them. You can add/remove the axes
in `axes/hudson.matrix.TextAxis` or via the web interface later. in `axes/hudson.matrix.TextAxis` or via the web interface later.

58
doc/cmake.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -50,12 +50,10 @@ Basic usage is:
find_package(Magnum REQUIRED) find_package(Magnum REQUIRED)
This command tries to find base Magnum library and then defines these This module tries to find base Magnum library and then defines:
variables:
- `MAGNUM_FOUND` -- Whether the library was found - `Magnum_FOUND` -- Whether the library was found
- `MAGNUM_LIBRARIES` -- Magnum library and dependent libraries - `Magnum::Magnum` -- Base library imported target
- `MAGNUM_INCLUDE_DIRS` -- Root include dir and include dirs of dependencies
- `MAGNUM_PLUGINS_DEBUG_DIR` -- Base directory with dynamic plugins for debug - `MAGNUM_PLUGINS_DEBUG_DIR` -- Base directory with dynamic plugins for debug
builds, defaults to `magnum-d/` subdirectory of dir where Magnum library builds, defaults to `magnum-d/` subdirectory of dir where Magnum library
was found was found
@ -96,13 +94,16 @@ The optional components are:
Platform namespace is split into more components: Platform namespace is split into more components:
- `GlfwApplication` -- @ref Platform::GlfwApplication "GlfwApplication"
- `GlutApplication` -- @ref Platform::GlutApplication "GlutApplication" - `GlutApplication` -- @ref Platform::GlutApplication "GlutApplication"
- `GlxApplication` -- @ref Platform::GlxApplication "GlxApplication" - `GlxApplication` -- @ref Platform::GlxApplication "GlxApplication"
- `NaClApplication` -- @ref Platform::NaClApplication "NaClApplication" - `NaClApplication` -- @ref Platform::NaClApplication "NaClApplication"
- `Sdl2Application` -- @ref Platform::Sdl2Application "Sdl2Application" - `Sdl2Application` -- @ref Platform::Sdl2Application "Sdl2Application"
- `XEglApplication` -- @ref Platform::XEglApplication "XEglApplication" - `XEglApplication` -- @ref Platform::XEglApplication "XEglApplication"
- `WindowlessCglApplication` -- @ref Platform::WindowlessCglApplication "WindowlessCglApplication" - `WindowlessCglApplication` -- @ref Platform::WindowlessCglApplication "WindowlessCglApplication"
- `WindowlessEglApplication` -- @ref Platform::WindowlessEglApplication "WindowlessEglApplication"
- `WindowlessGlxApplication` -- @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication" - `WindowlessGlxApplication` -- @ref Platform::WindowlessGlxApplication "WindowlessGlxApplication"
- `WindowlessIosApplication` -- @ref Platform::WindowlessIosApplication "WindowlessIosApplication"
- `WindowlessNaClApplication` -- @ref Platform::WindowlessNaClApplication "WindowlessNaClApplication" - `WindowlessNaClApplication` -- @ref Platform::WindowlessNaClApplication "WindowlessNaClApplication"
- `WindowlessWglApplication` -- @ref Platform::WindowlessWglApplication "WindowlessWglApplication" - `WindowlessWglApplication` -- @ref Platform::WindowlessWglApplication "WindowlessWglApplication"
- `WindowlessWindowsEglApplication` -- @ref Platform::WindowlessWindowsEglApplication "WindowlessWindowsEglApplication" - `WindowlessWindowsEglApplication` -- @ref Platform::WindowlessWindowsEglApplication "WindowlessWindowsEglApplication"
@ -135,6 +136,12 @@ dependencies, you need to find the dependency and then link to it.
- `TgaImporter` -- @ref Trade::TgaImporter "TgaImporter" plugin - `TgaImporter` -- @ref Trade::TgaImporter "TgaImporter" plugin
- `WavAudioImporter` -- @ref Audio::WavImporter "WavAudioImporter" plugin - `WavAudioImporter` -- @ref Audio::WavImporter "WavAudioImporter" plugin
Lastly, a few utility executables are available:
- `distancefieldconverter` -- @ref magnum-distancefieldconverter executable
- `fontconverter` -- @ref magnum-fontconverter executable
- `info` -- @ref magnum-info executable
Note that [each namespace](namespaces.html), all @ref Platform libraries and Note that [each namespace](namespaces.html), all @ref Platform libraries and
each plugin class contain more detailed information about dependencies, each plugin class contain more detailed information about dependencies,
availability on particular platform and also guide how to enable given library availability on particular platform and also guide how to enable given library
@ -146,18 +153,14 @@ Example usage with specifying additional components is:
For each component is then defined: For each component is then defined:
- `MAGNUM_*_FOUND` -- Whether the component was found - `Magnum_*_FOUND` -- Whether the component was found
- `MAGNUM_*_LIBRARIES` -- Component library and dependent libraries - `Magnum::*` -- Component imported target
- `MAGNUM_*_INCLUDE_DIRS` -- Include dirs of module dependencies
If exactly one `*Application` or exactly one `Windowless*Application` component If exactly one `*Application` or exactly one `Windowless*Application` component
is requested and found, its libraries and include dirs are available in is requested and found, its target is available in convenience alias
convenience aliases `MAGNUM_APPLICATION_LIBRARIES` / `Magnum::Application` / `Magnum::WindowlessApplication` to simplify porting.
`MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES` and `MAGNUM_APPLICATION_INCLUDE_DIRS` Similarly, if exactly one `*Context` component is requested and found, its
/ `MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS` to simplify porting. Similarly, target is available in convenience alias `Magnum::Context`.
if exactly one `*Context` component is requested and found, its libraries and
include dirs are available in convenience aliases `MAGNUM_CONTEXT_LIBRARIES`
and `MAGNUM_CONTEXT_INCLUDE_DIRS`.
The package is found if either debug or release version of each requested The package is found if either debug or release version of each requested
library (or plugin) is found. If both debug and release libraries (or plugins) library (or plugin) is found. If both debug and release libraries (or plugins)
@ -182,12 +185,29 @@ are also available as preprocessor variables if including
- `MAGNUM_TARGET_GLES3` -- Defined if compiled for OpenGL ES 3.0 - `MAGNUM_TARGET_GLES3` -- Defined if compiled for OpenGL ES 3.0
- `MAGNUM_TARGET_DESKTOP_GLES` -- Defined if compiled with OpenGL ES - `MAGNUM_TARGET_DESKTOP_GLES` -- Defined if compiled with OpenGL ES
emulation on desktop OpenGL emulation on desktop OpenGL
- `MAGNUM_TARGET_WEBGL` --- Defined if compiled for WebGL - `MAGNUM_TARGET_WEBGL` -- Defined if compiled for WebGL
- `MAGNUM_TARGET_HEADLESS` -- Defined if compiled for headless machines. See
@ref MAGNUM_TARGET_HEADLESS documentation for more information.
Workflows without imported targets are deprecated and the following variables
are included just for backwards compatibility and only if
@ref MAGNUM_BUILD_DEPRECATED is enabled:
- `MAGNUM_LIBRARIES` -- Expands to `Magnum::Magnum` target. Use `Magnum::Magnum`
target directly instead.
- `MAGNUM_*_LIBRARIES` -- Expands to `Magnum::*` target. Use `Magnum::*`
target directly instead.
- `MAGNUM_APPLICATION_LIBRARIES` / `MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES`
-- Expands to `Magnum::Application` / `Magnum::WindowlessApplication`
target. Use `Magnum::Application` / `Magnum::WindowlessApplication` target
directly instead.
- `MAGNUM_CONTEXT_LIBRARIES` -- Expands to `Magnum::Context` target. Use
`Magnum::Context` target directly instead.
Corrade library provides also its own set of CMake macros and variables, see Corrade library provides also its own set of CMake macros and variables, see
@ref corrade-cmake "its documentation" for more information. @ref corrade-cmake "its documentation" for more information.
@ref cmake-plugins "Plugins repository" and @ref cmake-integration "Integration library" @ref cmake-plugins "Plugins repository", @ref cmake-integration "Integration repository"
have also their own CMake modules. and @ref cmake-extras "Extras repository" have also their own CMake modules.
*/ */
} }

2
doc/coding-style.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/compilation-speedup.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

4
doc/debug-tools.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -65,7 +65,7 @@ DebugTools::ResourceManager manager;
SceneGraph::DrawableGroup3D debugDrawables; SceneGraph::DrawableGroup3D debugDrawables;
// Create renderer options which will be referenced later by "my" resource key // Create renderer options which will be referenced later by "my" resource key
DebugTools::ResourceManager::instance()->set("my", DebugTools::ResourceManager::instance().set("my",
DebugTools::ObjectRendererOptions().setSize(0.3f)); DebugTools::ObjectRendererOptions().setSize(0.3f));
// Create debug renderer for given object, use "my" options for it. The // Create debug renderer for given object, use "my" options for it. The

2
doc/features.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

25
doc/generated/CMakeLists.txt

@ -1,7 +1,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -34,6 +34,8 @@ find_package(Magnum REQUIRED
Shaders Shaders
Sdl2Application) Sdl2Application)
set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
if(CORRADE_TARGET_APPLE) if(CORRADE_TARGET_APPLE)
find_package(Magnum REQUIRED WindowlessCglApplication) find_package(Magnum REQUIRED WindowlessCglApplication)
elseif(CORRADE_TARGET_UNIX) elseif(CORRADE_TARGET_UNIX)
@ -46,22 +48,17 @@ endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h) ${CMAKE_CURRENT_BINARY_DIR}/configure.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}")
include_directories(${MAGNUM_INCLUDE_DIRS}
${MAGNUM_APPLICATION_INCLUDE_DIRS}
${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS})
add_executable(hello hello.cpp) add_executable(hello hello.cpp)
target_link_libraries(hello target_link_libraries(hello
${MAGNUM_LIBRARIES} Magnum::Magnum
${MAGNUM_APPLICATION_LIBRARIES}) Magnum::Application)
add_executable(shaders shaders.cpp) add_executable(shaders shaders.cpp)
target_include_directories(shaders PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(shaders target_link_libraries(shaders
${MAGNUM_LIBRARIES} Magnum::Magnum
${MAGNUM_MESHTOOLS_LIBRARIES} Magnum::MeshTools
${MAGNUM_PRIMITIVES_LIBRARIES} Magnum::Primitives
${MAGNUM_SHADERS_LIBRARIES} Magnum::Shaders
${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}) Magnum::WindowlessApplication)

2
doc/generated/configure.h.cmake

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/generated/hello.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/generated/shaders.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

13
doc/getting-started.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -143,18 +143,17 @@ MAGNUM_APPLICATION_MAIN(MyApplication)
The application essentially does nothing, just clears screen framebuffer to The application essentially does nothing, just clears screen framebuffer to
default (dark gray) color and then does buffer swap to actually display it on default (dark gray) color and then does buffer swap to actually display it on
the screen. The `src/CMakeLists.txt` file finds Magnum, sets up compiler flags, the screen. The `src/CMakeLists.txt` file finds Magnum, creates the executable
creates the executable and links it to all needed libraries: and links it to all needed libraries:
@code @code
find_package(Magnum REQUIRED Sdl2Application) find_package(Magnum REQUIRED Sdl2Application)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}") set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON)
include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_APPLICATION_INCLUDE_DIRS})
add_executable(MyApplication MyApplication.cpp) add_executable(MyApplication MyApplication.cpp)
target_link_libraries(MyApplication target_link_libraries(MyApplication
${MAGNUM_LIBRARIES} Magnum::Magnum
${MAGNUM_APPLICATION_LIBRARIES}) Magnum::Application)
@endcode @endcode
In the following tutorials the code will be explained more thoroughly. In the following tutorials the code will be explained more thoroughly.

6
doc/mainpage.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -79,7 +79,7 @@ Platforms:
- **Linux** and embedded Linux (natively using GLX/EGL and Xlib or through - **Linux** and embedded Linux (natively using GLX/EGL and Xlib or through
SDL2 or GLUT toolkit) SDL2 or GLUT toolkit)
- **Windows** natively or using ANGLE (through SDL2 or GLUT toolkit) - **Windows** natively or using ANGLE (through SDL2 or GLUT toolkit)
- **OS X** (through SDL2 toolkit) - **OS X**, **iOS** (through SDL2 toolkit)
- **Android** 2.3 (API Level 9) and higher - **Android** 2.3 (API Level 9) and higher
- **Windows RT** (Store/Phone) using ANGLE (through SDL2 toolkit) - **Windows RT** (Store/Phone) using ANGLE (through SDL2 toolkit)
- **Google Chrome** (through [Native Client](https://developers.google.com/native-client/), - **Google Chrome** (through [Native Client](https://developers.google.com/native-client/),
@ -128,7 +128,7 @@ Feel free to get more information or contact the author at:
Magnum is licensed under MIT/Expat license: Magnum is licensed under MIT/Expat license:
> >
> Copyright © 2010, 2011, 2012, 2013, 2014, 2015 > Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
> Vladimír Vondruš &lt;mosra@centrum.cz&gt; > Vladimír Vondruš &lt;mosra@centrum.cz&gt;
> >
> Permission is hereby granted, free of charge, to any person obtaining a > Permission is hereby granted, free of charge, to any person obtaining a

53
doc/matrix-vector.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -56,29 +56,26 @@ most specialized type known to make subsequent operations more convenient --
columns of RectangularMatrix are returned as Vector, but when accessing columns of RectangularMatrix are returned as Vector, but when accessing
columns of e.g. Matrix3, they are returned as Vector3. columns of e.g. Matrix3, they are returned as Vector3.
There are also even more specialized subclasses, e.g. @ref Color3 and There are also even more specialized subclasses, e.g. @ref Math::Color3 and
@ref Color4 for color handling and conversion. @ref Math::Color4 for color handling and conversion.
Commonly used types have convenience aliases in @ref Magnum namespace, so you Commonly used types have convenience aliases in @ref Magnum namespace, so you
can write e.g. `Vector3i` instead of `Math::Vector3<Int>`. See @ref types and can write e.g. @ref Vector3i instead of @ref Math::Vector3 "Math::Vector3<Int>".
namespace documentation for more information. See @ref types and namespace documentation for more information.
@section matrix-vector-construction Constructing matrices and vectors @section matrix-vector-construction Constructing matrices and vectors
Default constructors of @ref Math::RectangularMatrix and @ref Math::Vector (and Default constructors of @ref Math::RectangularMatrix and @ref Math::Vector (and
@ref Math::Vector2, @ref Math::Vector3, @ref Math::Vector4, @ref Color3) create @ref Math::Vector2, @ref Math::Vector3, @ref Math::Vector4, @ref Math::Color3,
zero-filled objects. @ref Math::Matrix (and @ref Math::Matrix3, @ref Math::Matrix4) @ref Math::Color4) create zero-filled objects. @ref Math::Matrix (and
is by default constructed as identity matrix. @ref Color4 has alpha value set @ref Math::Matrix3, @ref Math::Matrix4) is by default constructed as identity
to opaque. matrix.
@code @code
Matrix2x3 a; // zero-filled Matrix2x3 a; // zero-filled
Vector3i b; // zero-filled Vector3i b; // zero-filled
Matrix3 identity; // diagonal set to 1 Matrix3 identity; // diagonal set to 1
Matrix3 zero(Matrix::Zero); // zero-filled Matrix3 zero(Matrix::Zero); // zero-filled
Color4 black1; // {0.0f, 0.0f, 0.0f, 1.0f}
Color4ub black2; // {0, 0, 0, 255}
@endcode @endcode
Most common and most efficient way to create vector is to pass all values to Most common and most efficient way to create vector is to pass all values to
@ -101,6 +98,14 @@ Vector3i fill(10); // {10, 10, 10}
auto diag2 = Matrix3::fromDiagonal({3.0f, 2.0f, 1.0f}); auto diag2 = Matrix3::fromDiagonal({3.0f, 2.0f, 1.0f});
@endcode @endcode
There are also shortcuts to create a vector with all but one component set to
zero or one, useful for transformations:
@code
auto x = Vector3::xAxis(); // {1.0f, 0.0f, 0.0f}
auto y = Vector2::yAxis(3.0f); // {0.0f, 3.0f}
auto z = Vector3::zScale(3.0f); // {1.0f, 1.0f, 3.0f}
@endcode
It is possible to create matrices from other matrices and vectors with the same It is possible to create matrices from other matrices and vectors with the same
row count; vectors from vector and scalar: row count; vectors from vector and scalar:
@code @code
@ -124,6 +129,30 @@ Math::Matrix2x3<Int>::from(mat) *= 2; // mat == { 4, 8, 12, 2, 6, 10 }
Note that, unlike constructors, this function has no way to check whether the Note that, unlike constructors, this function has no way to check whether the
array is long enough to contain all elements, so use with caution. array is long enough to contain all elements, so use with caution.
To make handling of colors easier, their behavior is a bit different with a
richer feature set. Implicit construction of @ref Color4 from @ref Color3 will
set the alpha to full value (thus `1.0f` for @ref Color4 and `255` for
@ref Color4ub):
@code
Color4 a = Color3{0.2f, 0.7f, 0.5f}; // {0.2f, 0.7f, 0.5f, 1.0f}
Color4ub b = Color3ub{0x33, 0xb2, 0x7f}; // {0x33, 0xb2, 0x7f, 0xff}
@endcode
Similarly to axes in vectors, you can create single color shades too, or create
a RGB color from HSV representation:
@code
auto green = Color3::green(); // {0.0f, 1.0f, 0.0f}
auto cyan = Color4::cyan(0.5f, 0.95f); // {0.5f, 1.0f, 1.0f, 0.95f}
auto fadedRed = Color3::fromHSV(219.0_degf, 0.50f, 0.57f)
@endcode
Lastly, namespace @ref Math::Literals provides convenient `_rgb`/`_rgbf` and
`_rgba`/`_rgbaf` literals for entering colors in hex representation:
@code
Color3ub a = 0x33b27f_rgb; // {0x33, 0xb2, 0x7f}
Color4 b = 0x33b27fcc_rgbaf; // {0.2f, 0.7f, 0.5f, 0.8f}
@endcode
@section matrix-vector-component-access Accessing matrix and vector components @section matrix-vector-component-access Accessing matrix and vector components
Column vectors of matrices and vector components can be accessed using square Column vectors of matrices and vector components can be accessed using square

2
doc/method-chaining.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

92
doc/namespaces.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -24,7 +24,7 @@
*/ */
/** @dir magnum/src/Magnum /** @dir magnum/src/Magnum
* @brief Namespace @ref Magnum (part of @ref building "Magnum library") * @brief Namespace @ref Magnum (part of @ref building "Magnum library"), @ref Magnum::Extensions
*/ */
/** @namespace Magnum /** @namespace Magnum
@brief Root namespace @brief Root namespace
@ -32,9 +32,8 @@
Contains classes for interacting with OpenGL. Contains classes for interacting with OpenGL.
This library is built as part of Magnum by default. To use it, you need to This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more and @ref cmake for more information.
information.
*/ */
/** @dir Magnum/Platform /** @dir Magnum/Platform
@ -48,15 +47,14 @@ Base classes for creating applications with various toolkits.
Parts of this namespace are built if `WITH_*APPLICATION` is enabled when Parts of this namespace are built if `WITH_*APPLICATION` is enabled when
building Magnum, with each library having specific toolkit dependencies and building Magnum, with each library having specific toolkit dependencies and
platform requirements. To use particular application library, you need to platform requirements. To use particular application library, you need to
request given `*Application` component of `Magnum` package in CMake, add request given `*Application` component of `Magnum` package in CMake and link to
`${MAGNUM_*APPLICATION_INCLUDE_DIRS}` to include path and link to `Magnum::*Application` target. See particular `*Application` class
`${MAGNUM_*APPLICATION_LIBRARIES}`. See particular `*Application` class
documentation, @ref building, @ref cmake and @ref platform for more documentation, @ref building, @ref cmake and @ref platform for more
information. information.
*/ */
/** @dir Magnum/Math /** @dir Magnum/Math
* @brief Namespace @ref Magnum::Math * @brief Namespace @ref Magnum::Math, @ref Magnum::Math::Literals
*/ */
/** @namespace Magnum::Math /** @namespace Magnum::Math
@brief Math library @brief Math library
@ -64,9 +62,17 @@ information.
Template classes for matrix and vector calculations. Template classes for matrix and vector calculations.
This library is built as part of Magnum by default. To use it, you need to This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link find `Magnum` package and link to `Magnum::Magnum` target. See @ref building,
to `${MAGNUM_LIBRARIES}`. See @ref building, @ref cmake, @ref matrix-vector and @ref cmake, @ref matrix-vector and @ref transformations for more information.
@ref transformations for more information. */
/** @namespace Magnum::Math::Literals
@brief Math literals
Literals for easy construction of angle and color values.
This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
and @ref cmake for more information.
*/ */
/** @dir Magnum/Math/Algorithms /** @dir Magnum/Math/Algorithms
@ -78,9 +84,8 @@ to `${MAGNUM_LIBRARIES}`. See @ref building, @ref cmake, @ref matrix-vector and
Various matrix and vector algorithms. Various matrix and vector algorithms.
This library is built as part of Magnum by default. To use it, you need to This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more and @ref cmake for more information.
information.
*/ */
/** @dir Magnum/Math/Geometry /** @dir Magnum/Math/Geometry
@ -92,9 +97,8 @@ information.
Functions for computing intersections, distances, areas and volumes. Functions for computing intersections, distances, areas and volumes.
This library is built as part of Magnum by default. To use it, you need to This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more and @ref cmake for more information.
information.
*/ */
/** @dir Magnum/Audio /** @dir Magnum/Audio
@ -107,11 +111,11 @@ Audio import, playback and integration with @ref SceneGraph.
This library depends on **OpenAL** library. It is built if `WITH_AUDIO` is This library depends on **OpenAL** library. It is built if `WITH_AUDIO` is
enabled when building Magnum. To use this library, you need to request enabled when building Magnum. To use this library, you need to request
`Audio` component of `Magnum` package in CMake, add `${MAGNUM_AUDIO_INCLUDE_DIRS}` `Audio` component of `Magnum` package in CMake and link to
to include path and link to `${MAGNUM_AUDIO_LIBRARIES}`. See @ref building and `Magnum::Audio` target. See @ref building and @ref cmake for more information.
@ref cmake for more information. Additional plugins are enabled separately, see Additional plugins are enabled separately, see particular `Audio::*Importer`
particular `*Importer` class documentation, @ref building-plugins, class documentation, @ref building-plugins, @ref cmake-plugins and @ref plugins
@ref cmake-plugins and @ref plugins for more information. for more information.
*/ */
/** @dir Magnum/DebugTools /** @dir Magnum/DebugTools
@ -124,8 +128,8 @@ Debugging helpers, renderers and profilers.
This library is built if `WITH_DEBUGTOOLS` is enabled when building Magnum. To This library is built if `WITH_DEBUGTOOLS` is enabled when building Magnum. To
use this library, you need to request `DebugTools` component of `Magnum` use this library, you need to request `DebugTools` component of `Magnum`
package in CMake and link to `${MAGNUM_DEBUGTOOLS_LIBRARIES}`. See package in CMake and link to `Magnum::DebugTools` target. See @ref building,
@ref building, @ref cmake and @ref debug-tools for more information. @ref cmake and @ref debug-tools for more information.
*/ */
/** @dir Magnum/MeshTools /** @dir Magnum/MeshTools
@ -138,8 +142,8 @@ Tools for generating, optimizing and cleaning meshes.
This library is built if `WITH_MESHTOOLS` is enabled when building Magnum. To This library is built if `WITH_MESHTOOLS` is enabled when building Magnum. To
use this library, you need to request `MeshTools` component of `Magnum` use this library, you need to request `MeshTools` component of `Magnum`
package in CMake and link to `${MAGNUM_MESHTOOLS_LIBRARIES}`. See @ref building package in CMake and link to `Magnum::MeshTools` target. See @ref building and
and @ref cmake for more information. @ref cmake for more information.
*/ */
/** @dir Magnum/Primitives /** @dir Magnum/Primitives
@ -152,8 +156,8 @@ Basic primitives for testing purposes.
This library is built if `WITH_PRIMITIVES` is enabled when building Magnum. To This library is built if `WITH_PRIMITIVES` is enabled when building Magnum. To
use this library, you need to request `Primitives` component of `Magnum` use this library, you need to request `Primitives` component of `Magnum`
package in CMake and link to `${MAGNUM_PRIMITIVES_LIBRARIES}`. See package in CMake and link to `Magnum::Primitives` target. See @ref building and
@ref building and @ref cmake for more information. @ref cmake for more information.
*/ */
/** @dir Magnum/SceneGraph /** @dir Magnum/SceneGraph
@ -166,8 +170,8 @@ Managing object hierarchy, transformations and interactions.
This library is built if `WITH_SCENEGRAPH` is enabled when building Magnum. To This library is built if `WITH_SCENEGRAPH` is enabled when building Magnum. To
use this library, you need to request `SceneGraph` component of `Magnum` use this library, you need to request `SceneGraph` component of `Magnum`
package in CMake and link to `${MAGNUM_SCENEGRAPH_LIBRARIES}`. See package in CMake and link to `Magnum::SceneGraph` target. See @ref building,
@ref building, @ref cmake and @ref scenegraph for more information. @ref cmake and @ref scenegraph for more information.
*/ */
/** @dir Magnum/Shaders /** @dir Magnum/Shaders
@ -180,8 +184,8 @@ Collection of shaders for easy prototyping and basic usage.
This library is built if `WITH_SHADERS` is enabled when building Magnum. To This library is built if `WITH_SHADERS` is enabled when building Magnum. To
use this library, you need to request `Shaders` component of `Magnum` package use this library, you need to request `Shaders` component of `Magnum` package
in CMake and link to `${MAGNUM_MESHTOOLS_SHADERS}`. See @ref building and in CMake and link to `Magnum::Shaders` target. See @ref building, @ref cmake
@ref cmake and @ref shaders for more information. and @ref shaders for more information.
*/ */
/** @dir Magnum/Shapes /** @dir Magnum/Shapes
@ -194,8 +198,8 @@ Collision detection system.
This library is built if `WITH_SHAPES` is enabled when building Magnum. To use This library is built if `WITH_SHAPES` is enabled when building Magnum. To use
this library, you need to request `Shapes` component of `Magnum` package in this library, you need to request `Shapes` component of `Magnum` package in
CMake and link to `${MAGNUM_SHAPES_LIBRARIES}`. See @ref building, @ref cmake CMake and link to `Magnum::Shapes` target. See @ref building, @ref cmake and
and @ref shapes for more information. @ref shapes for more information.
*/ */
/** @dir Magnum/Text /** @dir Magnum/Text
@ -208,8 +212,8 @@ Font texture creation and text layouting.
This library is built if `WITH_TEXT` is enabled when building Magnum. To use This library is built if `WITH_TEXT` is enabled when building Magnum. To use
this library, you need to request `Text` component of `Magnum` package in this library, you need to request `Text` component of `Magnum` package in
CMake and link to `${MAGNUM_TEXT_LIBRARIES}`. See @ref building and @ref cmake CMake and link to `Magnum::Text` target. See @ref building and @ref cmake for
for more information. Additional plugins are enabled separately, see particular more information. Additional plugins are enabled separately, see particular
`*Font` and `*FontConverter` class documentation, @ref building-plugins, `*Font` and `*FontConverter` class documentation, @ref building-plugins,
@ref cmake-plugins and @ref plugins for more information. @ref cmake-plugins and @ref plugins for more information.
*/ */
@ -224,8 +228,8 @@ Tools for generating, compressing and optimizing textures.
This library is built if `WITH_TEXTURETOOLS` is enabled when building Magnum. This library is built if `WITH_TEXTURETOOLS` is enabled when building Magnum.
To use this library, you need to request `TextureTools` component of `Magnum` To use this library, you need to request `TextureTools` component of `Magnum`
package in CMake and link to `${MAGNUM_TEXTURETOOLS_LIBRARIES}`. See package in CMake and link to `Magnum::TextureTools`. See @ref building and
@ref building and @ref cmake for more information. @ref cmake for more information.
*/ */
/** @dir Magnum/Trade /** @dir Magnum/Trade
@ -238,11 +242,11 @@ Contains plugin interfaces for importing data of various formats and classes
for direct access to the data. for direct access to the data.
This library is built as part of Magnum by default. To use it, you need to This library is built as part of Magnum by default. To use it, you need to
find `Magnum` package, add `${MAGNUM_INCLUDE_DIRS}` to include path and link find `Magnum` package and link to `Magnum::Magnum` target. See @ref building
to `${MAGNUM_LIBRARIES}`. See @ref building and @ref cmake for more and @ref cmake for more information. Additional plugins are enabled separately,
information. Additional plugins are enabled separately, see particular see particular `Trade::*Importer` and `*ImageConverter` class documentation,
`*Importer` and `*ImageConverter` class documentation, @ref building-plugins, @ref building-plugins, @ref cmake-plugins and @ref plugins for more
@ref cmake-plugins and @ref plugins for more information. information.
*/ */
/** @dir magnum/src/MagnumPlugins /** @dir magnum/src/MagnumPlugins

2
doc/openal-support.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Copyright © 2015 Jonathan Hale <squareys@googlemail.com> Copyright © 2015 Jonathan Hale <squareys@googlemail.com>

2
doc/openal.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

23
doc/opengl-mapping.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -60,7 +60,7 @@ OpenGL function | Matching API
@fn_gl{BindFragDataLocation} | @ref AbstractShaderProgram::bindFragmentDataLocation() @fn_gl{BindFragDataLocation} | @ref AbstractShaderProgram::bindFragmentDataLocation()
@fn_gl{BindFragDataLocationIndexed} | @ref AbstractShaderProgram::bindFragmentDataLocationIndexed() @fn_gl{BindFragDataLocationIndexed} | @ref AbstractShaderProgram::bindFragmentDataLocationIndexed()
@fn_gl{BindFramebuffer} | @ref Framebuffer::bind() @fn_gl{BindFramebuffer} | @ref Framebuffer::bind()
@fn_gl{BindImageTexture}, \n @fn_gl{BindImageTextures} | | @fn_gl{BindImageTexture}, \n @fn_gl{BindImageTextures} | @ref AbstractTexture::unbindImage(), \n @ref AbstractTexture::unbindImages(), \n @ref AbstractTexture::bindImages(), \n @ref Texture::bindImage(), \n @ref Texture::bindImageLayered(), \n @ref TextureArray::bindImage(), \n @ref TextureArray::bindImageLayered(), \n @ref CubeMapTexture::bindImage(), \n @ref CubeMapTexture::bindImageLayered(), \n @ref CubeMapTextureArray::bindImage(), \n @ref CubeMapTextureArray::bindImageLayered(), \n @ref MultisampleTexture::bindImage(), \n @ref MultisampleTexture::bindImageLayered(), \n @ref RectangleTexture::bindImage(), \n @ref BufferTexture::bindImage()
@fn_gl{BindProgramPipeline} | | @fn_gl{BindProgramPipeline} | |
@fn_gl{BindRenderbuffer} | not needed, handled internally in @ref Renderbuffer @fn_gl{BindRenderbuffer} | not needed, handled internally in @ref Renderbuffer
@fn_gl{BindSampler}, \n @fn_gl{BindSamplers} | | @fn_gl{BindSampler}, \n @fn_gl{BindSamplers} | |
@ -121,7 +121,7 @@ OpenGL function | Matching API
@fn_gl{DepthRangeArray} | | @fn_gl{DepthRangeArray} | |
@fn_gl{DepthRangeIndexed} | | @fn_gl{DepthRangeIndexed} | |
@fn_gl{DetachShader} | | @fn_gl{DetachShader} | |
@fn_gl{DispatchCompute} | | @fn_gl{DispatchCompute} | @ref AbstractShaderProgram::dispatchCompute()
@fn_gl_extension{DispatchComputeGroupSize,ARB,compute_variable_group_size} | | @fn_gl_extension{DispatchComputeGroupSize,ARB,compute_variable_group_size} | |
@fn_gl{DispatchComputeIndirect} | | @fn_gl{DispatchComputeIndirect} | |
@fn_gl{DrawArrays}, \n @fn_gl{DrawArraysInstanced}, \n @fn_gl{DrawArraysInstancedBaseInstance}, \n @fn_gl{DrawElements}, \n @fn_gl{DrawRangeElements}, \n @fn_gl{DrawElementsBaseVertex}, \n @fn_gl{DrawRangeElementsBaseVertex}, \n @fn_gl{DrawElementsInstanced}, \n @fn_gl{DrawElementsInstancedBaseInstance}, \n @fn_gl{DrawElementsInstancedBaseVertex}, \n @fn_gl{DrawElementsInstancedBaseVertexBaseInstance} | @ref Mesh::draw(), \n @ref MeshView::draw() @fn_gl{DrawArrays}, \n @fn_gl{DrawArraysInstanced}, \n @fn_gl{DrawArraysInstancedBaseInstance}, \n @fn_gl{DrawElements}, \n @fn_gl{DrawRangeElements}, \n @fn_gl{DrawElementsBaseVertex}, \n @fn_gl{DrawRangeElementsBaseVertex}, \n @fn_gl{DrawElementsInstanced}, \n @fn_gl{DrawElementsInstancedBaseInstance}, \n @fn_gl{DrawElementsInstancedBaseVertex}, \n @fn_gl{DrawElementsInstancedBaseVertexBaseInstance} | @ref Mesh::draw(), \n @ref MeshView::draw()
@ -175,7 +175,7 @@ OpenGL function | Matching API
@fn_gl2{GetBufferPointer,GetBufferPointerv}, \n `glGetNamedBufferPointer()`, \n @fn_gl_extension{GetNamedBufferPointer,EXT,direct_state_access} | not queryable, @ref Buffer::map() setter only @fn_gl2{GetBufferPointer,GetBufferPointerv}, \n `glGetNamedBufferPointer()`, \n @fn_gl_extension{GetNamedBufferPointer,EXT,direct_state_access} | not queryable, @ref Buffer::map() setter only
@fn_gl{GetBufferSubData}, \n `glGetNamedBufferSubData()`, \n @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access} | @ref Buffer::data(), \n @ref Buffer::subData() @fn_gl{GetBufferSubData}, \n `glGetNamedBufferSubData()`, \n @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access} | @ref Buffer::data(), \n @ref Buffer::subData()
@fn_gl{GetCompressedTexImage}, \n `glGetnCompressedTexImage()`, \n @fn_gl_extension{GetnCompressedTexImage,ARB,robustness}, \n `glGetCompressedTextureImage()`, \n @fn_gl_extension{GetCompressedTextureImage,EXT,direct_state_access} | @ref Texture::compressedImage(), \n @ref TextureArray::compressedImage(), \n @ref CubeMapTexture::compressedImage(), \n @ref CubeMapTextureArray::compressedImage(), \n @ref RectangleTexture::compressedImage() @fn_gl{GetCompressedTexImage}, \n `glGetnCompressedTexImage()`, \n @fn_gl_extension{GetnCompressedTexImage,ARB,robustness}, \n `glGetCompressedTextureImage()`, \n @fn_gl_extension{GetCompressedTextureImage,EXT,direct_state_access} | @ref Texture::compressedImage(), \n @ref TextureArray::compressedImage(), \n @ref CubeMapTexture::compressedImage(), \n @ref CubeMapTextureArray::compressedImage(), \n @ref RectangleTexture::compressedImage()
@fn_gl{GetCompressedTextureSubImage} | | @fn_gl{GetCompressedTextureSubImage} | @ref Texture::compressedSubImage(), \n @ref TextureArray::compressedSubImage(), \n @ref CubeMapTexture::compressedImage(), \n @ref CubeMapTexture::compressedSubImage(), \n @ref CubeMapTextureArray::compressedSubImage(), \n @ref RectangleTexture::compressedSubImage()
@fn_gl{GetDebugMessageLog} | | @fn_gl{GetDebugMessageLog} | |
@fn_gl{GetError} | @ref Renderer::error() @fn_gl{GetError} | @ref Renderer::error()
@fn_gl{GetFragDataIndex}, @fn_gl{GetFragDataLocation} | not queryable, @ref AbstractShaderProgram::bindFragmentDataLocation() and \n @ref AbstractShaderProgram::bindFragmentDataLocationIndexed() setters only @fn_gl{GetFragDataIndex}, @fn_gl{GetFragDataLocation} | not queryable, @ref AbstractShaderProgram::bindFragmentDataLocation() and \n @ref AbstractShaderProgram::bindFragmentDataLocationIndexed() setters only
@ -219,7 +219,7 @@ OpenGL function | Matching API
@fn_gl{GetTransformFeedback} | not queryable, @ref TransformFeedback::attachBuffer() and @ref TransformFeedback::attachBuffers() setters only @fn_gl{GetTransformFeedback} | not queryable, @ref TransformFeedback::attachBuffer() and @ref TransformFeedback::attachBuffers() setters only
@fn_gl{GetTransformFeedbackVarying} | not queryable, @ref AbstractShaderProgram::setTransformFeedbackOutputs() setter only @fn_gl{GetTransformFeedbackVarying} | not queryable, @ref AbstractShaderProgram::setTransformFeedbackOutputs() setter only
@fn_gl{GetUniform}, \n `glGetnUniform()`, \n @fn_gl_extension{GetnUniform,ARB,robustness} | not queryable, @ref AbstractShaderProgram::setUniform() setter only @fn_gl{GetUniform}, \n `glGetnUniform()`, \n @fn_gl_extension{GetnUniform,ARB,robustness} | not queryable, @ref AbstractShaderProgram::setUniform() setter only
@fn_gl{GetUniformBlockIndex} | | @fn_gl{GetUniformBlockIndex} | @ref AbstractShaderProgram::uniformBlockIndex()
@fn_gl{GetUniformIndices} | | @fn_gl{GetUniformIndices} | |
@fn_gl{GetUniformLocation} | @ref AbstractShaderProgram::uniformLocation() @fn_gl{GetUniformLocation} | @ref AbstractShaderProgram::uniformLocation()
@fn_gl{GetUniformSubroutine} | | @fn_gl{GetUniformSubroutine} | |
@ -264,7 +264,7 @@ OpenGL function | Matching API
@fn_gl_extension{MakeTextureHandleNonResident,ARB,bindless_texture} | | @fn_gl_extension{MakeTextureHandleNonResident,ARB,bindless_texture} | |
@fn_gl{MapBuffer}, \n `glMapNamedBuffer()`, \n @fn_gl_extension{MapNamedBuffer,EXT,direct_state_access}, \n @fn_gl{MapBufferRange}, \n `glMapNamedBufferRange()`, \n @fn_gl_extension{MapNamedBufferRange,EXT,direct_state_access}, \n @fn_gl{UnmapBuffer}, \n `glUnmapNamedBuffer()`, \n @fn_gl_extension{UnmapNamedBuffer,EXT,direct_state_access} | @ref Buffer::map(), @ref Buffer::unmap() @fn_gl{MapBuffer}, \n `glMapNamedBuffer()`, \n @fn_gl_extension{MapNamedBuffer,EXT,direct_state_access}, \n @fn_gl{MapBufferRange}, \n `glMapNamedBufferRange()`, \n @fn_gl_extension{MapNamedBufferRange,EXT,direct_state_access}, \n @fn_gl{UnmapBuffer}, \n `glUnmapNamedBuffer()`, \n @fn_gl_extension{UnmapNamedBuffer,EXT,direct_state_access} | @ref Buffer::map(), @ref Buffer::unmap()
@fn_gl_extension{MapBufferSubData,CHROMIUM,map_sub}, @fn_gl_extension{UnmapBufferSubData,CHROMIUM,map_sub} | @ref Buffer::mapSub(), @ref Buffer::unmapSub() @fn_gl_extension{MapBufferSubData,CHROMIUM,map_sub}, @fn_gl_extension{UnmapBufferSubData,CHROMIUM,map_sub} | @ref Buffer::mapSub(), @ref Buffer::unmapSub()
@fn_gl{MemoryBarrier}, \n `glMemoryBarrierByRegion()` | | @fn_gl{MemoryBarrier}, \n `glMemoryBarrierByRegion()` | @ref Renderer::setMemoryBarrier(), \n @ref Renderer::setMemoryBarrierByRegion()
@fn_gl{MinSampleShading} | | @fn_gl{MinSampleShading} | |
@fn_gl{MultiDrawArrays}, \n @fn_gl{MultiDrawElements}, \n @fn_gl{MultiDrawElementsBaseVertex} | @ref MeshView::draw(AbstractShaderProgram&, std::initializer_list<std::reference_wrapper<MeshView>>) @fn_gl{MultiDrawArrays}, \n @fn_gl{MultiDrawElements}, \n @fn_gl{MultiDrawElementsBaseVertex} | @ref MeshView::draw(AbstractShaderProgram&, std::initializer_list<std::reference_wrapper<MeshView>>)
@fn_gl_extension{MultiDrawArraysIndirectCount,ARB,indirect_parameters}, \n @fn_gl_extension{MultiDrawElementsIndirectCount,ARB,indirect_parameters} | | @fn_gl_extension{MultiDrawArraysIndirectCount,ARB,indirect_parameters}, \n @fn_gl_extension{MultiDrawElementsIndirectCount,ARB,indirect_parameters} | |
@ -339,7 +339,7 @@ OpenGL function | Matching API
@fn_gl{TexStorage1D}, \n `glTextureStorage1D()`, \n @fn_gl_extension{TextureStorage1D,EXT,direct_state_access}, \n @fn_gl{TexStorage2D}, \n `glTextureStorage2D()`, \n @fn_gl_extension{TextureStorage2D,EXT,direct_state_access}, \n @fn_gl{TexStorage3D}, \n `glTextureStorage3D()`, \n @fn_gl_extension{TextureStorage3D,EXT,direct_state_access} | @ref Texture::setStorage(), \n @ref TextureArray::setStorage(), \n @ref CubeMapTexture::setStorage(), \n @ref CubeMapTextureArray::setStorage(), \n @ref RectangleTexture::setStorage() @fn_gl{TexStorage1D}, \n `glTextureStorage1D()`, \n @fn_gl_extension{TextureStorage1D,EXT,direct_state_access}, \n @fn_gl{TexStorage2D}, \n `glTextureStorage2D()`, \n @fn_gl_extension{TextureStorage2D,EXT,direct_state_access}, \n @fn_gl{TexStorage3D}, \n `glTextureStorage3D()`, \n @fn_gl_extension{TextureStorage3D,EXT,direct_state_access} | @ref Texture::setStorage(), \n @ref TextureArray::setStorage(), \n @ref CubeMapTexture::setStorage(), \n @ref CubeMapTextureArray::setStorage(), \n @ref RectangleTexture::setStorage()
@fn_gl{TexStorage2DMultisample}, \n `glTextureStorage2DMultisample()`, \n @fn_gl_extension{TextureStorage2DMultisample,EXT,direct_state_access}, \n @fn_gl{TexStorage3DMultisample}, \n `glTextureStorage3DMultisample()`, \n @fn_gl_extension{TextureStorage3DMultisample,EXT,direct_state_access} | @ref MultisampleTexture::setStorage() @fn_gl{TexStorage2DMultisample}, \n `glTextureStorage2DMultisample()`, \n @fn_gl_extension{TextureStorage2DMultisample,EXT,direct_state_access}, \n @fn_gl{TexStorage3DMultisample}, \n `glTextureStorage3DMultisample()`, \n @fn_gl_extension{TextureStorage3DMultisample,EXT,direct_state_access} | @ref MultisampleTexture::setStorage()
@fn_gl{TexSubImage1D}, \n `glTextureSubImage1D()`, \n @fn_gl_extension{TextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{TexSubImage2D}, \n `glTextureSubImage2D()`, \n @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{TexSubImage3D}, \n `glTextureSubImage3D()`, \n @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} | @ref Texture::setSubImage(), \n @ref TextureArray::setSubImage(), \n @ref CubeMapTexture::setSubImage(), \n @ref CubeMapTextureArray::setSubImage(), \n @ref RectangleTexture::setSubImage() @fn_gl{TexSubImage1D}, \n `glTextureSubImage1D()`, \n @fn_gl_extension{TextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{TexSubImage2D}, \n `glTextureSubImage2D()`, \n @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{TexSubImage3D}, \n `glTextureSubImage3D()`, \n @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} | @ref Texture::setSubImage(), \n @ref TextureArray::setSubImage(), \n @ref CubeMapTexture::setSubImage(), \n @ref CubeMapTextureArray::setSubImage(), \n @ref RectangleTexture::setSubImage()
@fn_gl{TextureBarrier} | | @fn_gl{TextureBarrier} | @ref Renderer::setTextureBarrier()
@fn_gl{TextureView} | | @fn_gl{TextureView} | |
@fn_gl{TransformFeedbackBufferBase}, \n @fn_gl{TransformFeedbackBufferRange} | @ref TransformFeedback::attachBuffer(), \n @ref TransformFeedback::attachBuffers() @fn_gl{TransformFeedbackBufferBase}, \n @fn_gl{TransformFeedbackBufferRange} | @ref TransformFeedback::attachBuffer(), \n @ref TransformFeedback::attachBuffers()
@fn_gl{TransformFeedbackVaryings} | @ref AbstractShaderProgram::setTransformFeedbackOutputs() @fn_gl{TransformFeedbackVaryings} | @ref AbstractShaderProgram::setTransformFeedbackOutputs()
@ -350,7 +350,7 @@ OpenGL function | Matching API
--------------------------------------- | ------------ --------------------------------------- | ------------
@fn_gl{Uniform}, \n @fn_gl{ProgramUniform}, \n @fn_gl_extension{ProgramUniform,EXT,direct_state_access} | @ref AbstractShaderProgram::setUniform() @fn_gl{Uniform}, \n @fn_gl{ProgramUniform}, \n @fn_gl_extension{ProgramUniform,EXT,direct_state_access} | @ref AbstractShaderProgram::setUniform()
@fn_gl_extension{UniformHandle,ARB,bindless_texture}, \n @fn_gl_extension{ProgramUniformHandle,ARB,bindless_texture} | | @fn_gl_extension{UniformHandle,ARB,bindless_texture}, \n @fn_gl_extension{ProgramUniformHandle,ARB,bindless_texture} | |
@fn_gl{UniformBlockBinding} | | @fn_gl{UniformBlockBinding} | @ref AbstractShaderProgram::setUniformBlockBinding()
@fn_gl{UniformSubroutines} | | @fn_gl{UniformSubroutines} | |
@fn_gl{UseProgram} | @ref Mesh::draw(), @ref MeshView::draw() @fn_gl{UseProgram} | @ref Mesh::draw(), @ref MeshView::draw()
@fn_gl{UseProgramStages} | | @fn_gl{UseProgramStages} | |
@ -431,9 +431,9 @@ OpenGL function | Matching API
@def_gl{MAX_COMPUTE_SHARED_MEMORY_SIZE} | @ref AbstractShaderProgram::maxComputeSharedMemorySize() @def_gl{MAX_COMPUTE_SHARED_MEMORY_SIZE} | @ref AbstractShaderProgram::maxComputeSharedMemorySize()
@def_gl_extension{MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS,ARB,compute_variable_group_size} | | @def_gl_extension{MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS,ARB,compute_variable_group_size} | |
@def_gl_extension{MAX_COMPUTE_VARIABLE_GROUP_SIZE,ARB,compute_variable_group_size} | | @def_gl_extension{MAX_COMPUTE_VARIABLE_GROUP_SIZE,ARB,compute_variable_group_size} | |
@def_gl{MAX_COMPUTE_WORK_GROUP_COUNT} | | @def_gl{MAX_COMPUTE_WORK_GROUP_COUNT} | @ref AbstractShaderProgram::maxComputeWorkGroupCount()
@def_gl{MAX_COMPUTE_WORK_GROUP_INVOCATIONS} | @ref AbstractShaderProgram::maxComputeWorkGroupInvocations() @def_gl{MAX_COMPUTE_WORK_GROUP_INVOCATIONS} | @ref AbstractShaderProgram::maxComputeWorkGroupInvocations()
@def_gl{MAX_COMPUTE_WORK_GROUP_SIZE} | | @def_gl{MAX_COMPUTE_WORK_GROUP_SIZE} | @ref AbstractShaderProgram::maxComputeWorkGroupSize()
@def_gl{MAX_CULL_DISTANCES} | | @def_gl{MAX_CULL_DISTANCES} | |
@def_gl{MAX_DEBUG_LOGGED_MESSAGES} | @ref DebugOutput::maxLoggedMessages() @def_gl{MAX_DEBUG_LOGGED_MESSAGES} | @ref DebugOutput::maxLoggedMessages()
@def_gl{MAX_DEBUG_MESSAGE_LENGTH} | @ref DebugOutput::maxMessageLength() @def_gl{MAX_DEBUG_MESSAGE_LENGTH} | @ref DebugOutput::maxMessageLength()
@ -463,7 +463,7 @@ OpenGL function | Matching API
@def_gl_extension{MAX_SPARSE_3D_TEXTURE_SIZE,ARB,sparse_texture} | | @def_gl_extension{MAX_SPARSE_3D_TEXTURE_SIZE,ARB,sparse_texture} | |
@def_gl_extension{MAX_SPARSE_ARRAY_TEXTURE_LAYERS,ARB,sparse_texture} | | @def_gl_extension{MAX_SPARSE_ARRAY_TEXTURE_LAYERS,ARB,sparse_texture} | |
@def_gl{MAX_TESS_GEN_LEVEL} | | @def_gl{MAX_TESS_GEN_LEVEL} | |
@def_gl{MAX_TESS_PATCH_COMPONENTS} @def_gl{MAX_TESS_PATCH_COMPONENTS} | |
@def_gl{MAX_TEXTURE_BUFFER_SIZE} | @ref BufferTexture::maxSize() @def_gl{MAX_TEXTURE_BUFFER_SIZE} | @ref BufferTexture::maxSize()
@def_gl_extension{MAX_TEXTURE_MAX_ANISOTROPY,EXT,texture_filter_anisotropic} | @ref Sampler::maxMaxAnisotropy() @def_gl_extension{MAX_TEXTURE_MAX_ANISOTROPY,EXT,texture_filter_anisotropic} | @ref Sampler::maxMaxAnisotropy()
@def_gl{MAX_TEXTURE_LOD_BIAS} | @ref AbstractTexture::maxLodBias() @def_gl{MAX_TEXTURE_LOD_BIAS} | @ref AbstractTexture::maxLodBias()
@ -483,6 +483,7 @@ OpenGL function | Matching API
@def_gl{MIN_FRAGMENT_INTERPOLATION_OFFSET}, \n @def_gl{MAX_FRAGMENT_INTERPOLATION_OFFSET} | | @def_gl{MIN_FRAGMENT_INTERPOLATION_OFFSET}, \n @def_gl{MAX_FRAGMENT_INTERPOLATION_OFFSET} | |
@def_gl{MIN_MAP_BUFFER_ALIGNMENT} | @ref Buffer::minMapAlignment() @def_gl{MIN_MAP_BUFFER_ALIGNMENT} | @ref Buffer::minMapAlignment()
@def_gl{MIN_PROGRAM_TEXEL_OFFSET}, \n @def_gl{MAX_PROGRAM_TEXEL_OFFSET} | @ref AbstractShaderProgram::minTexelOffset(), \n @ref AbstractShaderProgram::maxTexelOffset() @def_gl{MIN_PROGRAM_TEXEL_OFFSET}, \n @def_gl{MAX_PROGRAM_TEXEL_OFFSET} | @ref AbstractShaderProgram::minTexelOffset(), \n @ref AbstractShaderProgram::maxTexelOffset()
@def_gl{MIN_PROGRAM_TEXTURE_GATHER_OFFSET}, \n @def_gl{MAX_PROGRAM_TEXTURE_GATHER_OFFSET} | |
@def_gl{MIN_SAMPLE_SHADING_VALUE} | | @def_gl{MIN_SAMPLE_SHADING_VALUE} | |
@def_gl{NUM_EXTENSIONS} | @ref Context::supportedExtensions() @def_gl{NUM_EXTENSIONS} | @ref Context::supportedExtensions()
@def_gl{NUM_PROGRAM_BINARY_FORMATS}, \n @def_gl{PROGRAM_BINARY_FORMATS} | | @def_gl{NUM_PROGRAM_BINARY_FORMATS}, \n @def_gl{PROGRAM_BINARY_FORMATS} | |

27
doc/opengl-support.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -80,7 +80,7 @@ GLSL 1.40 | done
@extension{ARB,texture_rectangle} | done @extension{ARB,texture_rectangle} | done
@extension{ARB,draw_instanced} | done @extension{ARB,draw_instanced} | done
@extension{ARB,texture_buffer_object} | done @extension{ARB,texture_buffer_object} | done
@extension{ARB,uniform_buffer_object} | missing uniform block binding @extension{ARB,uniform_buffer_object} | done except for data layout queries
@extension{ARB,copy_buffer} | done @extension{ARB,copy_buffer} | done
@extension{EXT,texture_snorm} | done @extension{EXT,texture_snorm} | done
@extension{NV,primitive_restart} | | @extension{NV,primitive_restart} | |
@ -161,7 +161,7 @@ GLSL 4.20 | done
@extension{ARB,internalformat_query} | | @extension{ARB,internalformat_query} | |
@extension{ARB,map_buffer_alignment} | done @extension{ARB,map_buffer_alignment} | done
@extension{ARB,shader_atomic_counters} | done @extension{ARB,shader_atomic_counters} | done
@extension{ARB,shader_image_load_store} | | @extension{ARB,shader_image_load_store} | done
@extension{ARB,shading_language_packing} | done (shading language only) @extension{ARB,shading_language_packing} | done (shading language only)
@extension{ARB,texture_storage} | done @extension{ARB,texture_storage} | done
@ -173,19 +173,19 @@ GLSL 4.30 | done
@extension{ARB,arrays_of_arrays} | done (shading language only) @extension{ARB,arrays_of_arrays} | done (shading language only)
@extension{ARB,ES3_compatibility} | only conservative sample query and compression formats @extension{ARB,ES3_compatibility} | only conservative sample query and compression formats
@extension{ARB,clear_buffer_object} | | @extension{ARB,clear_buffer_object} | |
@extension{ARB,compute_shader} | | @extension{ARB,compute_shader} | done except for indirect dispatch
@extension{ARB,copy_image} | | @extension{ARB,copy_image} | |
@extension{KHR,debug} | missing log retrieval, sync, pipeline and sampler label @extension{KHR,debug} | missing log retrieval, sync, pipeline and sampler label
@extension{ARB,explicit_uniform_location} | done @extension{ARB,explicit_uniform_location} | done
@extension{ARB,fragment_layer_viewport} | done (shading language only) @extension{ARB,fragment_layer_viewport} | done (shading language only)
@extension{ARB,framebuffer_no_attachments} | | @extension{ARB,framebuffer_no_attachments} | |
@extension{ARB,internalformat_query2} | | @extension{ARB,internalformat_query2} | only compressed texture block queries
@extension{ARB,invalidate_subdata} | done @extension{ARB,invalidate_subdata} | done
@extension{ARB,multi_draw_indirect} | | @extension{ARB,multi_draw_indirect} | |
@extension{ARB,program_interface_query} | | @extension{ARB,program_interface_query} | |
@extension{ARB,robust_buffer_access_behavior} | done (nothing to do) @extension{ARB,robust_buffer_access_behavior} | done (nothing to do)
@extension{ARB,shader_image_size} | done (shading language only) @extension{ARB,shader_image_size} | done (shading language only)
@extension{ARB,shader_storage_buffer_object} | only limit queries @extension{ARB,shader_storage_buffer_object} | missing (unneeded) block binding
@extension{ARB,stencil_texturing} | done @extension{ARB,stencil_texturing} | done
@extension{ARB,texture_buffer_range} | done @extension{ARB,texture_buffer_range} | done
@extension{ARB,texture_query_levels} | done (shading language only) @extension{ARB,texture_query_levels} | done (shading language only)
@ -205,7 +205,7 @@ GLSL 4.40 | done
@extension{ARB,buffer_storage} | | @extension{ARB,buffer_storage} | |
@extension{ARB,clear_texture} | | @extension{ARB,clear_texture} | |
@extension{ARB,enhanced_layouts} | done (shading language only) @extension{ARB,enhanced_layouts} | done (shading language only)
@extension{ARB,multi_bind} | only texture and buffer binding @extension{ARB,multi_bind} | missing sampler and vertex buffer binding
@extension{ARB,query_buffer_object} | | @extension{ARB,query_buffer_object} | |
@extension{ARB,texture_mirror_clamp_to_edge} | done @extension{ARB,texture_mirror_clamp_to_edge} | done
@extension{ARB,texture_stencil8} | done @extension{ARB,texture_stencil8} | done
@ -216,15 +216,15 @@ GLSL 4.40 | done
Extension | Status Extension | Status
------------------------------------------- | ------ ------------------------------------------- | ------
GLSL 4.50 | done GLSL 4.50 | done
@extension{ARB,ES3_1_compatibility} | | @extension{ARB,ES3_1_compatibility} | done
@extension{ARB,clip_control} | | @extension{ARB,clip_control} | |
@extension{ARB,conditional_render_inverted} | done @extension{ARB,conditional_render_inverted} | done
@extension{ARB,cull_distance} | | @extension{ARB,cull_distance} | |
@extension{ARB,derivative_control} | done (shading language only) @extension{ARB,derivative_control} | done (shading language only)
@extension{ARB,direct_state_access} | done for implemented functionality (except VAOs) @extension{ARB,direct_state_access} | done for implemented functionality (except VAOs)
@extension{ARB,get_texture_sub_image} | missing compressed texture queries @extension{ARB,get_texture_sub_image} | done
@extension{ARB,shader_texture_image_samples} | done (shading language only) @extension{ARB,shader_texture_image_samples} | done (shading language only)
@extension{ARB,texture_barrier} | | @extension{ARB,texture_barrier} | done
@extension{KHR,context_flush_control} | | @extension{KHR,context_flush_control} | |
@extension{KHR,robustness} | | @extension{KHR,robustness} | |
@ -248,6 +248,7 @@ Extension | Status
@extension{ARB,transform_feedback_overflow_query} | | @extension{ARB,transform_feedback_overflow_query} | |
@extension{KHR,blend_equation_advanced} | done @extension{KHR,blend_equation_advanced} | done
@extension3{KHR,blend_equation_advanced_coherent,blend_equation_advanced} | done @extension3{KHR,blend_equation_advanced_coherent,blend_equation_advanced} | done
@extension{KHR,no_error} | done
@subsection opengl-support-extensions-vendor Vendor OpenGL extensions @subsection opengl-support-extensions-vendor Vendor OpenGL extensions
@ -337,7 +338,7 @@ Extension | Status
@es_extension{OES,required_internalformat} | done (desktop-compatible subset) @es_extension{OES,required_internalformat} | done (desktop-compatible subset)
@es_extension{OES,surfaceless_context} | done @es_extension{OES,surfaceless_context} | done
@subsection opengl-support-es-extensions OpenGL ES extensions to match desktop functionality @subsection opengl-support-es-extensions OpenGL ES extensions
@todo @es_extension{NV,non_square_matrices} @todo @es_extension{NV,non_square_matrices}
@todo Support also IMG_multisampled_render_to_texture? It has different enum @todo Support also IMG_multisampled_render_to_texture? It has different enum
@ -347,6 +348,8 @@ Extension | Status
------------------------------------------- | ------ ------------------------------------------- | ------
@es_extension{ANDROID,extension_pack_es31a} | done (nothing to do) @es_extension{ANDROID,extension_pack_es31a} | done (nothing to do)
@es_extension{APPLE,texture_format_BGRA8888} | done @es_extension{APPLE,texture_format_BGRA8888} | done
@es_extension{ARM,shader_framebuffer_fetch} | missing renderer setup and limit query
@es_extension{ARM,shader_framebuffer_fetch_depth_stencil} | done (shading language only)
@es_extension{CHROMIUM,map_sub} (NaCl only) | only buffer mapping @es_extension{CHROMIUM,map_sub} (NaCl only) | only buffer mapping
@es_extension{EXT,texture_filter_anisotropic} | done @es_extension{EXT,texture_filter_anisotropic} | done
@es_extension{EXT,texture_format_BGRA8888} | done @es_extension{EXT,texture_format_BGRA8888} | done
@ -357,6 +360,7 @@ Extension | Status
@es_extension{EXT,separate_shader_objects} | only direct uniform binding @es_extension{EXT,separate_shader_objects} | only direct uniform binding
@es_extension{EXT,multisampled_render_to_texture} | only renderbuffer storage @es_extension{EXT,multisampled_render_to_texture} | only renderbuffer storage
@es_extension{EXT,robustness} | done @es_extension{EXT,robustness} | done
@es_extension{EXT,shader_framebuffer_fetch} | missing limit query
@es_extension{EXT,disjoint_timer_query} | only time elapsed query @es_extension{EXT,disjoint_timer_query} | only time elapsed query
@es_extension{EXT,texture_sRGB_decode} | done @es_extension{EXT,texture_sRGB_decode} | done
@es_extension{EXT,sRGB_write_control} | done @es_extension{EXT,sRGB_write_control} | done
@ -380,6 +384,7 @@ Extension | Status
@es_extension{KHR,robustness} | | @es_extension{KHR,robustness} | |
@es_extension{KHR,robust_buffer_access_behavior} | done (nothing to do) @es_extension{KHR,robust_buffer_access_behavior} | done (nothing to do)
@es_extension{KHR,context_flush_control} | | @es_extension{KHR,context_flush_control} | |
@es_extension2{KHR,no_error,no_error} | done
@es_extension2{NV,read_buffer_front,NV_read_buffer} | done @es_extension2{NV,read_buffer_front,NV_read_buffer} | done
@es_extension2{NV,read_depth,NV_read_depth_stencil} | done @es_extension2{NV,read_depth,NV_read_depth_stencil} | done
@es_extension2{NV,read_stencil,NV_read_depth_stencil} | done @es_extension2{NV,read_stencil,NV_read_depth_stencil} | done

2
doc/opengl-wrapping.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/opengl.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

32
doc/platform.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -182,15 +182,12 @@ MAGNUM_WINDOWLESSAPPLICATION_MAIN(MyApplication)
@section platform-compilation Compilation with CMake @section platform-compilation Compilation with CMake
Barebone compilation consists just of finding Magnum library with required Barebone compilation consists just of finding Magnum library with, for example,
`*Application` component, adding Magnum's `${MAGNUM_INCLUDE_DIRS}` and `Sdl2Application` component, compilation of the executable and linking
application-specific `${MAGNUM_SDL2APPLICATION_INCLUDE_DIRS}` to include path, `Magnum::Magnum` and `Magnum::Sdl2Application` to it.
compilation of the executable and linking `${MAGNUM_LIBRARIES}` and
`${MAGNUM_SDL2APPLICATION_LIBRARIES}` to it.
Again, to simplify porting, you can also use generic `${MAGNUM_APPLICATION_INCLUDE_DIRS}` Again, to simplify porting, you can also use generic `Magnum::Application`
and `${MAGNUM_APPLICATION_LIBRARIES}` aliases (or `${MAGNUM_WINDOWLESSAPPLICATION_INCLUDE_DIRS}`, aliases (or `Magnum::WindowlessApplication` for windowless applications), but
`${MAGNUM_WINDOWLESSAPPLICATION_LIBRARIES}` for windowless applications), but
only if only one application (windowless application) component is requested to only if only one application (windowless application) component is requested to
avoid ambiguity. Changing the build script to use different toolkit is then avoid ambiguity. Changing the build script to use different toolkit is then
matter of replacing only the requested `*Application` component (and one matter of replacing only the requested `*Application` component (and one
@ -199,12 +196,10 @@ matter of replacing only the requested `*Application` component (and one
@code @code
find_package(Magnum REQUIRED Sdl2Application) find_package(Magnum REQUIRED Sdl2Application)
include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_APPLICATION_INCLUDE_DIRS})
add_executable(myapplication MyApplication.cpp) add_executable(myapplication MyApplication.cpp)
target_link_libraries(myapplication target_link_libraries(myapplication
${MAGNUM_LIBRARIES} Magnum::Magnum
${MAGNUM_APPLICATION_LIBRARIES}) Magnum::Application)
@endcode @endcode
@section platform-configuration Specifying configuration @section platform-configuration Specifying configuration
@ -311,20 +306,17 @@ Systems not listed here (such as Emscripten or NaCl) don't need any `Context`
library, because dynamic function pointer loading is not available on these. library, because dynamic function pointer loading is not available on these.
For example, when you create the OpenGL context using GLX, you need to find For example, when you create the OpenGL context using GLX, you need to find
`GlxContext` component, include `${MAGNUM_GLXCONTEXT_INCLUDE_DIRS}` and link to `GlxContext` component, and link to `Magnum::GlxContext` target. Similarly to
`${MAGNUM_GLXCONTEXT_LIBRARIES}`. Similarly to application libraries, you can application libraries, you can also use generic `Magnum::Context` target,
also use generic `${MAGNUM_CONTEXT_INCLUDE_DIRS}` and `${MAGNUM_CONTEXT_LIBRARIES}`,
providing you requested only one `*Context` component in the `find_package()` providing you requested only one `*Context` component in the `find_package()`
call. Complete example: call. Complete example:
@code @code
find_package(Magnum REQUIRED GlxContext) find_package(Magnum REQUIRED GlxContext)
include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_CONTEXT_INCLUDE_DIRS})
add_executable(myapplication MyCustomApplication.cpp) add_executable(myapplication MyCustomApplication.cpp)
target_link_libraries(myapplication target_link_libraries(myapplication
${MAGNUM_LIBRARIES} Magnum::Magnum
${MAGNUM_CONTEXT_LIBRARIES}) Magnum::Context)
@endcode @endcode
- Next page: @ref types - Next page: @ref types

4
doc/plugins.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -182,7 +182,7 @@ and @ref cmake-plugins for additional information.
find_package(Magnum REQUIRED TgaImporter) find_package(Magnum REQUIRED TgaImporter)
add_executable(MyApp ...) add_executable(MyApp ...)
target_link_libraries(MyApp ... ${MAGNUM_TGAIMPORTER_LIBRARIES}) target_link_libraries(MyApp ... Magnum::TgaImporter)
@endcode @endcode
The only user-visible behavioral change will be that The only user-visible behavioral change will be that

8
doc/portability.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -223,12 +223,10 @@ else()
find_package(Magnum REQUIRED XEglApplication) find_package(Magnum REQUIRED XEglApplication)
endif() endif()
include_directories(${MAGNUM_INCLUDE_DIRS} ${MAGNUM_APPLICATION_INCLUDE_DIRS})
add_executable(myapplication MyApplication.cpp) add_executable(myapplication MyApplication.cpp)
target_link_libraries(myapplication target_link_libraries(myapplication
${MAGNUM_LIBRARIES} Magnum::Magnum
${MAGNUM_APPLICATION_LIBRARIES}) Magnum::Application)
@endcode @endcode
*/ */

2
doc/scenegraph.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/shaders.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/shapes.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/tips.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/transformations.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
doc/troubleshooting.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

10
doc/types.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -87,7 +87,8 @@ underlying type.
| @ref Matrix4x3 or @ref Matrix4x3d | `mat4x3` or `dmat4x3` | | @ref Matrix4x3 or @ref Matrix4x3d | `mat4x3` or `dmat4x3` |
Any super- or sub-class of the same size and underlying type can be used Any super- or sub-class of the same size and underlying type can be used
equivalently (e.g. @ref Math::Vector or @ref Color3 instead of @ref Vector3). equivalently (e.g. @ref Math::Vector "Math::Vector<Float>" or @ref Color3
instead of @ref Vector3).
@section types-binary Binary representation @section types-binary Binary representation
@ -116,8 +117,11 @@ usability impact in practice.
These classes are *not* implicitly constructible or convertible from/to These classes are *not* implicitly constructible or convertible from/to
@ref Float or @ref Double, you have to either construct/convert them explicitly @ref Float or @ref Double, you have to either construct/convert them explicitly
or use custom `_degf`/`_deg` and `_radf`/`_rad` literals: or use custom `_degf`/`_deg` and `_radf`/`_rad` literals that are provided in
the @ref Math::Literals namespace:
@code @code
using namespace Math::Literals;
//Deg a = 60.0f // error, no implicit conversion from Float //Deg a = 60.0f // error, no implicit conversion from Float
Deg a = 60.0_degf; // okay Deg a = 60.0_degf; // okay

2
doc/utilities.dox

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
modules/CMakeLists.txt

@ -1,7 +1,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a

521
modules/FindCorrade.cmake

@ -1,131 +1,203 @@
# - Find Corrade #.rst:
# # Find Corrade
# Basic usage: # ------------
# find_package(Corrade [REQUIRED]) #
# This module tries to find Corrade library and then defines: # Finds the Corrade library. Basic usage::
# CORRADE_FOUND - True if Corrade is found #
# CORRADE_INCLUDE_DIRS - Corrade include directories # find_package(Corrade REQUIRED)
# CORRADE_INTERCONNECT_LIBRARIES - Interconnect library and dependent #
# libraries # This module tries to find the base Corrade library and then defines the
# CORRADE_UTILITY_LIBRARIES - Utility library and dependent # following:
# libraries #
# CORRADE_PLUGINMANAGER_LIBRARIES - PluginManager library and dependent # Corrade_FOUND - Whether the base library was found
# libraries # CORRADE_LIB_SUFFIX_MODULE - Path to CorradeLibSuffix.cmake module
# CORRADE_TESTSUITE_LIBRARIES - TestSuite library and dependent #
# libraries # This command will try to find only the base library, not the optional
# CORRADE_RC_EXECUTABLE - Resource compiler executable # components, which are:
# CORRADE_LIB_SUFFIX_MODULE - Path to CorradeLibSuffix.cmake module #
# Containers - Containers library
# PluginManager - PluginManager library
# TestSuite - TestSuite library
# Utility - Utility library
# rc - corrade-rc executable
#
# Example usage with specifying additional components is::
#
# find_package(Corrade REQUIRED Utility TestSuite)
#
# For each component is then defined:
#
# Corrade_*_FOUND - Whether the component was found
# Corrade::* - Component imported target
#
# The package is found if either debug or release version of each library is # The package is found if either debug or release version of each library is
# found. If both debug and release libraries are found, proper version is # found. If both debug and release libraries are found, proper version is
# chosen based on actual build configuration of the project (i.e. Debug build # chosen based on actual build configuration of the project (i.e. Debug build
# is linked to debug libraries, Release build to release libraries). # is linked to debug libraries, Release build to release libraries).
# #
# On multi-configuration build systems (such as Visual Studio or XCode) the # Corrade conditionally defines ``CORRADE_IS_DEBUG_BUILD`` preprocessor
# preprocessor variable CORRADE_IS_DEBUG_BUILD is defined if given build # variable in case build configuration is ``Debug`` (not Corrade itself, but
# configuration is Debug (not Corrade itself, but build configuration of the # build configuration of the project using it). Useful e.g. for selecting
# project using it). Useful e.g. for selecting proper plugin directory. On # proper plugin directory.
# single-configuration build systems (such as Makefiles) this information is #
# not needed and thus the variable is not defined in any case. # Corrade defines the following custom target properties:
# #
# Corrade configures the compiler to use C++11 standard (if it is not already # CORRADE_CXX_STANDARD - C++ standard to require when compiling given
# configured to do so). Additionally you can use CORRADE_CXX_FLAGS to enable # target. Does nothing if :variable:`CMAKE_CXX_FLAGS` already contains
# additional pedantic set of warnings and enable hidden visibility by default. # particular standard setting flag or if given target contains
# :prop_tgt:`CMAKE_CXX_STANDARD` property. Allowed value is 11, 14 or 17.
# INTERFACE_CORRADE_CXX_STANDARD - C++ standard to require when using given
# target. Does nothing if :variable:`CMAKE_CXX_FLAGS` already contains
# particular standard setting flag or if given target contains
# :prop_tgt:`CMAKE_CXX_STANDARD` property. Allowed value is 11, 14 or 17.
# CORRADE_USE_PEDANTIC_FLAGS - Enable additional compiler/linker flags.
# Boolean.
#
# These properties are inherited from directory properties, meaning that if you
# set them on directories, they get implicitly set on all targets in given
# directory (with a possibility to do target-specific overrides). All Corrade
# libraries have the :prop_tgt:`INTERFACE_CORRADE_CXX_STANDARD` property set to
# 11, meaning that you will always have at least C++11 enabled once you link to
# any Corrade library.
# #
# Features of found Corrade library are exposed in these variables: # Features of found Corrade library are exposed in these variables:
# CORRADE_GCC47_COMPATIBILITY - Defined if compiled with compatibility #
# mode for GCC 4.7 # CORRADE_GCC47_COMPATIBILITY - Defined if compiled with compatibility mode
# CORRADE_MSVC2015_COMPATIBILITY - Defined if compiled with compatibility # for GCC 4.7
# CORRADE_MSVC2015_COMPATIBILITY - Defined if compiled with compatibility
# mode for MSVC 2015 # mode for MSVC 2015
# CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated APIs # CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated APIs
# included # included
# CORRADE_BUILD_STATIC - Defined if compiled as static libraries # CORRADE_BUILD_STATIC - Defined if compiled as static libraries.
# Default are shared libraries.
# CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor # CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor
# (Linux, BSD, OS X) # (Linux, BSD, OS X)
# CORRADE_TARGET_APPLE - Defined if compiled for OS X # CORRADE_TARGET_APPLE - Defined if compiled for Apple platforms
# CORRADE_TARGET_IOS - Defined if compiled for iOS
# CORRADE_TARGET_WINDOWS - Defined if compiled for Windows # CORRADE_TARGET_WINDOWS - Defined if compiled for Windows
# CORRADE_TARGET_WINDOWS_RT - Defined if compiled for Windows RT # CORRADE_TARGET_WINDOWS_RT - Defined if compiled for Windows RT
# CORRADE_TARGET_NACL - Defined if compiled for Google Chrome # CORRADE_TARGET_NACL - Defined if compiled for Google Chrome Native
# Native Client # Client
# CORRADE_TARGET_NACL_NEWLIB - Defined if compiled for Google Chrome # CORRADE_TARGET_NACL_NEWLIB - Defined if compiled for Google Chrome Native
# Native Client with `newlib` toolchain # Client with `newlib` toolchain
# CORRADE_TARGET_NACL_GLIBC - Defined if compiled for Google Chrome # CORRADE_TARGET_NACL_GLIBC - Defined if compiled for Google Chrome Native
# Native Client with `glibc` toolchain # Client with `glibc` toolchain
# CORRADE_TARGET_EMSCRIPTEN - Defined if compiled for Emscripten # CORRADE_TARGET_EMSCRIPTEN - Defined if compiled for Emscripten
# CORRADE_TARGET_ANDROID - Defined if compiled for Android # CORRADE_TARGET_ANDROID - Defined if compiled for Android
# CORRADE_TESTSUITE_TARGET_XCTEST - Defined if TestSuite is targetting Xcode
# XCTest
# CORRADE_UTILITY_USE_ANSI_COLORS - Defined if ANSI escape sequences are used
# for colored output with Utility::Debug on Windows
#
# Additionally these variables are defined for internal usage:
#
# CORRADE_INCLUDE_DIR - Root include dir
# CORRADE_*_LIBRARY_DEBUG - Debug version of given library, if found
# CORRADE_*_LIBRARY_RELEASE - Release version of given library, if found
# CORRADE_USE_MODULE - Path to UseCorrade.cmake module (included
# automatically)
# CORRADE_TESTSUITE_XCTEST_RUNNER - Path to XCTestRunner.mm.in file
# CORRADE_PEDANTIC_COMPILER_OPTIONS - List of pedantic compiler options used
# for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` enabled
# CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler
# definitions used for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS`
# enabled
#
# Workflows without :prop_tgt:`IMPORTED` targets are deprecated and the
# following variables are included just for backwards compatibility and only if
# :variable:`CORRADE_BUILD_DEPRECATED` is enabled:
#
# CORRADE_*_LIBRARIES - Expands to ``Corrade::*`` target. Use
# ``Corrade::*`` target directly instead.
# CORRADE_CXX_FLAGS - Pedantic compile flags. Use
# :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` property instead.
# #
# Corrade provides these macros and functions: # Corrade provides these macros and functions:
# #
# .. command:: corrade_add_test
#
# Add unit test using Corrade's TestSuite::
#
# corrade_add_test(<test name>
# <sources>...
# [LIBRARIES <libraries>...])
# #
# Add unit test using Corrade's TestSuite.
# corrade_add_test(test_name
# sources...
# [LIBRARIES libraries...])
# Test name is also executable name. You can also specify libraries to link # Test name is also executable name. You can also specify libraries to link
# with instead of using target_link_libraries(). CORRADE_TESTSUITE_LIBRARIES # with instead of using :command:`target_link_libraries()`.
# are linked automatically to each test. Note that the enable_testing() # ``Corrade::TestSuite`` target is linked automatically to each test. Note
# function must be called explicitly. # that the :command:`enable_testing()` function must be called explicitly.
#
# Unless :variable:`CORRADE_TESTSUITE_TARGET_XCTEST` is set, test cases on iOS
# targets are created as bundles with bundle identifier set to CMake project
# name by default. Use the cache variable :variable:`CORRADE_TESTSUITE_BUNDLE_IDENTIFIER_PREFIX`
# to change it to something else.
#
# .. command:: corrade_add_resource
# #
# Compile data resources into application binary::
# #
# Compile data resources into application binary. # corrade_add_resource(<name> <resources.conf>)
# corrade_add_resource(name resources.conf) #
# Depends on corrade-rc, which is part of Corrade utilities. This command # Depends on ``Corrade::rc``, which is part of Corrade utilities. This command
# generates resource data using given configuration file in current build # generates resource data using given configuration file in current build
# directory. Argument name is name under which the resources can be explicitly # directory. Argument name is name under which the resources can be explicitly
# loaded. Variable `name` contains compiled resource filename, which is then # loaded. Variable ``<name>`` contains compiled resource filename, which is
# used for compiling library / executable. Example usage: # then used for compiling library / executable. Example usage::
#
# corrade_add_resource(app_resources resources.conf) # corrade_add_resource(app_resources resources.conf)
# add_executable(app source1 source2 ... ${app_resources}) # add_executable(app source1 source2 ... ${app_resources})
# #
# Add dynamic plugin. # .. command:: corrade_add_plugin
# corrade_add_plugin(plugin_name debug_install_dir release_install_dir
# metadata_file sources...)
# The macro adds preprocessor directive CORRADE_DYNAMIC_PLUGIN. Additional
# libraries can be linked in via target_link_libraries(plugin_name ...). If
# debug_install_dir is set to CMAKE_CURRENT_BINARY_DIR (e.g. for testing
# purposes), the files are copied directly, without the need to perform install
# step. Note that the files are actually put into configuration-based
# subdirectory, i.e. ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}. See
# documentation of CMAKE_CFG_INTDIR variable for more information.
# #
# Add dynamic plugin::
# #
# Add static plugin. # corrade_add_plugin(<plugin name>
# corrade_add_static_plugin(plugin_name install_dir metadata_file # <debug install dir> <release install dir>
# sources...) # <metadata file>
# The macro adds preprocessor directive CORRADE_STATIC_PLUGIN. Additional # <sources>...)
# libraries can be linked in via target_link_libraries(plugin_name ...). If
# install_dir is set to CMAKE_CURRENT_BINARY_DIR (e.g. for testing purposes),
# no installation rules are added.
# #
# Note that plugins built in debug configuration (e.g. with CMAKE_BUILD_TYPE # The macro adds preprocessor directive ``CORRADE_DYNAMIC_PLUGIN``. Additional
# set to Debug) have "-d" suffix to make it possible to have both debug and # libraries can be linked in via :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`.
# release plugins installed alongside each other. # If ``<debug install dir>`` is set to :variable:`CMAKE_CURRENT_BINARY_DIR`
# (e.g. for testing purposes), the files are copied directly, without the need
# to perform install step. Note that the files are actually put into
# configuration-based subdirectory, i.e. ``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}``.
# See documentation of :variable:`CMAKE_CFG_INTDIR` variable for more
# information.
# #
# .. command:: corrade_add_static_plugin
# #
# Find corresponding DLLs for library files. # Add static plugin::
# corrade_find_dlls_for_libs(<VAR> libs...)
# Available only on Windows, for all *.lib files tries to find corresponding
# DLL file. Useful for bundling dependencies for e.g. WinRT packages.
# #
# corrade_add_static_plugin(<plugin name>
# <install dir>
# <metadata file>
# <sources>...)
# #
# Additionally these variables are defined for internal usage: # The macro adds preprocessor directive ``CORRADE_STATIC_PLUGIN``. Additional
# CORRADE_INCLUDE_DIR - Root include dir # libraries can be linked in via :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`.
# CORRADE_INTERCONNECT_LIBRARY - Interconnect library (w/o # If ``<install dir>`` is set to :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for
# dependencies) # testing purposes), no installation rules are added.
# CORRADE_UTILITY_LIBRARY - Utility library (w/o dependencies) #
# CORRADE_PLUGINMANAGER_LIBRARY - Plugin manager library (w/o # Note that plugins built in debug configuration (e.g. with :variable:`CMAKE_BUILD_TYPE`
# dependencies) # set to ``Debug``) have ``"-d"`` suffix to make it possible to have both debug
# CORRADE_TESTSUITE_LIBRARY - TestSuite library (w/o dependencies) # and release plugins installed alongside each other.
# CORRADE_*_LIBRARY_DEBUG - Debug version of given library, if found #
# CORRADE_*_LIBRARY_RELEASE - Release version of given library, if # .. command:: corrade_find_dlls_for_libs
# found #
# CORRADE_USE_MODULE - Path to UseCorrade.cmake module (included # Find corresponding DLLs for library files::
# automatically) #
# corrade_find_dlls_for_libs(<output variable> <libs>...)
#
# Available only on Windows, for all ``*.lib`` files tries to find
# corresponding DLL file. Useful for bundling dependencies for e.g. WinRT
# packages.
# #
# #
# This file is part of Corrade. # This file is part of Corrade.
# #
# Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -147,62 +219,26 @@
# DEALINGS IN THE SOFTWARE. # DEALINGS IN THE SOFTWARE.
# #
# Libraries # Root include dir
foreach(_component Interconnect Utility PluginManager TestSuite)
string(TOUPPER ${_component} _COMPONENT)
# Try to find both debug and release version
find_library(CORRADE_${_COMPONENT}_LIBRARY_DEBUG Corrade${_component}-d)
find_library(CORRADE_${_COMPONENT}_LIBRARY_RELEASE Corrade${_component})
# Set the _LIBRARY variable based on what was found
if(CORRADE_${_COMPONENT}_LIBRARY_DEBUG AND CORRADE_${_COMPONENT}_LIBRARY_RELEASE)
set(CORRADE_${_COMPONENT}_LIBRARY
debug ${CORRADE_${_COMPONENT}_LIBRARY_DEBUG}
optimized ${CORRADE_${_COMPONENT}_LIBRARY_RELEASE})
elseif(CORRADE_${_COMPONENT}_LIBRARY_DEBUG)
set(CORRADE_${_COMPONENT}_LIBRARY ${CORRADE_${_COMPONENT}_LIBRARY_DEBUG})
elseif(CORRADE_${_COMPONENT}_LIBRARY_RELEASE)
set(CORRADE_${_COMPONENT}_LIBRARY ${CORRADE_${_COMPONENT}_LIBRARY_RELEASE})
endif()
mark_as_advanced(CORRADE_${_COMPONENT}_LIBRARY_DEBUG
CORRADE_${_COMPONENT}_LIBRARY_RELEASE
CORRADE_${_COMPONENT}_LIBRARY)
endforeach()
# RC executable
find_program(CORRADE_RC_EXECUTABLE corrade-rc)
# Include dir
find_path(CORRADE_INCLUDE_DIR find_path(CORRADE_INCLUDE_DIR
NAMES Corrade/PluginManager Corrade/Utility) NAMES Corrade/Corrade.h)
mark_as_advanced(CORRADE_INCLUDE_DIR)
# CMake module dir
find_path(_CORRADE_MODULE_DIR
NAMES UseCorrade.cmake CorradeLibSuffix.cmake
PATH_SUFFIXES share/cmake/Corrade)
# Configuration file # Configuration file
find_file(_CORRADE_CONFIGURE_FILE configure.h find_file(_CORRADE_CONFIGURE_FILE configure.h
HINTS ${CORRADE_INCLUDE_DIR}/Corrade/) HINTS ${CORRADE_INCLUDE_DIR}/Corrade/)
mark_as_advanced(_CORRADE_CONFIGURE_FILE)
include(FindPackageHandleStandardArgs) # We need to open configure.h file from CORRADE_INCLUDE_DIR before we check for
find_package_handle_standard_args(Corrade DEFAULT_MSG # the components. Bail out with proper error message if it wasn't found. The
CORRADE_UTILITY_LIBRARY # complete check with all components is further below.
CORRADE_INTERCONNECT_LIBRARY if(NOT CORRADE_INCLUDE_DIR)
CORRADE_PLUGINMANAGER_LIBRARY include(FindPackageHandleStandardArgs)
CORRADE_TESTSUITE_LIBRARY find_package_handle_standard_args(Corrade
CORRADE_INCLUDE_DIR REQUIRED_VARS CORRADE_INCLUDE_DIR _CORRADE_CONFIGURE_FILE)
CORRADE_RC_EXECUTABLE
_CORRADE_MODULE_DIR
_CORRADE_CONFIGURE_FILE)
if(NOT CORRADE_FOUND)
return()
endif() endif()
# Read flags from fonfiguration # Read flags from configuration
file(READ ${_CORRADE_CONFIGURE_FILE} _corradeConfigure) file(READ ${_CORRADE_CONFIGURE_FILE} _corradeConfigure)
set(_corradeFlags set(_corradeFlags
GCC47_COMPATIBILITY GCC47_COMPATIBILITY
@ -211,13 +247,16 @@ set(_corradeFlags
BUILD_STATIC BUILD_STATIC
TARGET_UNIX TARGET_UNIX
TARGET_APPLE TARGET_APPLE
TARGET_IOS
TARGET_WINDOWS TARGET_WINDOWS
TARGET_WINDOWS_RT TARGET_WINDOWS_RT
TARGET_NACL TARGET_NACL
TARGET_NACL_NEWLIB TARGET_NACL_NEWLIB
TARGET_NACL_GLIBC TARGET_NACL_GLIBC
TARGET_EMSCRIPTEN TARGET_EMSCRIPTEN
TARGET_ANDROID) TARGET_ANDROID
TESTSUITE_TARGET_XCTEST
UTILITY_USE_ANSI_COLORS)
foreach(_corradeFlag ${_corradeFlags}) foreach(_corradeFlag ${_corradeFlags})
string(FIND "${_corradeConfigure}" "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag}) string(FIND "${_corradeConfigure}" "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag})
if(NOT _corrade_${_corradeFlag} EQUAL -1) if(NOT _corrade_${_corradeFlag} EQUAL -1)
@ -225,34 +264,202 @@ foreach(_corradeFlag ${_corradeFlags})
endif() endif()
endforeach() endforeach()
set(CORRADE_INCLUDE_DIRS ${CORRADE_INCLUDE_DIR}) # XCTest runner file
set(CORRADE_UTILITY_LIBRARIES ${CORRADE_UTILITY_LIBRARY}) if(CORRADE_TESTSUITE_TARGET_XCTEST)
set(CORRADE_INTERCONNECT_LIBRARIES ${CORRADE_INTERCONNECT_LIBRARY} ${CORRADE_UTILITY_LIBRARIES}) find_file(CORRADE_TESTSUITE_XCTEST_RUNNER XCTestRunner.mm.in
set(CORRADE_PLUGINMANAGER_LIBRARIES ${CORRADE_PLUGINMANAGER_LIBRARY} ${CORRADE_UTILITY_LIBRARIES}) PATH_SUFFIXES share/corrade/TestSuite)
set(CORRADE_TESTSUITE_LIBRARIES ${CORRADE_TESTSUITE_LIBRARY} ${CORRADE_UTILITY_LIBRARIES}) set(CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED CORRADE_TESTSUITE_XCTEST_RUNNER)
endif()
# CMake module dir
find_path(_CORRADE_MODULE_DIR
NAMES UseCorrade.cmake CorradeLibSuffix.cmake
PATH_SUFFIXES share/cmake/Corrade)
mark_as_advanced(_CORRADE_MODULE_DIR)
set(CORRADE_USE_MODULE ${_CORRADE_MODULE_DIR}/UseCorrade.cmake) set(CORRADE_USE_MODULE ${_CORRADE_MODULE_DIR}/UseCorrade.cmake)
set(CORRADE_LIB_SUFFIX_MODULE ${_CORRADE_MODULE_DIR}/CorradeLibSuffix.cmake) set(CORRADE_LIB_SUFFIX_MODULE ${_CORRADE_MODULE_DIR}/CorradeLibSuffix.cmake)
# If the configure file is somewhere else than in root include dir (e.g. when # Ensure that all inter-component dependencies are specified as well
# using CMake subproject), we need to include that dir too foreach(_component ${Corrade_FIND_COMPONENTS})
if(NOT ${CORRADE_INCLUDE_DIR}/Corrade/configure.h STREQUAL ${_CORRADE_CONFIGURE_FILE}) string(TOUPPER ${_component} _COMPONENT)
# Go two levels up
get_filename_component(_CORRADE_CONFIGURE_FILE_INCLUDE_DIR ${_CORRADE_CONFIGURE_FILE} DIRECTORY)
get_filename_component(_CORRADE_CONFIGURE_FILE_INCLUDE_DIR ${_CORRADE_CONFIGURE_FILE_INCLUDE_DIR} DIRECTORY)
list(APPEND CORRADE_INCLUDE_DIRS ${_CORRADE_CONFIGURE_FILE_INCLUDE_DIR})
endif()
# At least static build needs this if(_component STREQUAL Containers)
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_NACL_GLIBC) set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility)
set(CORRADE_PLUGINMANAGER_LIBRARIES ${CORRADE_PLUGINMANAGER_LIBRARIES} ${CMAKE_DL_LIBS}) elseif(_component STREQUAL Interconnect)
endif() set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility)
elseif(_component STREQUAL PluginManager)
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers Utility rc)
elseif(_component STREQUAL TestSuite)
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Utility)
elseif(_component STREQUAL Utility)
set(_CORRADE_${_COMPONENT}_DEPENDENCIES Containers rc)
endif()
# Mark the dependencies as required if the component is also required
if(Corrade_FIND_REQUIRED_${_component})
foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES})
set(Corrade_FIND_REQUIRED_${_dependency} TRUE)
endforeach()
endif()
# AndroidLogStreamBuffer class needs to be linked to log library list(APPEND _CORRADE_ADDITIONAL_COMPONENTS ${_CORRADE_${_COMPONENT}_DEPENDENCIES})
if(CORRADE_TARGET_ANDROID) endforeach()
set(CORRADE_UTILITY_LIBRARIES ${CORRADE_UTILITY_LIBRARIES} log)
# Join the lists, remove duplicate components
if(_CORRADE_ADDITIONAL_COMPONENTS)
list(INSERT Corrade_FIND_COMPONENTS 0 ${_CORRADE_ADDITIONAL_COMPONENTS})
endif()
if(Corrade_FIND_COMPONENTS)
list(REMOVE_DUPLICATES Corrade_FIND_COMPONENTS)
endif() endif()
mark_as_advanced(_CORRADE_CONFIGURE_FILE _CORRADE_MODULE_DIR) # Component distinction
set(_CORRADE_LIBRARY_COMPONENTS "^(Containers|Interconnect|PluginManager|TestSuite|Utility)$")
set(_CORRADE_HEADER_ONLY_COMPONENTS "^(Containers)$")
set(_CORRADE_EXECUTABLE_COMPONENTS "^(rc)$")
# Find all components
foreach(_component ${Corrade_FIND_COMPONENTS})
string(TOUPPER ${_component} _COMPONENT)
# Create imported target in case the library is found. If the project is
# added as subproject to CMake, the target already exists and all the
# required setup is already done from the build tree.
if(TARGET Corrade::${_component})
set(Corrade_${_component}_FOUND TRUE)
else()
# Library components
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS})
add_library(Corrade::${_component} UNKNOWN IMPORTED)
# Try to find both debug and release version
find_library(CORRADE_${_COMPONENT}_LIBRARY_DEBUG Corrade${_component}-d)
find_library(CORRADE_${_COMPONENT}_LIBRARY_RELEASE Corrade${_component})
mark_as_advanced(CORRADE_${_COMPONENT}_LIBRARY_DEBUG
CORRADE_${_COMPONENT}_LIBRARY_RELEASE)
if(CORRADE_${_COMPONENT}_LIBRARY_RELEASE)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELEASE)
set_property(TARGET Corrade::${_component} PROPERTY
IMPORTED_LOCATION_RELEASE ${CORRADE_${_COMPONENT}_LIBRARY_RELEASE})
endif()
if(CORRADE_${_COMPONENT}_LIBRARY_DEBUG)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
IMPORTED_CONFIGURATIONS DEBUG)
set_property(TARGET Corrade::${_component} PROPERTY
IMPORTED_LOCATION_DEBUG ${CORRADE_${_COMPONENT}_LIBRARY_DEBUG})
endif()
endif()
# Header-only library components (CMake >= 3.0)
if(_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS} AND NOT CMAKE_VERSION VERSION_LESS 3.0.0)
add_library(Corrade::${_component} INTERFACE IMPORTED)
endif()
# Executable components
if(_component MATCHES ${_CORRADE_EXECUTABLE_COMPONENTS})
add_executable(Corrade::${_component} IMPORTED)
find_program(CORRADE_${_COMPONENT}_EXECUTABLE corrade-${_component})
mark_as_advanced(CORRADE_${_COMPONENT}_EXECUTABLE)
if(CORRADE_${_COMPONENT}_EXECUTABLE)
set_property(TARGET Corrade::${_component} PROPERTY
IMPORTED_LOCATION ${CORRADE_${_COMPONENT}_EXECUTABLE})
endif()
endif()
# No special setup for Containers library
# No special setup for Interconnect library
# PluginManager library
if(_component STREQUAL PluginManager)
# At least static build needs this
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_NACL_GLIBC)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
endif()
# No special setup for TestSuite library
# Utility library (contains all setup that is used by others)
elseif(_component STREQUAL Utility)
# Top-level include directory
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${CORRADE_INCLUDE_DIR})
# Require (at least) C++11 for users
if(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_CORRADE_CXX_STANDARD 11)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
COMPATIBLE_INTERFACE_NUMBER_MAX CORRADE_CXX_STANDARD)
else()
# 2.8.12 is fucking buggy shit. Besides the fact that it
# doesn't know COMPATIBLE_INTERFACE_NUMBER_MAX, if I
# define_property() so I can inherit it from directory on a
# target, then I can't use it in COMPATIBLE_INTERFACE_STRING
# to inherit it from interfaces BECAUSE!! it thinks that it is
# not an user-defined property anymore. So I need to have two
# sets of properties, CORRADE_CXX_STANDARD_ used silently for
# inheritance from interfaces and CORRADE_CXX_STANDARD used
# publicly for inheritance from directories. AAAAAAAAARGH.
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_CORRADE_CXX_STANDARD_ 11)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING CORRADE_CXX_STANDARD_)
endif()
# AndroidLogStreamBuffer class needs to be linked to log library
if(CORRADE_TARGET_ANDROID)
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES "log")
endif()
endif()
# Find library includes
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS})
find_path(_CORRADE_${_COMPONENT}_INCLUDE_DIR
NAMES ${_component}.h
HINTS ${CORRADE_INCLUDE_DIR}/Corrade/${_component})
mark_as_advanced(_CORRADE_${_COMPONENT}_INCLUDE_DIR)
endif()
# Add inter-library dependencies (except for the header-only libraries
# on 2.8.12)
if(_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND (NOT CMAKE_VERSION VERSION_LESS 3.0.0 OR NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}))
foreach(_dependency ${_CORRADE_${_COMPONENT}_DEPENDENCIES})
if(_dependency MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND (NOT CMAKE_VERSION VERSION_LESS 3.0.0 OR NOT _dependency MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS}))
set_property(TARGET Corrade::${_component} APPEND PROPERTY
INTERFACE_LINK_LIBRARIES Corrade::${_dependency})
endif()
endforeach()
endif()
# Decide if the component was found
if((_component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (_component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS} OR CORRADE_${_COMPONENT}_LIBRARY_RELEASE OR CORRADE_${_COMPONENT}_LIBRARY_DEBUG)) OR (_component MATCHES ${_CORRADE_EXECUTABLE_COMPONENTS} AND CORRADE_${_COMPONENT}_EXECUTABLE))
set(Corrade_${_component}_FOUND TRUE)
else()
set(Corrade_${_component}_FOUND FALSE)
endif()
endif()
# Deprecated variables
if(CORRADE_BUILD_DEPRECATED AND _component MATCHES ${_CORRADE_LIBRARY_COMPONENTS} AND NOT _component MATCHES ${_CORRADE_HEADER_ONLY_COMPONENTS})
set(CORRADE_${_COMPONENT}_LIBRARIES Corrade::${_component})
endif()
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Corrade REQUIRED_VARS
CORRADE_INCLUDE_DIR
_CORRADE_MODULE_DIR
_CORRADE_CONFIGURE_FILE
${CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED}
HANDLE_COMPONENTS)
# Finalize the finding process # Finalize the finding process
include(${CORRADE_USE_MODULE}) include(${CORRADE_USE_MODULE})

45
modules/FindEGL.cmake

@ -1,8 +1,14 @@
# - Find EGL #.rst:
# Find EGL
# --------
# #
# This module defines: # Finds the EGL library. This module defines:
# #
# EGL_FOUND - True if EGL library is found # EGL_FOUND - True if EGL library is found
# EGL::EGL - EGL imported target
#
# Additionally these variables are defined for internal usage:
#
# EGL_LIBRARY - EGL library # EGL_LIBRARY - EGL library
# EGL_INCLUDE_DIR - Include dir # EGL_INCLUDE_DIR - Include dir
# #
@ -10,7 +16,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -35,13 +41,38 @@
# Library # Library
find_library(EGL_LIBRARY NAMES find_library(EGL_LIBRARY NAMES
EGL EGL
libEGL) # ANGLE (CMake doesn't search for lib prefix on Windows)
# ANGLE (CMake doesn't search for lib prefix on Windows)
libEGL
# On iOS a part of OpenGLES
OpenGLES)
# Include dir # Include dir
find_path(EGL_INCLUDE_DIR find_path(EGL_INCLUDE_DIR NAMES
NAMES EGL/egl.h) EGL/egl.h
# iOS
EAGL.h)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("EGL" DEFAULT_MSG find_package_handle_standard_args(EGL DEFAULT_MSG
EGL_LIBRARY EGL_LIBRARY
EGL_INCLUDE_DIR) EGL_INCLUDE_DIR)
if(NOT TARGET EGL::EGL)
# Work around BUGGY framework support on OSX
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html
if(APPLE AND ${EGL_LIBRARY} MATCHES "\\.framework$")
add_library(EGL::EGL INTERFACE IMPORTED)
set_property(TARGET EGL::EGL APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${EGL_LIBRARY})
else()
add_library(EGL::EGL UNKNOWN IMPORTED)
set_property(TARGET EGL::EGL PROPERTY
IMPORTED_LOCATION ${EGL_LIBRARY})
endif()
set_target_properties(EGL::EGL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${EGL_INCLUDE_DIR})
endif()

67
modules/FindGLFW.cmake

@ -0,0 +1,67 @@
#.rst:
# Find GLFW
# ---------
#
# Finds the GLFW library. This module defines:
#
# GLFW_FOUND - True if GLFW library is found
# GLFW::GLFW - GLFW imported target
#
# Additionally these variables are defined for internal usage:
#
# GLFW_LIBRARY - GLFW library
# GLFW_INCLUDE_DIR - Root include dir
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz>
# Copyright © 2016 Jonathan Hale <squareys@googlemail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# 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 OR COPYRIGHT HOLDERS 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.
#
find_library(GLFW_LIBRARY NAMES glfw glfw3)
# Include dir
find_path(GLFW_INCLUDE_DIR
NAMES glfw3.h
PATH_SUFFIXES GLFW)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("GLFW" DEFAULT_MSG
GLFW_LIBRARY
GLFW_INCLUDE_DIR)
if(NOT TARGET GLFW::GLFW)
add_library(GLFW::GLFW UNKNOWN IMPORTED)
# Work around BUGGY framework support on OSX
# https://cmake.org/Bug/view.php?id=14105
if(CORRADE_TARGET_APPLE AND ${GLFW_LIBRARY} MATCHES "\\.framework$")
set_property(TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${GLFW_LIBRARY}/GLFW)
else()
set_property(TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${GLFW_LIBRARY})
endif()
set_property(TARGET GLFW::GLFW PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${GLFW_INCLUDE_DIR})
endif()

969
modules/FindMagnum.cmake

File diff suppressed because it is too large Load Diff

15
modules/FindNodeJs.cmake

@ -1,15 +1,17 @@
# - Find Node.js #.rst:
# Find Node.js
# ------------
# #
# This module defines: # Finds the Node.js executable. This module defines:
# #
# NODEJS_FOUND - True if Node.js executable is found # NODEJS_FOUND - True if Node.js executable is found
# NODEJS_EXECUTABLE - Node.js executable # NodeJs::NodeJs - Node.js executable imported target
# #
# #
# This file is part of Corrade. # This file is part of Corrade.
# #
# Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013 # Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -35,3 +37,8 @@ find_program(NODEJS_EXECUTABLE node)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("NodeJs" DEFAULT_MSG NODEJS_EXECUTABLE) find_package_handle_standard_args("NodeJs" DEFAULT_MSG NODEJS_EXECUTABLE)
if(NOT TARGET NodeJs::NodeJs)
add_executable(NodeJs::NodeJs IMPORTED)
set_property(TARGET NodeJs::NodeJs PROPERTY IMPORTED_LOCATION ${NODEJS_EXECUTABLE})
endif()

58
modules/FindOpenGLES2.cmake

@ -1,8 +1,14 @@
# - Find OpenGL ES 2 #.rst:
# Find OpenGL ES 2
# ----------------
# #
# This module defines: # Finds the OpenGL ES 2 library. This module defines:
#
# OpenGLES2_FOUND - True if OpenGL ES 2 library is found
# OpenGLES2::OpenGLES2 - OpenGL ES 2 imported target
#
# Additionally these variables are defined for internal usage:
# #
# OPENGLES2_FOUND - True if OpenGL ES 2 library is found
# OPENGLES2_LIBRARY - OpenGL ES 2 library # OPENGLES2_LIBRARY - OpenGL ES 2 library
# OPENGLES2_INCLUDE_DIR - Include dir # OPENGLES2_INCLUDE_DIR - Include dir
# #
@ -10,7 +16,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -37,16 +43,50 @@
if(NOT CORRADE_TARGET_EMSCRIPTEN) if(NOT CORRADE_TARGET_EMSCRIPTEN)
find_library(OPENGLES2_LIBRARY NAMES find_library(OPENGLES2_LIBRARY NAMES
GLESv2 GLESv2
libGLESv2 # ANGLE (CMake doesn't search for lib prefix on Windows)
ppapi_gles2) # NaCl # ANGLE (CMake doesn't search for lib prefix on Windows)
libGLESv2
# iOS
OpenGLES
# NaCl
ppapi_gles2)
set(OPENGLES2_LIBRARY_NEEDED OPENGLES2_LIBRARY) set(OPENGLES2_LIBRARY_NEEDED OPENGLES2_LIBRARY)
endif() endif()
# Include dir # Include dir
find_path(OPENGLES2_INCLUDE_DIR find_path(OPENGLES2_INCLUDE_DIR NAMES
NAMES GLES2/gl2.h) GLES2/gl2.h
# iOS
ES2/gl.h)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("OpenGLES2" DEFAULT_MSG find_package_handle_standard_args(OpenGLES2 DEFAULT_MSG
${OPENGLES2_LIBRARY_NEEDED} ${OPENGLES2_LIBRARY_NEEDED}
OPENGLES2_INCLUDE_DIR) OPENGLES2_INCLUDE_DIR)
if(NOT TARGET OpenGLES2::OpenGLES2)
if(OPENGLES2_LIBRARY_NEEDED)
# Work around BUGGY framework support on OSX
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html
if(CORRADE_TARGET_APPLE AND ${OPENGLES2_LIBRARY} MATCHES "\\.framework$")
add_library(OpenGLES2::OpenGLES2 INTERFACE IMPORTED)
set_property(TARGET OpenGLES2::OpenGLES2 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${OPENGLES2_LIBRARY})
else()
add_library(OpenGLES2::OpenGLES2 UNKNOWN IMPORTED)
set_property(TARGET OpenGLES2::OpenGLES2 PROPERTY
IMPORTED_LOCATION ${OPENGLES2_LIBRARY})
endif()
else()
# This won't work in CMake 2.8.12, but that affects Emscripten only so
# I assume people building for that are not on that crap old Ubuntu
# 14.04 LTS
add_library(OpenGLES2::OpenGLES2 INTERFACE IMPORTED)
endif()
set_property(TARGET OpenGLES2::OpenGLES2 PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${OPENGLES2_INCLUDE_DIR})
endif()

51
modules/FindOpenGLES3.cmake

@ -1,8 +1,14 @@
# - Find OpenGL ES 3 #.rst:
# Find OpenGL ES 3
# ----------------
# #
# This module defines: # Finds the OpenGL ES 3 library. This module defines:
#
# OpenGLES3_FOUND - True if OpenGL ES 3 library is found
# OpenGLES3::OpenGLES3 - OpenGL ES 3 imported target
#
# Additionally these variables are defined for internal usage:
# #
# OPENGLES3_FOUND - True if OpenGL ES 3 library is found
# OPENGLES3_LIBRARY - OpenGL ES 3 library # OPENGLES3_LIBRARY - OpenGL ES 3 library
# OPENGLES3_INCLUDE_DIR - Include dir # OPENGLES3_INCLUDE_DIR - Include dir
# #
@ -10,7 +16,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -42,15 +48,46 @@ if(NOT CORRADE_TARGET_EMSCRIPTEN)
# support is provided in ES2 lib # support is provided in ES2 lib
GLESv2 GLESv2
libGLESv2) # ANGLE (CMake doesn't search for lib prefix on Windows) # ANGLE (CMake doesn't search for lib prefix on Windows)
libGLESv2
# iOS
OpenGLES)
set(OPENGLES3_LIBRARY_NEEDED OPENGLES3_LIBRARY) set(OPENGLES3_LIBRARY_NEEDED OPENGLES3_LIBRARY)
endif() endif()
# Include dir # Include dir
find_path(OPENGLES3_INCLUDE_DIR find_path(OPENGLES3_INCLUDE_DIR NAMES
NAMES GLES3/gl3.h) GLES3/gl3.h
# iOS
ES3/gl.h)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("OpenGLES3" DEFAULT_MSG find_package_handle_standard_args("OpenGLES3" DEFAULT_MSG
${OPENGLES3_LIBRARY_NEEDED} ${OPENGLES3_LIBRARY_NEEDED}
OPENGLES3_INCLUDE_DIR) OPENGLES3_INCLUDE_DIR)
if(NOT TARGET OpenGLES3::OpenGLES3)
if(OPENGLES3_LIBRARY_NEEDED)
# Work around BUGGY framework support on OSX
# http://public.kitware.com/pipermail/cmake/2016-April/063179.html
if(CORRADE_TARGET_APPLE AND ${OPENGLES3_LIBRARY} MATCHES "\\.framework$")
add_library(OpenGLES3::OpenGLES3 INTERFACE IMPORTED)
set_property(TARGET OpenGLES3::OpenGLES3 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${OPENGLES3_LIBRARY})
else()
add_library(OpenGLES3::OpenGLES3 UNKNOWN IMPORTED)
set_property(TARGET OpenGLES3::OpenGLES3 PROPERTY
IMPORTED_LOCATION ${OPENGLES3_LIBRARY})
endif()
else()
# This won't work in CMake 2.8.12, but that affects Emscripten only so
# I assume people building for that are not on that crap old Ubuntu
# 14.04 LTS
add_library(OpenGLES3::OpenGLES3 INTERFACE IMPORTED)
endif()
set_property(TARGET OpenGLES3::OpenGLES3 PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${OPENGLES3_INCLUDE_DIR})
endif()

70
modules/FindSDL2.cmake

@ -1,16 +1,22 @@
# - Find SDL2 #.rst:
# Find SDL2
# ---------
# #
# This module defines: # Finds the SDL2 library. This module defines:
# #
# SDL2_FOUND - True if SDL2 library is found # SDL2_FOUND - True if SDL2 library is found
# SDL2_LIBRARY - SDL2 dynamic library # SDL2::SDL2 - SDL2 imported target
# SDL2_INCLUDE_DIR - Include dir #
# Additionally these variables are defined for internal usage:
#
# SDL2_LIBRARY - SDL2 library
# SDL2_INCLUDE_DIR - Root include dir
# #
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -61,7 +67,61 @@ find_path(SDL2_INCLUDE_DIR
NAMES SDL_scancode.h NAMES SDL_scancode.h
PATH_SUFFIXES ${_SDL2_PATH_SUFFIXES}) PATH_SUFFIXES ${_SDL2_PATH_SUFFIXES})
# iOS dependencies
if(CORRADE_TARGET_IOS)
set(_SDL2_FRAMEWORKS
AudioToolbox
CoreGraphics
CoreMotion
Foundation
GameController
QuartzCore
UIKit)
set(_SDL2_FRAMEWORK_LIBRARIES )
foreach(framework ${_SDL2_FRAMEWORKS})
find_library(_SDL2_${framework}_LIBRARY ${framework})
list(APPEND _SDL2_FRAMEWORK_LIBRARIES ${_SDL2_${framework}_LIBRARY})
list(APPEND _SDL2_FRAMEWORK_LIBRARY_NAMES _SDL2_${framework}_LIBRARY)
endforeach()
endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("SDL2" DEFAULT_MSG find_package_handle_standard_args("SDL2" DEFAULT_MSG
${SDL2_LIBRARY_NEEDED} ${SDL2_LIBRARY_NEEDED}
${_SDL2_FRAMEWORK_LIBRARY_NAMES}
SDL2_INCLUDE_DIR) SDL2_INCLUDE_DIR)
if(NOT TARGET SDL2::SDL2)
if(SDL2_LIBRARY_NEEDED)
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
# Work around BUGGY framework support on OSX
# https://cmake.org/Bug/view.php?id=14105
if(CORRADE_TARGET_APPLE AND ${SDL2_LIBRARY} MATCHES "\\.framework$")
set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY}/SDL2)
else()
set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY})
endif()
# Link frameworks on iOS
if(CORRADE_TARGET_IOS)
set_property(TARGET SDL2::SDL2 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES ${_SDL2_FRAMEWORK_LIBRARIES})
endif()
# Link also EGL library, if on ES (and not on WebGL)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT MAGNUM_TARGET_WEBGL)
find_package(EGL REQUIRED)
set_property(TARGET SDL2::SDL2 APPEND PROPERTY
INTERFACE_LINK_LIBRARIES EGL::EGL)
endif()
else()
# This won't work in CMake 2.8.12, but that affects Emscripten only so
# I assume people building for that are not on that crap old Ubuntu
# 14.04 LTS
add_library(SDL2::SDL2 INTERFACE IMPORTED)
endif()
set_property(TARGET SDL2::SDL2 PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR})
endif()

2
modules/MagnumConfig.cmake

@ -1,7 +1,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a

5
package/archlinux/PKGBUILD

@ -6,7 +6,7 @@ pkgdesc="C++11/C++14 and OpenGL 2D/3D graphics engine"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('corrade' 'openal' 'freeglut' 'sdl2') depends=('corrade' 'openal' 'freeglut' 'sdl2' 'glfw')
makedepends=('cmake' 'ninja') makedepends=('cmake' 'ninja')
options=('!strip') options=('!strip')
provides=('magnum-git') provides=('magnum-git')
@ -25,6 +25,7 @@ build() {
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
@ -49,7 +50,7 @@ build() {
check() { check() {
cd "$_rootdir/build" cd "$_rootdir/build"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

1
package/archlinux/PKGBUILD-android-arm

@ -18,7 +18,6 @@ build() {
cd "$_rootdir/build-android-arm" cd "$_rootdir/build-android-arm"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Android-ARM.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Android-ARM.cmake" \
-DTARGET_GLES=ON \ -DTARGET_GLES=ON \
-DTARGET_GLES2=ON \ -DTARGET_GLES2=ON \

1
package/archlinux/PKGBUILD-android-x86

@ -18,7 +18,6 @@ build() {
cd "$_rootdir/build-android-x86" cd "$_rootdir/build-android-x86"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Android-x86.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Android-x86.cmake" \
-DTARGET_GLES=ON \ -DTARGET_GLES=ON \
-DTARGET_GLES2=ON \ -DTARGET_GLES2=ON \

5
package/archlinux/PKGBUILD-clang

@ -6,7 +6,7 @@ pkgdesc="C++11/C++14 and OpenGL 2D/3D graphics engine (built with clang)"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('corrade' 'openal' 'freeglut' 'sdl2') depends=('corrade' 'openal' 'freeglut' 'sdl2' 'glfw')
makedepends=('cmake' 'clang' 'ninja') makedepends=('cmake' 'clang' 'ninja')
options=('!strip') options=('!strip')
provides=('magnum-git') provides=('magnum-git')
@ -30,6 +30,7 @@ build() {
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_WINDOWLESSGLXAPPLICATION=ON \
@ -51,7 +52,7 @@ build() {
check() { check() {
cd "$_rootdir/build-clang" cd "$_rootdir/build-clang"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

5
package/archlinux/PKGBUILD-clang-libc++

@ -6,7 +6,7 @@ pkgdesc="C++11/C++14 and OpenGL 2D/3D graphics engine (built with clang and libc
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('corrade' 'openal' 'freeglut' 'sdl2' 'libc++') depends=('corrade' 'openal' 'freeglut' 'sdl2' 'glfw' 'libc++')
makedepends=('cmake' 'clang' 'ninja') makedepends=('cmake' 'clang' 'ninja')
options=('!strip') options=('!strip')
provides=('magnum-git') provides=('magnum-git')
@ -31,6 +31,7 @@ build() {
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
@ -54,7 +55,7 @@ build() {
check() { check() {
cd "$_rootdir/build-clang-libc++" cd "$_rootdir/build-clang-libc++"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

4
package/archlinux/PKGBUILD-emscripten

@ -18,7 +18,6 @@ build() {
cd "$_rootdir/build-emscripten" cd "$_rootdir/build-emscripten"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Emscripten.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Emscripten.cmake" \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system -DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system
fi fi
@ -32,8 +31,7 @@ build() {
-DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \ -DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \ -DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \ -DWITH_TGAIMPORTER=ON
-DWITH_WAVAUDIOIMPORTER=ON
make make
} }

1
package/archlinux/PKGBUILD-emscripten-webgl2

@ -18,7 +18,6 @@ build() {
cd "$_rootdir/build-emscripten-webgl2" cd "$_rootdir/build-emscripten-webgl2"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Emscripten.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Emscripten.cmake" \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system -DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system
fi fi

2
package/archlinux/PKGBUILD-es2

@ -37,7 +37,7 @@ build() {
check() { check() {
cd "$_rootdir/build-es2" cd "$_rootdir/build-es2"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

5
package/archlinux/PKGBUILD-es2desktop

@ -6,7 +6,7 @@ pkgdesc="C++11/C++14 and OpenGL 2D/3D graphics engine (desktop OpenGL ES 2.0 ver
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('corrade' 'openal') depends=('corrade' 'openal' 'sdl2' 'glfw')
makedepends=('cmake' 'ninja') makedepends=('cmake' 'ninja')
options=('!strip') options=('!strip')
provides=('magnum-git') provides=('magnum-git')
@ -24,6 +24,7 @@ build() {
-DTARGET_GLES2=ON \ -DTARGET_GLES2=ON \
-DTARGET_DESKTOP_GLES=ON \ -DTARGET_DESKTOP_GLES=ON \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
-DWITH_XEGLAPPLICATION=ON \ -DWITH_XEGLAPPLICATION=ON \
@ -44,7 +45,7 @@ build() {
check() { check() {
cd "$_rootdir/build-es2desktop" cd "$_rootdir/build-es2desktop"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

2
package/archlinux/PKGBUILD-es3

@ -37,7 +37,7 @@ build() {
check() { check() {
cd "$_rootdir/build-es3" cd "$_rootdir/build-es3"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

5
package/archlinux/PKGBUILD-es3desktop

@ -6,7 +6,7 @@ pkgdesc="C++11/C++14 and OpenGL 2D/3D graphics engine (desktop OpenGL ES 3.0 ver
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('corrade' 'openal') depends=('corrade' 'openal' 'sdl2' 'glfw')
makedepends=('cmake' 'ninja') makedepends=('cmake' 'ninja')
options=('!strip') options=('!strip')
provides=('magnum-git') provides=('magnum-git')
@ -24,6 +24,7 @@ build() {
-DTARGET_GLES2=OFF \ -DTARGET_GLES2=OFF \
-DTARGET_DESKTOP_GLES=ON \ -DTARGET_DESKTOP_GLES=ON \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
-DWITH_XEGLAPPLICATION=ON \ -DWITH_XEGLAPPLICATION=ON \
@ -44,7 +45,7 @@ build() {
check() { check() {
cd "$_rootdir/build-es3desktop" cd "$_rootdir/build-es3desktop"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

5
package/archlinux/PKGBUILD-gcc47

@ -6,7 +6,7 @@ pkgdesc="C++11/C++14 and OpenGL 2D/3D graphics engine (built with GCC 4.7)"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('corrade' 'openal' 'freeglut' 'sdl2') depends=('corrade' 'openal' 'freeglut' 'sdl2' 'glfw')
makedepends=('cmake' 'ninja' 'gcc47') makedepends=('cmake' 'ninja' 'gcc47')
options=('!strip') options=('!strip')
provides=('magnum-git') provides=('magnum-git')
@ -33,6 +33,7 @@ build() {
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
@ -56,7 +57,7 @@ build() {
check() { check() {
cd "$_rootdir/build-gcc47" cd "$_rootdir/build-gcc47"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

2
package/archlinux/PKGBUILD-nacl-glibc

@ -18,7 +18,6 @@ build() {
cd "$_rootdir/build-nacl-glibc-x86-32" cd "$_rootdir/build-nacl-glibc-x86-32"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-glibc-x86-32.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-glibc-x86-32.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/nacl \ -DCMAKE_INSTALL_PREFIX=/usr/nacl \
@ -39,7 +38,6 @@ build() {
cd "$_rootdir/build-nacl-glibc-x86-64" cd "$_rootdir/build-nacl-glibc-x86-64"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-glibc-x86-64.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-glibc-x86-64.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/nacl \ -DCMAKE_INSTALL_PREFIX=/usr/nacl \

2
package/archlinux/PKGBUILD-nacl-newlib

@ -18,7 +18,6 @@ build() {
cd "$_rootdir/build-nacl-newlib-x86-32" cd "$_rootdir/build-nacl-newlib-x86-32"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-newlib-x86-32.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-newlib-x86-32.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/nacl \ -DCMAKE_INSTALL_PREFIX=/usr/nacl \
@ -40,7 +39,6 @@ build() {
cd "$_rootdir/build-nacl-newlib-x86-64" cd "$_rootdir/build-nacl-newlib-x86-64"
cmake .. \ cmake .. \
-DCMAKE_MODULE_PATH="$_rootdir/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-newlib-x86-64.cmake" \ -DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/NaCl-newlib-x86-64.cmake" \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/nacl \ -DCMAKE_INSTALL_PREFIX=/usr/nacl \

7
package/archlinux/PKGBUILD-release

@ -6,7 +6,7 @@ pkgdesc="C++11/C++14 and OpenGL 2D/3D graphics engine (debug+release libs)"
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php" url="http://mosra.cz/blog/magnum.php"
license=('MIT') license=('MIT')
depends=('corrade' 'openal' 'sdl2' 'freeglut') depends=('corrade' 'openal' 'freeglut' 'sdl2' 'glfw')
makedepends=('cmake' 'ninja') makedepends=('cmake' 'ninja')
options=('!strip') options=('!strip')
provides=('magnum-git') provides=('magnum-git')
@ -21,6 +21,7 @@ build() {
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_INSTALL_PREFIX=/usr \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
@ -71,10 +72,10 @@ build() {
check() { check() {
cd "$_rootdir/build" cd "$_rootdir/build"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
cd "$_rootdir/build-release" cd "$_rootdir/build-release"
ctest --output-on-failure -j5 CORRADE_TEST_COLOR=ON ctest --output-on-failure -j5
} }
package() { package() {

13
package/ci/appveyor.yml

@ -2,9 +2,6 @@
version: '{branch}-{build}' version: '{branch}-{build}'
branches:
only:
- master
skip_tags: true skip_tags: true
shallow_clone: true shallow_clone: true
clone_depth: 1 clone_depth: 1
@ -30,9 +27,9 @@ install:
- cinst ninja - cinst ninja
# OpenAL # OpenAL
- appveyor DownloadFile http://kcat.strangesoft.net/openal-binaries/openal-soft-1.17.0-bin.zip - appveyor DownloadFile http://kcat.strangesoft.net/openal-binaries/openal-soft-1.17.2-bin.zip
- 7z x openal-soft-1.17.0-bin.zip - 7z x openal-soft-1.17.2-bin.zip
- ren openal-soft-1.17.0-bin openal - ren openal-soft-1.17.2-bin openal
- ren openal\bin\Win32\soft_oal.dll OpenAL32.dll - ren openal\bin\Win32\soft_oal.dll OpenAL32.dll
- echo [General] > %APPDATA%/alsoft.ini - echo [General] > %APPDATA%/alsoft.ini
- echo drivers=null >> %APPDATA%/alsoft.ini - echo drivers=null >> %APPDATA%/alsoft.ini
@ -56,7 +53,7 @@ install:
build_script: build_script:
- mkdir build - mkdir build
- cd build - cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/Sys -DCMAKE_PREFIX_PATH="%APPVEYOR_BUILD_FOLDER%/SDL;%APPVEYOR_BUILD_FOLDER%/openal" -DWITH_AUDIO=ON -DWITH_SDL2APPLICATION=ON -DWITH_WINDOWLESSWGLAPPLICATION=ON -DWITH_WGLCONTEXT=ON -DWITH_MAGNUMFONT=ON -DWITH_MAGNUMFONTCONVERTER=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DWITH_DISTANCEFIELDCONVERTER=ON -DWITH_FONTCONVERTER=ON -DWITH_MAGNUMINFO=ON -DBUILD_STATIC=%BUILD_STATIC% -DBUILD_TESTS=ON -G Ninja - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/Sys -DCMAKE_PREFIX_PATH="%APPVEYOR_BUILD_FOLDER%/SDL;%APPVEYOR_BUILD_FOLDER%/openal" -DWITH_AUDIO=ON -DWITH_SDL2APPLICATION=ON -DWITH_WINDOWLESSWGLAPPLICATION=ON -DWITH_WGLCONTEXT=ON -DWITH_MAGNUMFONT=ON -DWITH_MAGNUMFONTCONVERTER=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DWITH_DISTANCEFIELDCONVERTER=ON -DWITH_FONTCONVERTER=ON -DWITH_MAGNUMINFO=ON -DBUILD_STATIC=%BUILD_STATIC% -DBUILD_TESTS=ON -DBUILD_GL_TESTS=ON -G Ninja
- cmake --build . - cmake --build .
- cmake --build . --target install - cmake --build . --target install
- cmake . -DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/Deploy -DBUILD_TESTS=OFF - cmake . -DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/Deploy -DBUILD_TESTS=OFF
@ -67,7 +64,7 @@ build_script:
test_script: test_script:
- cd %APPVEYOR_BUILD_FOLDER%/build - cd %APPVEYOR_BUILD_FOLDER%/build
- SET fail=0 - SET fail=0
- ctest --output-on-failure || SET fail=1 & ver > nul - ctest --output-on-failure -E GLTest || SET fail=1 & ver > nul
- cd %APPVEYOR_BUILD_FOLDER% - cd %APPVEYOR_BUILD_FOLDER%
- appveyor PushArtifact magnum.zip - appveyor PushArtifact magnum.zip
- exit %fail% - exit %fail%

24
package/ci/jenkins-android.xml

@ -39,6 +39,13 @@
<concurrentBuild>false</concurrentBuild> <concurrentBuild>false</concurrentBuild>
<customWorkspace>Magnum</customWorkspace> <customWorkspace>Magnum</customWorkspace>
<axes> <axes>
<hudson.matrix.TextAxis>
<name>gl</name>
<values>
<string>es2</string>
<string>es3</string>
</values>
</hudson.matrix.TextAxis>
<hudson.matrix.TextAxis> <hudson.matrix.TextAxis>
<name>toolchain</name> <name>toolchain</name>
<values> <values>
@ -61,22 +68,29 @@
git submodule init git submodule init
git submodule update git submodule update
if [ ${gl} = "es2" ] ; then
gl_flags="-DTARGET_GLES=ON -DTARGET_GLES2=ON"
elif [ ${gl} = "es3" ] ; then
gl_flags="-DTARGET_GLES=ON -DTARGET_GLES2=OFF"
fi
if [ "${compatibility}" = "deprecated" ] ; then if [ "${compatibility}" = "deprecated" ] ; then
deprecated_build_flag=ON deprecated_build_flag=ON
else else
deprecated_build_flag=OFF deprecated_build_flag=OFF
fi fi
mkdir -p build-android-${toolchain}-${compatibility} mkdir -p build-android-${gl}-${toolchain}-${compatibility}
cd build-android-${toolchain}-${compatibility} cd build-android-${gl}-${toolchain}-${compatibility}
cmake .. \ cmake .. \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_MODULE_PATH="${WORKSPACE}/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/Android-${toolchain}.cmake \ -DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/Android-${toolchain}.cmake \
-DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/android-${toolchain}-${compatibility} \ -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/android-${toolchain}-${compatibility} \
-DCMAKE_INSTALL_PREFIX=${JENKINS_HOME}/filesystem/android-${toolchain}-${compatibility} \ -DCMAKE_PREFIX_PATH=${JENKINS_HOME}/filesystem/android-${toolchain}-${compatibility} \
-DCMAKE_INSTALL_PREFIX=${JENKINS_HOME}/filesystem/android-${gl}-${toolchain}-${compatibility} \
-DBUILD_DEPRECATED=${deprecated_build_flag} \ -DBUILD_DEPRECATED=${deprecated_build_flag} \
${gl_flags} \
`#-DWITH_AUDIO=ON` \ `#-DWITH_AUDIO=ON` \
-DWITH_ANDROIDAPPLICATION=ON \ -DWITH_ANDROIDAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON \ -DWITH_EGLCONTEXT=ON \
@ -108,7 +122,7 @@ ninja install/strip
<runSequentially>true</runSequentially> <runSequentially>true</runSequentially>
<touchStoneCombinationFilter> <touchStoneCombinationFilter>
<![CDATA[ <![CDATA[
toolchain == "ARM" && compatibility == "deprecated" gl == "es2" && toolchain == "ARM" && compatibility == "deprecated"
]]> ]]>
</touchStoneCombinationFilter> </touchStoneCombinationFilter>
<touchStoneResultCondition> <touchStoneResultCondition>

1
package/ci/jenkins-clang-analyzer.xml

@ -108,6 +108,7 @@ scan-build --use-c++=$(which clang++) cmake .. \
-DBUILD_DEPRECATED=${deprecated_build_flag} \ -DBUILD_DEPRECATED=${deprecated_build_flag} \
${gl_flags} \ ${gl_flags} \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \

1
package/ci/jenkins-clang-sanitizer.xml

@ -116,6 +116,7 @@ cmake .. \
-DBUILD_DEPRECATED=${deprecated_build_flag} \ -DBUILD_DEPRECATED=${deprecated_build_flag} \
${gl_flags} \ ${gl_flags} \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \

1
package/ci/jenkins-emscripten.xml

@ -78,7 +78,6 @@ cd build-emscripten-${compatibility}-${gl}
cmake .. \ cmake .. \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_MODULE_PATH="${WORKSPACE}/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \ -DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \
-DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/emscripten-${compatibility} \ -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/emscripten-${compatibility} \
-DCMAKE_PREFIX_PATH=${JENKINS_HOME}/filesystem/emscripten-${compatibility} \ -DCMAKE_PREFIX_PATH=${JENKINS_HOME}/filesystem/emscripten-${compatibility} \

12
package/ci/jenkins-gltests.xml

@ -82,6 +82,18 @@ cd build-${compiler}-${libraries}-${compatibility}-${gl}
ninja ninja
ctest --output-on-failure -R GLTest -j5 || true ctest --output-on-failure -R GLTest -j5 || true
if [ ${gl} = "desktop" ] ; then
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_multi_bind" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_multi_bind GL_ARB_robustness" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_multi_bind GL_ARB_robustness GL_ARB_separate_shader_objects" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_multi_bind GL_ARB_robustness GL_ARB_separate_shader_objects GL_ARB_texture_storage" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_multi_bind GL_ARB_robustness GL_ARB_separate_shader_objects GL_ARB_texture_storage GL_ARB_texture_storage_multisample" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_multi_bind GL_ARB_robustness GL_ARB_separate_shader_objects GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_KHR_debug" ctest --output-on-failure -R GLTest -j5 || true
MAGNUM_DISABLE_EXTENSIONS="GL_ARB_direct_state_access GL_EXT_direct_state_access GL_ARB_get_texture_sub_image GL_ARB_multi_bind GL_ARB_robustness GL_ARB_separate_shader_objects GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_KHR_debug GL_ARB_compressed_texture_pixel_storage" ctest --output-on-failure -R GLTest -j5 || true
fi
]]> ]]>
</command> </command>
</hudson.tasks.Shell> </hudson.tasks.Shell>

1
package/ci/jenkins-nacl.xml

@ -72,7 +72,6 @@ cd build-nacl-${toolchain}-${compatibility}
cmake .. \ cmake .. \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_MODULE_PATH="${WORKSPACE}/toolchains/modules" \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/NaCl-${toolchain}.cmake \ -DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/NaCl-${toolchain}.cmake \
-DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/nacl-${toolchain}-${compatibility} \ -DCMAKE_FIND_ROOT_PATH=${JENKINS_HOME}/filesystem/nacl-${toolchain}-${compatibility} \
-DCMAKE_INSTALL_PREFIX=${JENKINS_HOME}/filesystem/nacl-${toolchain}-${compatibility} \ -DCMAKE_INSTALL_PREFIX=${JENKINS_HOME}/filesystem/nacl-${toolchain}-${compatibility} \

1
package/ci/jenkins.xml

@ -141,6 +141,7 @@ cmake .. \
${static_build_flag} \ ${static_build_flag} \
${gl_flags} \ ${gl_flags} \
-DWITH_AUDIO=ON \ -DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_GLUTAPPLICATION=ON \ -DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \

21
package/ci/travis.yml

@ -1,9 +1,5 @@
# kate: indent-width 2; # kate: indent-width 2;
branches:
only:
- master
os: os:
- linux - linux
- osx - osx
@ -12,7 +8,7 @@ addons:
apt: apt:
sources: sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- kalakris-cmake - kubuntu-backports
packages: packages:
- g++-4.7 - g++-4.7
- cmake - cmake
@ -31,20 +27,27 @@ cache:
- $HOME/sdl2 - $HOME/sdl2
install: install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX=g++-4.7; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX=g++-4.7; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PLATFORM_GL_API=GLX; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PLATFORM_GL_API=GLX; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PLATFORM_GL_API=CGL; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PLATFORM_GL_API=CGL; fi
- printf "[General]\ndrivers=null" > ~/.alsoftrc - printf "[General]\ndrivers=null" > ~/.alsoftrc
# SDL (cached) # SDL (cached)
- if [ ! -e "$HOME/sdl2/include" ]; then curl -O http://www.libsdl.org/release/SDL2-2.0.3.tar.gz && tar -xzvf SDL2-2.0.3.tar.gz && cd SDL2-2.0.3 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/sdl2 -DCMAKE_BUILD_TYPE=Release && cmake --build . --target install && cd ../..; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install sdl2; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/sdl2/include" ]; then curl -O http://www.libsdl.org/release/SDL2-2.0.4.tar.gz && tar -xzvf SDL2-2.0.4.tar.gz && cd SDL2-2.0.4 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/sdl2 -DCMAKE_BUILD_TYPE=Release && cmake --build . --target install && cd ../..; fi
# GLFW (cached)
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install homebrew/versions/glfw3; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/glfw/include" ]; then wget https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip && unzip glfw-3.1.2.zip && cd glfw-3.1.2 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/glfw -DCMAKE_BUILD_TYPE=Release -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF && cmake --build . --target install && cd ../..; fi
# Corrade # Corrade
- git clone --depth 1 git://github.com/mosra/corrade.git - git clone --depth 1 git://github.com/mosra/corrade.git
- cd corrade - cd corrade
- mkdir build - mkdir build
- cd build - cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/deps -DCMAKE_INSTALL_RPATH=$HOME/deps/lib -DCMAKE_MACOSX_RPATH=ON -DCMAKE_BUILD_TYPE=Release - cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/deps -DCMAKE_INSTALL_RPATH=$HOME/deps/lib -DCMAKE_BUILD_TYPE=Release
- cmake --build . - cmake --build .
- cmake --build . --target install - cmake --build . --target install
- cd .. - cd ..
@ -52,6 +55,6 @@ install:
script: script:
- mkdir build && cd build - mkdir build && cd build
- cmake .. -DCMAKE_PREFIX_PATH="$HOME/sdl2;$HOME/deps" -DCMAKE_BUILD_TYPE=Release -DWITH_AUDIO=ON -DWITH_SDL2APPLICATION=ON -DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON -DWITH_${PLATFORM_GL_API}CONTEXT=ON -DWITH_MAGNUMFONT=ON -DWITH_MAGNUMFONTCONVERTER=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DWITH_DISTANCEFIELDCONVERTER=ON -DWITH_FONTCONVERTER=ON -DWITH_MAGNUMINFO=ON -DBUILD_TESTS=ON - cmake .. -DCMAKE_PREFIX_PATH="$HOME/deps;$HOME/sdl2;$HOME/glfw" -DCMAKE_BUILD_TYPE=Release -DWITH_AUDIO=ON -DWITH_GLFWAPPLICATION=ON -DWITH_SDL2APPLICATION=ON -DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON -DWITH_${PLATFORM_GL_API}CONTEXT=ON -DWITH_MAGNUMFONT=ON -DWITH_MAGNUMFONTCONVERTER=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DWITH_DISTANCEFIELDCONVERTER=ON -DWITH_FONTCONVERTER=ON -DWITH_MAGNUMINFO=ON -DBUILD_TESTS=ON -DBUILD_GL_TESTS=ON
- cmake --build . - cmake --build .
- ctest --output-on-failure - ctest --output-on-failure -E GLTest

2
package/debian/changelog vendored

@ -1,4 +1,4 @@
magnum (1.0-1) UNRELEASED; urgency=low magnum (1.0) UNRELEASED; urgency=low
* Latest upstream version * Latest upstream version

7
package/debian/rules vendored

@ -9,7 +9,6 @@ override_dh_auto_configure:
-DWITH_GLXAPPLICATION=ON \ -DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \ -DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \ -DWITH_WINDOWLESSGLXAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \ -DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \ -DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \ -DWITH_MAGNUMFONTCONVERTER=ON \
@ -20,3 +19,9 @@ override_dh_auto_configure:
-DWITH_DISTANCEFIELDCONVERTER=ON \ -DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \ -DWITH_FONTCONVERTER=ON \
-DWITH_MAGNUMINFO=ON -DWITH_MAGNUMINFO=ON
# Extraordinarily coarse way to suppress error about libGL not being in
# dependencies when the user has installed NVidia binary drivers which are not
# in the repositories. Can't I just IGNORE A SIGNLE FILE DAMMIT?!
override_dh_shlibdeps:
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

20
package/homebrew/magnum.rb

@ -0,0 +1,20 @@
# kate: indent-width 2;
class Magnum < Formula
desc "C++11/C++14 and OpenGL 2D/3D graphics engine"
homepage "https://github.com/mosra/magnum"
head "git://github.com/mosra/magnum.git"
depends_on "cmake"
depends_on "corrade"
depends_on "sdl2"
def install
system "mkdir build"
cd "build" do
system "cmake", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=#{prefix}", "-DWITH_AUDIO=ON", "-DWITH_SDL2APPLICATION=ON", "-DWITH_WINDOWLESSCGLAPPLICATION=ON", "-DWITH_CGLCONTEXT=ON", "-DWITH_MAGNUMFONT=ON", "-DWITH_MAGNUMFONTCONVERTER=ON", "-DWITH_OBJIMPORTER=ON", "-DWITH_TGAIMAGECONVERTER=ON", "-DWITH_TGAIMPORTER=ON", "-DWITH_WAVAUDIOIMPORTER=ON", "-DWITH_DISTANCEFIELDCONVERTER=ON", "-DWITH_FONTCONVERTER=ON", "-DWITH_MAGNUMINFO=ON", ".."
system "cmake", "--build", "."
system "cmake", "--build", ".", "--target", "install"
end
end
end

16
src/CMakeLists.txt

@ -1,7 +1,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -27,7 +27,7 @@
# without any warning, only in release build, any attempt to add debug print # without any warning, only in release build, any attempt to add debug print
# results in issue disappearing. Not an issue on Clang or GCC < 4.8. # results in issue disappearing. Not an issue on Clang or GCC < 4.8.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") add_compile_options("-fno-strict-aliasing")
endif() endif()
# On MSVC remove /W3, as we are replacing it with /W4 # On MSVC remove /W3, as we are replacing it with /W4
@ -37,17 +37,13 @@ endif()
# Emscripten needs special flag to use WebGL 2 # Emscripten needs special flag to use WebGL 2
if(CORRADE_TARGET_EMSCRIPTEN AND NOT TARGET_GLES2) if(CORRADE_TARGET_EMSCRIPTEN AND NOT TARGET_GLES2)
# TODO: give me INTERFACE_LINK_OPTIONS or something, please
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CORRADE_CXX_FLAGS}") set_directory_properties(PROPERTIES
CORRADE_CXX_STANDARD 11
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CORRADE_INCLUDE_DIRS}) CORRADE_USE_PEDANTIC_FLAGS ON)
# We can use both implicit include path (GLES2/gl2.h) where our headers can
# be overriden with system ones or explicit (MagnumExternal/OpenGL/GLES2/gl2ext.h)
# where only our headers will be used
include_directories(${PROJECT_SOURCE_DIR}/src/MagnumExternal/OpenGL)
add_subdirectory(MagnumExternal) add_subdirectory(MagnumExternal)
add_subdirectory(Magnum) add_subdirectory(Magnum)

51
src/Magnum/AbstractFramebuffer.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -38,7 +38,7 @@
namespace Magnum { namespace Magnum {
Vector2i AbstractFramebuffer::maxViewportSize() { Vector2i AbstractFramebuffer::maxViewportSize() {
Vector2i& value = Context::current()->state().framebuffer->maxViewportSize; Vector2i& value = Context::current().state().framebuffer->maxViewportSize;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == Vector2i()) if(value == Vector2i())
@ -50,16 +50,16 @@ Vector2i AbstractFramebuffer::maxViewportSize() {
Int AbstractFramebuffer::maxDrawBuffers() { Int AbstractFramebuffer::maxDrawBuffers() {
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::draw_buffers>() && if(!Context::current().isExtensionSupported<Extensions::GL::EXT::draw_buffers>() &&
!Context::current()->isExtensionSupported<Extensions::GL::NV::draw_buffers>()) !Context::current().isExtensionSupported<Extensions::GL::NV::draw_buffers>())
return 0; return 0;
#else #else
if(!Context::current()->isExtensionSupported<Extensions::GL::WEBGL::draw_buffers>()) if(!Context::current().isExtensionSupported<Extensions::GL::WEBGL::draw_buffers>())
return 0; return 0;
#endif #endif
#endif #endif
GLint& value = Context::current()->state().framebuffer->maxDrawBuffers; GLint& value = Context::current().state().framebuffer->maxDrawBuffers;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) { if(value == 0) {
@ -75,10 +75,10 @@ Int AbstractFramebuffer::maxDrawBuffers() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Int AbstractFramebuffer::maxDualSourceDrawBuffers() { Int AbstractFramebuffer::maxDualSourceDrawBuffers() {
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::blend_func_extended>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::blend_func_extended>())
return 0; return 0;
GLint& value = Context::current()->state().framebuffer->maxDualSourceDrawBuffers; GLint& value = Context::current().state().framebuffer->maxDualSourceDrawBuffers;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0)
@ -105,16 +105,19 @@ void AbstractFramebuffer::bind() {
} }
void AbstractFramebuffer::bindInternal(FramebufferTarget target) { void AbstractFramebuffer::bindInternal(FramebufferTarget target) {
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #ifndef MAGNUM_TARGET_GLES2
(this->*Context::current()->state().framebuffer->bindImplementation)(target);
#else
bindImplementationDefault(target); bindImplementationDefault(target);
#elif defined(MAGNUM_TARGET_WEBGL)
static_cast<void>(target);
bindImplementationSingle();
#else
(this->*Context::current().state().framebuffer->bindImplementation)(target);
#endif #endif
} }
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
void AbstractFramebuffer::bindImplementationSingle(FramebufferTarget) { void AbstractFramebuffer::bindImplementationSingle(FramebufferTarget) {
Implementation::FramebufferState& state = *Context::current()->state().framebuffer; Implementation::FramebufferState& state = *Context::current().state().framebuffer;
CORRADE_INTERNAL_ASSERT(state.readBinding == state.drawBinding); CORRADE_INTERNAL_ASSERT(state.readBinding == state.drawBinding);
if(state.readBinding == _id) return; if(state.readBinding == _id) return;
@ -130,7 +133,7 @@ void AbstractFramebuffer::bindImplementationSingle(FramebufferTarget) {
inline inline
#endif #endif
void AbstractFramebuffer::bindImplementationDefault(FramebufferTarget target) { void AbstractFramebuffer::bindImplementationDefault(FramebufferTarget target) {
Implementation::FramebufferState& state = *Context::current()->state().framebuffer; Implementation::FramebufferState& state = *Context::current().state().framebuffer;
if(target == FramebufferTarget::Read) { if(target == FramebufferTarget::Read) {
if(state.readBinding == _id) return; if(state.readBinding == _id) return;
@ -146,16 +149,18 @@ void AbstractFramebuffer::bindImplementationDefault(FramebufferTarget target) {
} }
FramebufferTarget AbstractFramebuffer::bindInternal() { FramebufferTarget AbstractFramebuffer::bindInternal() {
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #ifndef MAGNUM_TARGET_GLES2
return (this->*Context::current()->state().framebuffer->bindInternalImplementation)();
#else
return bindImplementationDefault(); return bindImplementationDefault();
#elif defined(MAGNUM_TARGET_WEBGL)
return bindImplementationSingle();
#else
return (this->*Context::current().state().framebuffer->bindInternalImplementation)();
#endif #endif
} }
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
FramebufferTarget AbstractFramebuffer::bindImplementationSingle() { FramebufferTarget AbstractFramebuffer::bindImplementationSingle() {
Implementation::FramebufferState& state = *Context::current()->state().framebuffer; Implementation::FramebufferState& state = *Context::current().state().framebuffer;
CORRADE_INTERNAL_ASSERT(state.readBinding == state.drawBinding); CORRADE_INTERNAL_ASSERT(state.readBinding == state.drawBinding);
/* Bind the framebuffer, if not already */ /* Bind the framebuffer, if not already */
@ -175,7 +180,7 @@ FramebufferTarget AbstractFramebuffer::bindImplementationSingle() {
inline inline
#endif #endif
FramebufferTarget AbstractFramebuffer::bindImplementationDefault() { FramebufferTarget AbstractFramebuffer::bindImplementationDefault() {
Implementation::FramebufferState& state = *Context::current()->state().framebuffer; Implementation::FramebufferState& state = *Context::current().state().framebuffer;
/* Return target to which the framebuffer is already bound */ /* Return target to which the framebuffer is already bound */
if(state.readBinding == _id) if(state.readBinding == _id)
@ -194,7 +199,7 @@ FramebufferTarget AbstractFramebuffer::bindImplementationDefault() {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) { void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer& destination, const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
Context::current()->state().framebuffer->blitImplementation(source, destination, sourceRectangle, destinationRectangle, mask, filter); Context::current().state().framebuffer->blitImplementation(source, destination, sourceRectangle, destinationRectangle, mask, filter);
} }
#endif #endif
@ -250,14 +255,14 @@ AbstractFramebuffer& AbstractFramebuffer::setViewport(const Range2Di& rectangle)
_viewport = rectangle; _viewport = rectangle;
/* Update the viewport if the framebuffer is currently bound */ /* Update the viewport if the framebuffer is currently bound */
if(Context::current()->state().framebuffer->drawBinding == _id) if(Context::current().state().framebuffer->drawBinding == _id)
setViewportInternal(); setViewportInternal();
return *this; return *this;
} }
void AbstractFramebuffer::setViewportInternal() { void AbstractFramebuffer::setViewportInternal() {
Implementation::FramebufferState& state = *Context::current()->state().framebuffer; Implementation::FramebufferState& state = *Context::current().state().framebuffer;
CORRADE_INTERNAL_ASSERT(_viewport != Implementation::FramebufferState::DisengagedViewport); CORRADE_INTERNAL_ASSERT(_viewport != Implementation::FramebufferState::DisengagedViewport);
CORRADE_INTERNAL_ASSERT(state.drawBinding == _id); CORRADE_INTERNAL_ASSERT(state.drawBinding == _id);
@ -291,7 +296,7 @@ void AbstractFramebuffer::read(const Range2Di& rectangle, Image2D& image) {
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
#endif #endif
image.storage().applyPack(); image.storage().applyPack();
(Context::current()->state().framebuffer->readImplementation)(rectangle, image.format(), image.type(), data.size(), data (Context::current().state().framebuffer->readImplementation)(rectangle, image.format(), image.type(), data.size(), data
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
+ Implementation::pixelStorageSkipOffsetFor(image, rectangle.size()) + Implementation::pixelStorageSkipOffsetFor(image, rectangle.size())
#endif #endif
@ -317,7 +322,7 @@ void AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D& image,
image.buffer().bindInternal(Buffer::TargetHint::PixelPack); image.buffer().bindInternal(Buffer::TargetHint::PixelPack);
image.storage().applyPack(); image.storage().applyPack();
(Context::current()->state().framebuffer->readImplementation)(rectangle, image.format(), image.type(), dataSize, nullptr); (Context::current().state().framebuffer->readImplementation)(rectangle, image.format(), image.type(), dataSize, nullptr);
} }
BufferImage2D AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D&& image, BufferUsage usage) { BufferImage2D AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D&& image, BufferUsage usage) {

2
src/Magnum/AbstractFramebuffer.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

12
src/Magnum/AbstractObject.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -113,10 +113,10 @@ namespace {
#endif #endif
Int AbstractObject::maxLabelLength() { Int AbstractObject::maxLabelLength() {
if(!Context::current()->isExtensionSupported<Extensions::GL::KHR::debug>()) if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>())
return 0; return 0;
GLint& value = Context::current()->state().debug->maxLabelLength; GLint& value = Context::current().state().debug->maxLabelLength;
if(value == 0) { if(value == 0) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -161,7 +161,7 @@ std::string AbstractObject::getLabelImplementationNoOp(GLenum, GLuint) { return
std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) { std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) {
/* Get label size (w/o null terminator). Specifying 0 as size is not /* Get label size (w/o null terminator). Specifying 0 as size is not
allowed, thus we pass the maximum instead. */ allowed, thus we pass the maximum instead. */
GLsizei size; GLsizei size = 0;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
glGetObjectLabel(identifier, name, maxLabelLength(), &size, nullptr); glGetObjectLabel(identifier, name, maxLabelLength(), &size, nullptr);
#elif !defined(CORRADE_TARGET_NACL) #elif !defined(CORRADE_TARGET_NACL)
@ -189,7 +189,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c
} }
std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) { std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) {
GLsizei size; GLsizei size = 0;
/* Get label size (w/o null terminator) */ /* Get label size (w/o null terminator) */
#ifndef CORRADE_TARGET_NACL #ifndef CORRADE_TARGET_NACL
@ -205,7 +205,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c
std::string label; std::string label;
label.resize(size+1); label.resize(size+1);
#ifndef CORRADE_TARGET_NACL #ifndef CORRADE_TARGET_NACL
glGetObjectLabelEXT(identifier, name, size+1, nullptr, &label[0]); glGetObjectLabelEXT(type, name, size+1, nullptr, &label[0]);
#else #else
CORRADE_ASSERT_UNREACHABLE(); CORRADE_ASSERT_UNREACHABLE();
#endif #endif

2
src/Magnum/AbstractObject.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

12
src/Magnum/AbstractQuery.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -37,7 +37,7 @@
namespace Magnum { namespace Magnum {
AbstractQuery::AbstractQuery(GLenum target): _target{target}, _flags{ObjectFlag::DeleteOnDestruction} { AbstractQuery::AbstractQuery(GLenum target): _target{target}, _flags{ObjectFlag::DeleteOnDestruction} {
(this->*Context::current()->state().query->createImplementation)(); (this->*Context::current().state().query->createImplementation)();
} }
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
@ -79,17 +79,17 @@ void AbstractQuery::createImplementationDSA() {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
std::string AbstractQuery::label() const { std::string AbstractQuery::label() const {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
return Context::current()->state().debug->getLabelImplementation(GL_QUERY, _id); return Context::current().state().debug->getLabelImplementation(GL_QUERY, _id);
#else #else
return Context::current()->state().debug->getLabelImplementation(GL_QUERY_KHR, _id); return Context::current().state().debug->getLabelImplementation(GL_QUERY_KHR, _id);
#endif #endif
} }
AbstractQuery& AbstractQuery::setLabelInternal(const Containers::ArrayView<const char> label) { AbstractQuery& AbstractQuery::setLabelInternal(const Containers::ArrayView<const char> label) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Context::current()->state().debug->labelImplementation(GL_QUERY, _id, label); Context::current().state().debug->labelImplementation(GL_QUERY, _id, label);
#else #else
Context::current()->state().debug->labelImplementation(GL_QUERY_KHR, _id, label); Context::current().state().debug->labelImplementation(GL_QUERY_KHR, _id, label);
#endif #endif
return *this; return *this;
} }

2
src/Magnum/AbstractQuery.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/AbstractResourceLoader.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

204
src/Magnum/AbstractShaderProgram.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -50,7 +50,7 @@ namespace Implementation {
} }
Int AbstractShaderProgram::maxVertexAttributes() { Int AbstractShaderProgram::maxVertexAttributes() {
GLint& value = Context::current()->state().shaderProgram->maxVertexAttributes; GLint& value = Context::current().state().shaderProgram->maxVertexAttributes;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0)
@ -62,13 +62,13 @@ Int AbstractShaderProgram::maxVertexAttributes() {
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Int AbstractShaderProgram::maxAtomicCounterBufferSize() { Int AbstractShaderProgram::maxAtomicCounterBufferSize() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shader_atomic_counters>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_atomic_counters>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().shaderProgram->maxAtomicCounterBufferSize; GLint& value = Context::current().state().shaderProgram->maxAtomicCounterBufferSize;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE, &value); glGetIntegerv(GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE, &value);
@ -78,13 +78,13 @@ Int AbstractShaderProgram::maxAtomicCounterBufferSize() {
Int AbstractShaderProgram::maxComputeSharedMemorySize() { Int AbstractShaderProgram::maxComputeSharedMemorySize() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::compute_shader>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compute_shader>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().shaderProgram->maxComputeSharedMemorySize; GLint& value = Context::current().state().shaderProgram->maxComputeSharedMemorySize;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_COMPUTE_SHARED_MEMORY_SIZE, &value); glGetIntegerv(GL_MAX_COMPUTE_SHARED_MEMORY_SIZE, &value);
@ -94,13 +94,13 @@ Int AbstractShaderProgram::maxComputeSharedMemorySize() {
Int AbstractShaderProgram::maxComputeWorkGroupInvocations() { Int AbstractShaderProgram::maxComputeWorkGroupInvocations() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::compute_shader>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compute_shader>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().shaderProgram->maxComputeWorkGroupInvocations; GLint& value = Context::current().state().shaderProgram->maxComputeWorkGroupInvocations;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &value); glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &value);
@ -108,15 +108,53 @@ Int AbstractShaderProgram::maxComputeWorkGroupInvocations() {
return value; return value;
} }
Vector3i AbstractShaderProgram::maxComputeWorkGroupCount() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compute_shader>())
#else
if(!Context::current().isVersionSupported(Version::GLES310))
#endif
return {};
Vector3i& value = Context::current().state().shaderProgram->maxComputeWorkGroupCount;
if(value.isZero()) {
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, &value.x());
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, &value.y());
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, &value.z());
}
return value;
}
Vector3i AbstractShaderProgram::maxComputeWorkGroupSize() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compute_shader>())
#else
if(!Context::current().isVersionSupported(Version::GLES310))
#endif
return {};
Vector3i& value = Context::current().state().shaderProgram->maxComputeWorkGroupSize;
if(value.isZero()) {
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, &value.x());
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, &value.y());
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, &value.z());
}
return value;
}
Int AbstractShaderProgram::maxImageUnits() { Int AbstractShaderProgram::maxImageUnits() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().shaderProgram->maxImageUnits; GLint& value = Context::current().state().shaderProgram->maxImageUnits;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_IMAGE_UNITS, &value); glGetIntegerv(GL_MAX_IMAGE_UNITS, &value);
@ -127,10 +165,10 @@ Int AbstractShaderProgram::maxImageUnits() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Int AbstractShaderProgram::maxImageSamples() { Int AbstractShaderProgram::maxImageSamples() {
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
return 0; return 0;
GLint& value = Context::current()->state().shaderProgram->maxImageSamples; GLint& value = Context::current().state().shaderProgram->maxImageSamples;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_IMAGE_SAMPLES, &value); glGetIntegerv(GL_MAX_IMAGE_SAMPLES, &value);
@ -143,13 +181,13 @@ Int AbstractShaderProgram::maxImageSamples() {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
Int AbstractShaderProgram::maxCombinedShaderOutputResources() { Int AbstractShaderProgram::maxCombinedShaderOutputResources() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shader_storage_buffer_object>() || !Context::current()->isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_storage_buffer_object>() || !Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().shaderProgram->maxCombinedShaderOutputResources; GLint& value = Context::current().state().shaderProgram->maxCombinedShaderOutputResources;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES, &value); glGetIntegerv(GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES, &value);
@ -159,13 +197,13 @@ Int AbstractShaderProgram::maxCombinedShaderOutputResources() {
Long AbstractShaderProgram::maxShaderStorageBlockSize() { Long AbstractShaderProgram::maxShaderStorageBlockSize() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::shader_storage_buffer_object>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_storage_buffer_object>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint64& value = Context::current()->state().shaderProgram->maxShaderStorageBlockSize; GLint64& value = Context::current().state().shaderProgram->maxShaderStorageBlockSize;
if(value == 0) if(value == 0)
glGetInteger64v(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &value); glGetInteger64v(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &value);
@ -176,11 +214,11 @@ Long AbstractShaderProgram::maxShaderStorageBlockSize() {
Int AbstractShaderProgram::maxUniformBlockSize() { Int AbstractShaderProgram::maxUniformBlockSize() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::uniform_buffer_object>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::uniform_buffer_object>())
return 0; return 0;
#endif #endif
GLint& value = Context::current()->state().shaderProgram->maxUniformBlockSize; GLint& value = Context::current().state().shaderProgram->maxUniformBlockSize;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &value); glGetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE, &value);
@ -191,13 +229,13 @@ Int AbstractShaderProgram::maxUniformBlockSize() {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
Int AbstractShaderProgram::maxUniformLocations() { Int AbstractShaderProgram::maxUniformLocations() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::explicit_uniform_location>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::explicit_uniform_location>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().shaderProgram->maxUniformLocations; GLint& value = Context::current().state().shaderProgram->maxUniformLocations;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, &value); glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, &value);
@ -208,11 +246,11 @@ Int AbstractShaderProgram::maxUniformLocations() {
Int AbstractShaderProgram::minTexelOffset() { Int AbstractShaderProgram::minTexelOffset() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::gpu_shader4>()) if(!Context::current().isExtensionSupported<Extensions::GL::EXT::gpu_shader4>())
return 0; return 0;
#endif #endif
GLint& value = Context::current()->state().shaderProgram->minTexelOffset; GLint& value = Context::current().state().shaderProgram->minTexelOffset;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &value); glGetIntegerv(GL_MIN_PROGRAM_TEXEL_OFFSET, &value);
@ -222,11 +260,11 @@ Int AbstractShaderProgram::minTexelOffset() {
Int AbstractShaderProgram::maxTexelOffset() { Int AbstractShaderProgram::maxTexelOffset() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::gpu_shader4>()) if(!Context::current().isExtensionSupported<Extensions::GL::EXT::gpu_shader4>())
return 0; return 0;
#endif #endif
GLint& value = Context::current()->state().shaderProgram->maxTexelOffset; GLint& value = Context::current().state().shaderProgram->maxTexelOffset;
if(value == 0) if(value == 0)
glGetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, &value); glGetIntegerv(GL_MAX_PROGRAM_TEXEL_OFFSET, &value);
@ -245,7 +283,7 @@ AbstractShaderProgram::AbstractShaderProgram(AbstractShaderProgram&& other) noex
AbstractShaderProgram::~AbstractShaderProgram() { AbstractShaderProgram::~AbstractShaderProgram() {
/* Remove current usage from the state */ /* Remove current usage from the state */
GLuint& current = Context::current()->state().shaderProgram->current; GLuint& current = Context::current().state().shaderProgram->current;
if(current == _id) current = 0; if(current == _id) current = 0;
if(_id) glDeleteProgram(_id); if(_id) glDeleteProgram(_id);
@ -260,17 +298,17 @@ AbstractShaderProgram& AbstractShaderProgram::operator=(AbstractShaderProgram&&
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
std::string AbstractShaderProgram::label() const { std::string AbstractShaderProgram::label() const {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
return Context::current()->state().debug->getLabelImplementation(GL_PROGRAM, _id); return Context::current().state().debug->getLabelImplementation(GL_PROGRAM, _id);
#else #else
return Context::current()->state().debug->getLabelImplementation(GL_PROGRAM_KHR, _id); return Context::current().state().debug->getLabelImplementation(GL_PROGRAM_KHR, _id);
#endif #endif
} }
AbstractShaderProgram& AbstractShaderProgram::setLabelInternal(const Containers::ArrayView<const char> label) { AbstractShaderProgram& AbstractShaderProgram::setLabelInternal(const Containers::ArrayView<const char> label) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Context::current()->state().debug->labelImplementation(GL_PROGRAM, _id, label); Context::current().state().debug->labelImplementation(GL_PROGRAM, _id, label);
#else #else
Context::current()->state().debug->labelImplementation(GL_PROGRAM_KHR, _id, label); Context::current().state().debug->labelImplementation(GL_PROGRAM_KHR, _id, label);
#endif #endif
return *this; return *this;
} }
@ -294,9 +332,16 @@ std::pair<bool, std::string> AbstractShaderProgram::validate() {
return {success, std::move(message)}; return {success, std::move(message)};
} }
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractShaderProgram::dispatchCompute(const Vector3ui& workgroupCount) {
use();
glDispatchCompute(workgroupCount.x(), workgroupCount.y(), workgroupCount.z());
}
#endif
void AbstractShaderProgram::use() { void AbstractShaderProgram::use() {
/* Use only if the program isn't already in use */ /* Use only if the program isn't already in use */
GLuint& current = Context::current()->state().shaderProgram->current; GLuint& current = Context::current().state().shaderProgram->current;
if(current != _id) glUseProgram(current = _id); if(current != _id) glUseProgram(current = _id);
} }
@ -361,7 +406,7 @@ bool AbstractShaderProgram::link(std::initializer_list<std::reference_wrapper<Ab
/* Show error log */ /* Show error log */
if(!success) { if(!success) {
auto out = Error::noNewlineAtTheEnd(); Error out{Debug::Flag::NoNewlineAtTheEnd};
out << "AbstractShaderProgram::link(): linking"; out << "AbstractShaderProgram::link(): linking";
if(shaders.size() != 1) { if(shaders.size() != 1) {
#if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID)
@ -374,7 +419,7 @@ bool AbstractShaderProgram::link(std::initializer_list<std::reference_wrapper<Ab
/* Or just warnings, if any */ /* Or just warnings, if any */
} else if(!message.empty() && !Implementation::isProgramLinkLogEmpty(message)) { } else if(!message.empty() && !Implementation::isProgramLinkLogEmpty(message)) {
auto out = Warning::noNewlineAtTheEnd(); Warning out{Debug::Flag::NoNewlineAtTheEnd};
out << "AbstractShaderProgram::link(): linking"; out << "AbstractShaderProgram::link(): linking";
if(shaders.size() != 1) { if(shaders.size() != 1) {
#if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID) #if !defined(CORRADE_TARGET_NACL_NEWLIB) && !defined(CORRADE_TARGET_ANDROID)
@ -395,14 +440,23 @@ bool AbstractShaderProgram::link(std::initializer_list<std::reference_wrapper<Ab
} }
Int AbstractShaderProgram::uniformLocationInternal(const Containers::ArrayView<const char> name) { Int AbstractShaderProgram::uniformLocationInternal(const Containers::ArrayView<const char> name) {
GLint location = glGetUniformLocation(_id, name); const GLint location = glGetUniformLocation(_id, name);
if(location == -1) if(location == -1)
Warning() << "AbstractShaderProgram: location of uniform \'" + std::string{name, name.size()} + "\' cannot be retrieved!"; Warning() << "AbstractShaderProgram: location of uniform \'" << Debug::nospace << std::string{name, name.size()} << Debug::nospace << "\' cannot be retrieved";
return location; return location;
} }
#ifndef MAGNUM_TARGET_GLES2
UnsignedInt AbstractShaderProgram::uniformBlockIndexInternal(const Containers::ArrayView<const char> name) {
const GLuint index = glGetUniformBlockIndex(_id, name);
if(index == GL_INVALID_INDEX)
Warning() << "AbstractShaderProgram: index of uniform block \'" << Debug::nospace << std::string{name, name.size()} << Debug::nospace << "\' cannot be retrieved";
return index;
}
#endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Float> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Float> values) {
(this->*Context::current()->state().shaderProgram->uniform1fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform1fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLfloat* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLfloat* const values) {
@ -430,7 +484,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniform2fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform2fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLfloat>* const values) {
@ -458,7 +512,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniform3fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform3fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLfloat>* const values) {
@ -486,7 +540,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniform4fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform4fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLfloat>* const values) {
@ -514,7 +568,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Int> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Int> values) {
(this->*Context::current()->state().shaderProgram->uniform1ivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform1ivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLint* values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLint* values) {
@ -542,7 +596,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, Int>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, Int>> values) {
(this->*Context::current()->state().shaderProgram->uniform2ivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform2ivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLint>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLint>* const values) {
@ -570,7 +624,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, Int>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, Int>> values) {
(this->*Context::current()->state().shaderProgram->uniform3ivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform3ivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLint>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLint>* const values) {
@ -598,7 +652,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, Int>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, Int>> values) {
(this->*Context::current()->state().shaderProgram->uniform4ivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform4ivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLint>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLint>* const values) {
@ -627,7 +681,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const UnsignedInt> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const UnsignedInt> values) {
(this->*Context::current()->state().shaderProgram->uniform1uivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform1uivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLuint* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLuint* const values) {
@ -646,7 +700,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, UnsignedInt>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, UnsignedInt>> values) {
(this->*Context::current()->state().shaderProgram->uniform2uivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform2uivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLuint>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLuint>* const values) {
@ -665,7 +719,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, UnsignedInt>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, UnsignedInt>> values) {
(this->*Context::current()->state().shaderProgram->uniform3uivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform3uivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLuint>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLuint>* const values) {
@ -684,7 +738,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, UnsignedInt>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, UnsignedInt>> values) {
(this->*Context::current()->state().shaderProgram->uniform4uivImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform4uivImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLuint>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLuint>* const values) {
@ -705,7 +759,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Double> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Double> values) {
(this->*Context::current()->state().shaderProgram->uniform1dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform1dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLdouble* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const GLdouble* const values) {
@ -722,7 +776,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<2, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniform2dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform2dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<2, GLdouble>* const values) {
@ -739,7 +793,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<3, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniform3dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform3dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<3, GLdouble>* const values) {
@ -756,7 +810,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::Vector<4, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniform4dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniform4dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::Vector<4, GLdouble>* const values) {
@ -774,7 +828,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 2, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 2, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix2fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* const values) {
@ -802,7 +856,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 3, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 3, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix3fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* const values) {
@ -830,7 +884,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 4, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 4, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix4fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* const values) {
@ -859,7 +913,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 3, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 3, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x3fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix2x3fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* const values) {
@ -878,7 +932,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 2, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 2, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x2fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix3x2fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* const values) {
@ -897,7 +951,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 4, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 4, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x4fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix2x4fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* const values) {
@ -916,7 +970,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 2, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 2, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x2fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix4x2fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* const values) {
@ -935,7 +989,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 4, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 4, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x4fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix3x4fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* const values) {
@ -954,7 +1008,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#endif #endif
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 3, Float>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 3, Float>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x3fvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix4x3fvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* const values) {
@ -975,7 +1029,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 2, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 2, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix2dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLdouble>* const values) {
@ -992,7 +1046,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 3, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 3, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix3dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLdouble>* const values) {
@ -1009,7 +1063,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 4, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 4, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix4dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLdouble>* const values) {
@ -1026,7 +1080,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 3, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 3, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x3dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix2x3dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLdouble>* const values) {
@ -1043,7 +1097,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 2, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 2, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x2dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix3x2dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLdouble>* const values) {
@ -1060,7 +1114,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 4, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<2, 4, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix2x4dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix2x4dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLdouble>* const values) {
@ -1077,7 +1131,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 2, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 2, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x2dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix4x2dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLdouble>* const values) {
@ -1094,7 +1148,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 4, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<3, 4, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix3x4dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix3x4dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLdouble>* const values) {
@ -1111,7 +1165,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT(const GLint location, co
} }
void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 3, Double>> values) { void AbstractShaderProgram::setUniform(const Int location, const Containers::ArrayView<const Math::RectangularMatrix<4, 3, Double>> values) {
(this->*Context::current()->state().shaderProgram->uniformMatrix4x3dvImplementation)(location, values.size(), values); (this->*Context::current().state().shaderProgram->uniformMatrix4x3dvImplementation)(location, values.size(), values);
} }
void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLdouble>* const values) { void AbstractShaderProgram::uniformImplementationDefault(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLdouble>* const values) {

230
src/Magnum/AbstractShaderProgram.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -99,9 +99,10 @@ MyShader& setNormalMatrix(const Matrix3x3& matrix) {
return *this; return *this;
} }
@endcode @endcode
- **Texture setting functions** in which you bind the textures - **Texture and texture image setting functions** in which you bind the
to particular texture units using @ref Texture::bind() "*Texture::bind()" textures/images to particular texture/image units using
and equivalents, for example: @ref Texture::bind() "*Texture::bind()" /
@ref Texture::bindImage() "*Texture::bindImage()" and similar, for example:
@code @code
MyShader& setDiffuseTexture(Texture2D& texture) { MyShader& setDiffuseTexture(Texture2D& texture) {
texture.bind(0); texture.bind(0);
@ -136,8 +137,8 @@ The preferred workflow is to specify attribute location for vertex shader input
attributes and fragment shader output attributes explicitly in the shader code, attributes and fragment shader output attributes explicitly in the shader code,
e.g.: e.g.:
@code @code
// GLSL 3.30, or // GLSL 3.30, GLSL ES 3.00 or
#extension GL_ARB_explicit_attrib_location: enable #extension GL_ARB_explicit_attrib_location: require
layout(location = 0) in vec4 position; layout(location = 0) in vec4 position;
layout(location = 1) in vec3 normal; layout(location = 1) in vec3 normal;
layout(location = 2) in vec2 textureCoordinates; layout(location = 2) in vec2 textureCoordinates;
@ -151,8 +152,8 @@ layout(location = 0, index = 0) out vec4 color;
layout(location = 1, index = 1) out vec3 normal; layout(location = 1, index = 1) out vec3 normal;
@endcode @endcode
If you don't have the required extension, declare the attributes without If you don't have the required version/extension, declare the attributes
`layout()` qualifier and use functions @ref bindAttributeLocation() and without `layout()` qualifier and use functions @ref bindAttributeLocation() and
@ref bindFragmentDataLocation() / @ref bindFragmentDataLocationIndexed() between @ref bindFragmentDataLocation() / @ref bindFragmentDataLocationIndexed() between
attaching the shaders and linking the program. Note that additional syntax attaching the shaders and linking the program. Note that additional syntax
changes may be needed for GLSL 1.20 and GLSL ES. changes may be needed for GLSL 1.20 and GLSL ES.
@ -178,7 +179,7 @@ bindFragmentDataLocationIndexed(NormalOutput, 1, "normal");
// Link... // Link...
@endcode @endcode
@see @ref Mesh::maxVertexAttributes(), @ref AbstractFramebuffer::maxDrawBuffers() @see @ref maxVertexAttributes(), @ref AbstractFramebuffer::maxDrawBuffers()
@requires_gl30 Extension @extension{EXT,gpu_shader4} for using @requires_gl30 Extension @extension{EXT,gpu_shader4} for using
@ref bindFragmentDataLocation(). @ref bindFragmentDataLocation().
@requires_gl33 Extension @extension{ARB,blend_func_extended} for using @requires_gl33 Extension @extension{ARB,blend_func_extended} for using
@ -208,15 +209,15 @@ bindFragmentDataLocationIndexed(NormalOutput, 1, "normal");
The preferred workflow is to specify uniform locations directly in the shader The preferred workflow is to specify uniform locations directly in the shader
code, e.g.: code, e.g.:
@code @code
// GLSL 4.30, or // GLSL 4.30, GLSL ES 3.10 or
#extension GL_ARB_explicit_uniform_location: enable #extension GL_ARB_explicit_uniform_location: require
layout(location = 0) uniform mat4 projectionMatrix; layout(location = 0) uniform mat4 projectionMatrix;
layout(location = 1) uniform mat4 transformationMatrix; layout(location = 1) uniform mat4 transformationMatrix;
layout(location = 2) uniform mat3 normalMatrix; layout(location = 2) uniform mat3 normalMatrix;
@endcode @endcode
If you don't have the required extension, declare the uniforms without the If you don't have the required version/extension, declare the uniforms without
`layout()` qualifier, get uniform location using @ref uniformLocation() *after* the `layout()` qualifier, get uniform location using @ref uniformLocation() *after*
linking stage and then use the queried location in uniform setting functions. linking stage and then use the queried location in uniform setting functions.
Note that additional syntax changes may be needed for GLSL 1.20 and GLSL ES. Note that additional syntax changes may be needed for GLSL 1.20 and GLSL ES.
@code @code
@ -238,22 +239,94 @@ Int normalMatrixUniform = uniformLocation("normalMatrix");
@requires_gles Explicit uniform location is not supported in WebGL. Use @requires_gles Explicit uniform location is not supported in WebGL. Use
@ref uniformLocation() instead. @ref uniformLocation() instead.
@anchor AbstractShaderProgram-uniform-block-binding
### Uniform block bindings
The preferred workflow is to specify uniform block binding directly in the
shader code, e.g.:
@code
// GLSL 4.20, GLSL ES 3.10 or
#extension GL_ARB_shading_language_420pack: require
layout(std140, binding = 0) uniform matrices {
mat4 projectionMatrix;
mat4 transformationMatrix;
};
layout(std140, binding = 1) uniform material {
vec4 diffuse;
vec4 specular;
};
@endcode
If you don't have the required version/extension, declare the uniform blocks
without the `layout()` qualifier, get uniform block index using
@ref uniformBlockIndex() and then map it to the uniform buffer binding using
@ref setUniformBlockBinding(). Note that additional syntax changes may be
needed for GLSL ES.
@code
layout(std140) uniform matrices {
mat4 projectionMatrix;
mat4 transformationMatrix;
};
layout(std140) uniform material {
vec4 diffuse;
vec4 specular;
};
@endcode
@code
setUniformBlockBinding(uniformBlockIndex("matrices"), 0);
setUniformBlockBinding(uniformBlockIndex("material"), 1);
@endcode
@see @ref Buffer::maxUniformBindings()
@requires_gl31 Extension @extension{ARB,uniform_buffer_object}
@requires_gl42 Extension @extension{ARB,shading_language_420pack} for explicit
uniform block binding instead of using @ref uniformBlockIndex() and
@ref setUniformBlockBinding().
@requires_gles30 Uniform buffers are not available in OpenGL ES 2.0.
@requires_gles31 Explicit uniform block binding is not supported in OpenGL ES
3.0 and older. Use @ref uniformBlockIndex() and @ref setUniformBlockBinding()
instead.
@requires_webgl20 Uniform buffers are not available in WebGL 1.0.
@requires_gles Explicit uniform block binding is not supported in WebGL. Use
@ref uniformBlockIndex() and @ref setUniformBlockBinding() instead.
@anchor AbstractShaderProgram-shader-storage-block-binding
### Shader storage block bindings
The workflow is to specify shader storage block binding directly in the shader
code, e.g.:
@code
// GLSL 4.30 or GLSL ES 3.10
layout(std430, binding = 0) buffer vertices {
vec3 position;
vec3 color;
};
layout(std430, binding = 1) buffer normals {
vec3 normal;
};
@endcode
@see @ref Buffer::maxShaderStorageBindings()
@requires_gl43 Extension @extension{ARB,shader_storage_buffer_object}
@requires_gles31 Shader storage is not available in OpenGL ES 3.0 and older.
@requires_gles Shader storage is not available in WebGL.
@anchor AbstractShaderProgram-texture-units @anchor AbstractShaderProgram-texture-units
### Specifying texture binding units ### Specifying texture and image binding units
The preferred workflow is to specify texture binding unit directly in the The preferred workflow is to specify texture/image binding unit directly in the
shader code, e.g.: shader code, e.g.:
@code @code
// GLSL 4.20, or // GLSL 4.20, GLSL ES 3.10 or
#extension GL_ARB_shading_language_420pack: enable #extension GL_ARB_shading_language_420pack: require
layout(binding = 0) uniform sampler2D diffuseTexture; layout(binding = 0) uniform sampler2D diffuseTexture;
layout(binding = 1) uniform sampler2D specularTexture; layout(binding = 1) uniform sampler2D specularTexture;
@endcode @endcode
If you don't have the required extension, declare the uniforms without the If you don't have the required version/extension, declare the uniforms without
`binding` qualifier and set the texture binding unit using the `binding` qualifier and set the texture binding unit using
@ref setUniform(Int, const T&) "setUniform(Int, Int)". Note that additional @ref setUniform(Int, const T&) "setUniform(Int, Int)". Note that additional
syntax changes may be needed for GLSL 1.20 and GLSL ES 1.0. syntax changes may be needed for GLSL ES.
@code @code
uniform sampler2D diffuseTexture; uniform sampler2D diffuseTexture;
uniform sampler2D specularTexture; uniform sampler2D specularTexture;
@ -263,7 +336,7 @@ setUniform(uniformLocation("diffuseTexture"), 0);
setUniform(uniformLocation("specularTexture"), 1); setUniform(uniformLocation("specularTexture"), 1);
@endcode @endcode
@see @ref Shader::maxTextureImageUnits() @see @ref Shader::maxTextureImageUnits(), @ref maxImageUnits()
@requires_gl42 Extension @extension{ARB,shading_language_420pack} for explicit @requires_gl42 Extension @extension{ARB,shading_language_420pack} for explicit
texture binding unit instead of using texture binding unit instead of using
@ref setUniform(Int, const T&) "setUniform(Int, Int)". @ref setUniform(Int, const T&) "setUniform(Int, Int)".
@ -280,7 +353,7 @@ The preferred workflow is to specify output binding points directly in the
shader code, e.g.: shader code, e.g.:
@code @code
// GLSL 4.40, or // GLSL 4.40, or
#extension GL_ARB_enhanced_layouts: enable #extension GL_ARB_enhanced_layouts: require
layout(xfb_buffer = 0, xfb_stride = 32) out block { layout(xfb_buffer = 0, xfb_stride = 32) out block {
layout(xfb_offset = 0) vec3 position; layout(xfb_offset = 0) vec3 position;
layout(xfb_offset = 16) vec3 normal; layout(xfb_offset = 16) vec3 normal;
@ -288,8 +361,8 @@ layout(xfb_buffer = 0, xfb_stride = 32) out block {
layout(xfb_buffer = 1) out vec3 velocity; layout(xfb_buffer = 1) out vec3 velocity;
@endcode @endcode
If you don't have the required extension, declare the uniforms without the If you don't have the required version/extension, declare the uniforms without
`xfb_*` qualifier and set the binding points using @ref setTransformFeedbackOutputs(). the `xfb_*` qualifier and set the binding points using @ref setTransformFeedbackOutputs().
Equivalent setup for the previous code would be the following: Equivalent setup for the previous code would be the following:
@code @code
out block { out block {
@ -310,14 +383,17 @@ setTransformFeedbackOutputs({
@see @ref TransformFeedback::maxInterleavedComponents(), @see @ref TransformFeedback::maxInterleavedComponents(),
@ref TransformFeedback::maxSeparateAttributes(), @ref TransformFeedback::maxSeparateAttributes(),
@ref TransformFeedback::maxSeparateComponents() @ref TransformFeedback::maxSeparateComponents()
@requires_gl40 Extension @extension{ARB,transform_feedback2}
@requires_gl40 Extension @extension{ARB,transform_feedback3} for using @requires_gl40 Extension @extension{ARB,transform_feedback3} for using
`gl_NextBuffer` or `gl_SkipComponents#` names in `gl_NextBuffer` or `gl_SkipComponents#` names in
@ref setTransformFeedbackOutputs() function. @ref setTransformFeedbackOutputs() function.
@requires_gl44 Extension @extension{ARB,enhanced_layouts} for explicit @requires_gl44 Extension @extension{ARB,enhanced_layouts} for explicit
transform feedback output specification instead of using transform feedback output specification instead of using
@ref setTransformFeedbackOutputs(). @ref setTransformFeedbackOutputs().
@requires_gles30 Transform feedback is not available in OpenGL ES 2.0.
@requires_gl Explicit transform feedback output specification is not available @requires_gl Explicit transform feedback output specification is not available
in OpenGL ES or WebGL. in OpenGL ES or WebGL.
@requires_webgl20 Transform feedback is not available in WebGL 1.0.
@anchor AbstractShaderProgram-rendering-workflow @anchor AbstractShaderProgram-rendering-workflow
## Rendering workflow ## Rendering workflow
@ -337,6 +413,13 @@ shader.setTransformation(transformation)
mesh.draw(shader); mesh.draw(shader);
@endcode @endcode
@anchor AbstractShaderProgram-compute-workflow
## Compute workflow
Add just the @ref Shader::Type::Compute shader and implement uniform/texture
setting functions as needed. After setting up required parameters call
@ref dispatchCompute().
@anchor AbstractShaderProgram-types @anchor AbstractShaderProgram-types
## Mapping between GLSL and Magnum types ## Mapping between GLSL and Magnum types
@ -464,7 +547,31 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
*/ */
static Int maxComputeWorkGroupInvocations(); static Int maxComputeWorkGroupInvocations();
/** @todo MAX_COMPUTE_WORK_GROUP_COUNT, MAX_COMPUTE_WORK_GROUP_SIZE */ /**
* @brief Max supported compute work group count
*
* The result is cached, repeated queries don't result in repeated
* OpenGL calls. If neither extension @extension{ARB,compute_shader}
* (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns zero
* vector.
* @see @fn_gl{Get} with @def_gl{MAX_COMPUTE_WORK_GROUP_COUNT}
* @requires_gles30 Not defined in OpenGL ES 2.0.
* @requires_gles Compute shaders are not available in WebGL.
*/
static Vector3i maxComputeWorkGroupCount();
/**
* @brief Max supported compute work group size
*
* The result is cached, repeated queries don't result in repeated
* OpenGL calls. If neither extension @extension{ARB,compute_shader}
* (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns zero
* vector.
* @see @fn_gl{Get} with @def_gl{MAX_COMPUTE_WORK_GROUP_SIZE}
* @requires_gles30 Not defined in OpenGL ES 2.0.
* @requires_gles Compute shaders are not available in WebGL.
*/
static Vector3i maxComputeWorkGroupSize();
/** /**
* @brief Max supported image unit count * @brief Max supported image unit count
@ -656,6 +763,21 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
*/ */
std::pair<bool, std::string> validate(); std::pair<bool, std::string> validate();
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/**
* @brief Dispatch compute
* @param workgroupCount Workgroup count in given dimension
*
* Valid only on programs with compute shader attached.
* @see @fn_gl{DispatchCompute}
* @requires_gl43 Extension @extension{ARB,compute_shader}
* @requires_gles31 Compute shaders are not available in OpenGL ES 3.0
* and older.
* @requires_gles Compute shaders are not available in WebGL.
*/
void dispatchCompute(const Vector3ui& workgroupCount);
#endif
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
/** /**
* @brief Use shader for rendering * @brief Use shader for rendering
@ -858,7 +980,9 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Get uniform location * @brief Get uniform location
* @param name Uniform name * @param name Uniform name
* *
* @see @fn_gl{GetUniformLocation} * If given uniform is not found in the linked shader, a warning is
* printed and `-1` is returned.
* @see @ref setUniform(), @fn_gl{GetUniformLocation}
* @deprecated_gl Preferred usage is to specify uniform location * @deprecated_gl Preferred usage is to specify uniform location
* explicitly in the shader instead of using this function. See * explicitly in the shader instead of using this function. See
* @ref AbstractShaderProgram-uniform-location "class documentation" * @ref AbstractShaderProgram-uniform-location "class documentation"
@ -873,6 +997,32 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
return uniformLocationInternal({name, size - 1}); return uniformLocationInternal({name, size - 1});
} }
#ifndef MAGNUM_TARGET_GLES2
/**
* @brief Get uniform block index
* @param name Uniform block name
*
* If given uniform block name is not found in the linked shader, a
* warning is printed and `0xffffffffu` is returned.
* @see @ref setUniformBlockBinding(), @fn_gl{GetUniformBlockIndex}
* @requires_gl31 Extension @extension{ARB,uniform_buffer_object}
* @requires_gles30 Uniform buffers are not available in OpenGL ES 2.0.
* @requires_webgl20 Uniform buffers are not available in WebGL 1.0.
* @deprecated_gl Preferred usage is to specify uniform block binding
* explicitly in the shader instead of using this function. See
* @ref AbstractShaderProgram-uniform-block-binding "class documentation"
* for more information.
*/
UnsignedInt uniformBlockIndex(const std::string& name) {
return uniformBlockIndexInternal({name.data(), name.size()});
}
/** @overload */
template<std::size_t size> UnsignedInt uniformBlockIndex(const char(&name)[size]) {
return uniformBlockIndexInternal({name, size - 1});
}
#endif
/** /**
* @brief Set uniform value * @brief Set uniform value
* @param location Uniform location * @param location Uniform location
@ -881,6 +1031,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* Convenience alternative for setting one value, see * Convenience alternative for setting one value, see
* @ref setUniform(Int, Containers::ArrayView<const Float>) for more * @ref setUniform(Int, Containers::ArrayView<const Float>) for more
* information. * information.
* @see @ref uniformLocation()
*/ */
#ifdef DOXYGEN_GENERATING_OUTPUT #ifdef DOXYGEN_GENERATING_OUTPUT
template<class T> inline void setUniform(Int location, const T& value); template<class T> inline void setUniform(Int location, const T& value);
@ -919,8 +1070,9 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @es_extension{EXT,separate_shader_objects} OpenGL ES extension nor * @es_extension{EXT,separate_shader_objects} OpenGL ES extension nor
* OpenGL ES 3.1 is available, the shader is marked for use before the * OpenGL ES 3.1 is available, the shader is marked for use before the
* operation. * operation.
* @see @ref setUniform(Int, const T&), @fn_gl{UseProgram}, @fn_gl{Uniform} * @see @ref setUniform(Int, const T&), @ref uniformLocation(),
* or @fn_gl{ProgramUniform}/@fn_gl_extension{ProgramUniform,EXT,direct_state_access}. * @fn_gl{UseProgram}, @fn_gl{Uniform} or @fn_gl{ProgramUniform}/
* @fn_gl_extension{ProgramUniform,EXT,direct_state_access}.
*/ */
void setUniform(Int location, Containers::ArrayView<const Float> values); void setUniform(Int location, Containers::ArrayView<const Float> values);
void setUniform(Int location, Containers::ArrayView<const Math::Vector<2, Float>> values); /**< @overload */ void setUniform(Int location, Containers::ArrayView<const Math::Vector<2, Float>> values); /**< @overload */
@ -1005,6 +1157,27 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES2
/**
* @brief Set uniform block binding
* @param index Uniform block index
* @param binding Uniform block binding
*
* @see @ref uniformBlockIndex(), @ref Buffer::maxUniformBindings(),
* @fn_gl{UniformBlockBinding}
* @requires_gl31 Extension @extension{ARB,uniform_buffer_object}
* @requires_gles30 Uniform buffers are not available in OpenGL ES 2.0.
* @requires_webgl20 Uniform buffers are not available in WebGL 1.0.
* @deprecated_gl Preferred usage is to specify uniform block binding
* explicitly in the shader instead of using this function. See
* @ref AbstractShaderProgram-uniform-block-binding "class documentation"
* for more information.
*/
void setUniformBlockBinding(UnsignedInt index, UnsignedInt binding) {
glUniformBlockBinding(_id, index, binding);
}
#endif
private: private:
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
AbstractShaderProgram& setLabelInternal(Containers::ArrayView<const char> label); AbstractShaderProgram& setLabelInternal(Containers::ArrayView<const char> label);
@ -1014,6 +1187,7 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
void bindFragmentDataLocationIndexedInternal(UnsignedInt location, UnsignedInt index, Containers::ArrayView<const char> name); void bindFragmentDataLocationIndexedInternal(UnsignedInt location, UnsignedInt index, Containers::ArrayView<const char> name);
void bindFragmentDataLocationInternal(UnsignedInt location, Containers::ArrayView<const char> name); void bindFragmentDataLocationInternal(UnsignedInt location, Containers::ArrayView<const char> name);
Int uniformLocationInternal(Containers::ArrayView<const char> name); Int uniformLocationInternal(Containers::ArrayView<const char> name);
UnsignedInt uniformBlockIndexInternal(Containers::ArrayView<const char> name);
#ifndef MAGNUM_BUILD_DEPRECATED #ifndef MAGNUM_BUILD_DEPRECATED
void use(); void use();

360
src/Magnum/AbstractTexture.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -49,7 +49,7 @@ namespace Magnum {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
Float AbstractTexture::maxLodBias() { Float AbstractTexture::maxLodBias() {
GLfloat& value = Context::current()->state().texture->maxLodBias; GLfloat& value = Context::current().state().texture->maxLodBias;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0.0f) if(value == 0.0f)
@ -62,13 +62,13 @@ Float AbstractTexture::maxLodBias() {
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Int AbstractTexture::maxColorSamples() { Int AbstractTexture::maxColorSamples() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().texture->maxColorSamples; GLint& value = Context::current().state().texture->maxColorSamples;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0)
@ -79,13 +79,13 @@ Int AbstractTexture::maxColorSamples() {
Int AbstractTexture::maxDepthSamples() { Int AbstractTexture::maxDepthSamples() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().texture->maxDepthSamples; GLint& value = Context::current().state().texture->maxDepthSamples;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0)
@ -96,13 +96,13 @@ Int AbstractTexture::maxDepthSamples() {
Int AbstractTexture::maxIntegerSamples() { Int AbstractTexture::maxIntegerSamples() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
#else #else
if(!Context::current()->isVersionSupported(Version::GLES310)) if(!Context::current().isVersionSupported(Version::GLES310))
#endif #endif
return 0; return 0;
GLint& value = Context::current()->state().texture->maxIntegerSamples; GLint& value = Context::current().state().texture->maxIntegerSamples;
/* Get the value, if not already cached */ /* Get the value, if not already cached */
if(value == 0) if(value == 0)
@ -113,18 +113,18 @@ Int AbstractTexture::maxIntegerSamples() {
#endif #endif
void AbstractTexture::unbind(const Int textureUnit) { void AbstractTexture::unbind(const Int textureUnit) {
Implementation::TextureState& textureState = *Context::current()->state().texture; Implementation::TextureState& textureState = *Context::current().state().texture;
/* If given texture unit is already unbound, nothing to do */ /* If given texture unit is already unbound, nothing to do */
if(textureState.bindings[textureUnit].second == 0) return; if(textureState.bindings[textureUnit].second == 0) return;
/* Unbind the texture, reset state tracker */ /* Unbind the texture, reset state tracker */
Context::current()->state().texture->unbindImplementation(textureUnit); Context::current().state().texture->unbindImplementation(textureUnit);
textureState.bindings[textureUnit] = {}; textureState.bindings[textureUnit] = {};
} }
void AbstractTexture::unbindImplementationDefault(const GLint textureUnit) { void AbstractTexture::unbindImplementationDefault(const GLint textureUnit) {
Implementation::TextureState& textureState = *Context::current()->state().texture; Implementation::TextureState& textureState = *Context::current().state().texture;
/* Activate given texture unit if not already active, update state tracker */ /* Activate given texture unit if not already active, update state tracker */
if(textureState.currentTextureUnit != textureUnit) if(textureState.currentTextureUnit != textureUnit)
@ -141,12 +141,12 @@ void AbstractTexture::unbindImplementationMulti(const GLint textureUnit) {
} }
void AbstractTexture::unbindImplementationDSA(const GLint textureUnit) { void AbstractTexture::unbindImplementationDSA(const GLint textureUnit) {
CORRADE_INTERNAL_ASSERT(Context::current()->state().texture->bindings[textureUnit].first != 0); CORRADE_INTERNAL_ASSERT(Context::current().state().texture->bindings[textureUnit].first != 0);
glBindTextureUnit(textureUnit, 0); glBindTextureUnit(textureUnit, 0);
} }
void AbstractTexture::unbindImplementationDSAEXT(const GLint textureUnit) { void AbstractTexture::unbindImplementationDSAEXT(const GLint textureUnit) {
Implementation::TextureState& textureState = *Context::current()->state().texture; Implementation::TextureState& textureState = *Context::current().state().texture;
CORRADE_INTERNAL_ASSERT(textureState.bindings[textureUnit].first != 0); CORRADE_INTERNAL_ASSERT(textureState.bindings[textureUnit].first != 0);
glBindMultiTextureEXT(GL_TEXTURE0 + textureUnit, textureState.bindings[textureUnit].first, 0); glBindMultiTextureEXT(GL_TEXTURE0 + textureUnit, textureState.bindings[textureUnit].first, 0);
@ -155,13 +155,13 @@ void AbstractTexture::unbindImplementationDSAEXT(const GLint textureUnit) {
void AbstractTexture::unbind(const Int firstTextureUnit, const std::size_t count) { void AbstractTexture::unbind(const Int firstTextureUnit, const std::size_t count) {
/* State tracker is updated in the implementations */ /* State tracker is updated in the implementations */
Context::current()->state().texture->bindMultiImplementation(firstTextureUnit, {nullptr, count}); Context::current().state().texture->bindMultiImplementation(firstTextureUnit, {nullptr, count});
} }
/** @todoc const std::initializer_list makes Doxygen grumpy */ /** @todoc const std::initializer_list makes Doxygen grumpy */
void AbstractTexture::bind(const Int firstTextureUnit, std::initializer_list<AbstractTexture*> textures) { void AbstractTexture::bind(const Int firstTextureUnit, std::initializer_list<AbstractTexture*> textures) {
/* State tracker is updated in the implementations */ /* State tracker is updated in the implementations */
Context::current()->state().texture->bindMultiImplementation(firstTextureUnit, {textures.begin(), textures.size()}); Context::current().state().texture->bindMultiImplementation(firstTextureUnit, {textures.begin(), textures.size()});
} }
void AbstractTexture::bindImplementationFallback(const GLint firstTextureUnit, const Containers::ArrayView<AbstractTexture* const> textures) { void AbstractTexture::bindImplementationFallback(const GLint firstTextureUnit, const Containers::ArrayView<AbstractTexture* const> textures) {
@ -172,7 +172,7 @@ void AbstractTexture::bindImplementationFallback(const GLint firstTextureUnit, c
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/** @todoc const Containers::ArrayView makes Doxygen grumpy */ /** @todoc const Containers::ArrayView makes Doxygen grumpy */
void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, Containers::ArrayView<AbstractTexture* const> textures) { void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, Containers::ArrayView<AbstractTexture* const> textures) {
Implementation::TextureState& textureState = *Context::current()->state().texture; Implementation::TextureState& textureState = *Context::current().state().texture;
/* Create array of IDs and also update bindings in state tracker */ /* Create array of IDs and also update bindings in state tracker */
/** @todo VLAs */ /** @todo VLAs */
@ -197,8 +197,25 @@ void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, Cont
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES
Int AbstractTexture::compressedBlockDataSize(const GLenum target, const TextureFormat format) {
return (Context::current().state().texture->compressedBlockDataSizeImplementation)(target, format);
}
Int AbstractTexture::compressedBlockDataSizeImplementationDefault(const GLenum target, const TextureFormat format) {
GLint value;
glGetInternalformativ(target, GLenum(format), GL_TEXTURE_COMPRESSED_BLOCK_SIZE, 1, &value);
return value;
}
Int AbstractTexture::compressedBlockDataSizeImplementationBitsWorkaround(const GLenum target, const TextureFormat format) {
/* NVidia (358.16) reports the value in bits instead of bytes */
return compressedBlockDataSizeImplementationDefault(target, format)/8;
}
#endif
AbstractTexture::AbstractTexture(GLenum target): _target{target}, _flags{ObjectFlag::DeleteOnDestruction} { AbstractTexture::AbstractTexture(GLenum target): _target{target}, _flags{ObjectFlag::DeleteOnDestruction} {
(this->*Context::current()->state().texture->createImplementation)(); (this->*Context::current().state().texture->createImplementation)();
CORRADE_INTERNAL_ASSERT(_id != Implementation::State::DisengagedBinding); CORRADE_INTERNAL_ASSERT(_id != Implementation::State::DisengagedBinding);
} }
@ -218,12 +235,19 @@ AbstractTexture::~AbstractTexture() {
if(!_id || !(_flags & ObjectFlag::DeleteOnDestruction)) return; if(!_id || !(_flags & ObjectFlag::DeleteOnDestruction)) return;
/* Remove all bindings */ /* Remove all bindings */
for(auto& binding: Context::current()->state().texture->bindings) for(auto& binding: Context::current().state().texture->bindings) {
{
/* MSVC 2015 needs the parentheses around */ /* MSVC 2015 needs the parentheses around */
if(binding.second == _id) binding = {}; if(binding.second == _id) binding = {};
} }
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/* Remove all image bindings */
for(auto& binding: Context::current().state().texture->imageBindings) {
/* MSVC 2015 needs the parentheses around */
if(std::get<0>(binding) == _id) binding = {};
}
#endif
glDeleteTextures(1, &_id); glDeleteTextures(1, &_id);
} }
@ -242,18 +266,74 @@ void AbstractTexture::createIfNotAlready() {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
std::string AbstractTexture::label() { std::string AbstractTexture::label() {
createIfNotAlready(); createIfNotAlready();
return Context::current()->state().debug->getLabelImplementation(GL_TEXTURE, _id); return Context::current().state().debug->getLabelImplementation(GL_TEXTURE, _id);
} }
AbstractTexture& AbstractTexture::setLabelInternal(const Containers::ArrayView<const char> label) { AbstractTexture& AbstractTexture::setLabelInternal(const Containers::ArrayView<const char> label) {
createIfNotAlready(); createIfNotAlready();
Context::current()->state().debug->labelImplementation(GL_TEXTURE, _id, label); Context::current().state().debug->labelImplementation(GL_TEXTURE, _id, label);
return *this; return *this;
} }
#endif #endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::unbindImage(const Int imageUnit) {
Implementation::TextureState& textureState = *Context::current().state().texture;
/* If already unbound in given image unit, nothing to do */
if(std::get<0>(textureState.imageBindings[imageUnit]) == 0) return;
/* Update state tracker, bind the texture to the unit */
std::get<0>(textureState.imageBindings[imageUnit]) = 0;
glBindImageTexture(imageUnit, 0, 0, false, 0, GL_READ_ONLY, GL_R8);
}
#ifndef MAGNUM_TARGET_GLES
/** @todoc const Containers::ArrayView makes Doxygen grumpy */
void AbstractTexture::bindImagesInternal(const Int firstImageUnit, Containers::ArrayView<AbstractTexture* const> textures) {
Implementation::TextureState& textureState = *Context::current().state().texture;
/* Create array of IDs and also update bindings in state tracker */
Containers::Array<GLuint> ids{textures ? textures.size() : 0};
bool different = false;
for(std::size_t i = 0; i != textures.size(); ++i) {
const std::tuple<GLuint, GLint, GLboolean, GLint, GLenum> state = textures && textures[i] ?
std::tuple<GLuint, GLint, GLboolean, GLint, GLenum>(textures[i]->_id, 0, true, 0, GL_READ_WRITE) :
std::tuple<GLuint, GLint, GLboolean, GLint, GLenum>(0, 0, false, 0, GL_READ_ONLY);
if(textures) {
if(textures[i]) {
textures[i]->createIfNotAlready();
}
ids[i] = std::get<0>(state);
}
if(textureState.imageBindings[firstImageUnit + i] != state) {
different = true;
textureState.imageBindings[firstImageUnit + i] = state;
}
}
/* Avoid doing the binding if there is nothing different */
if(different) glBindImageTextures(firstImageUnit, textures.size(), ids);
}
#endif
void AbstractTexture::bindImageInternal(const Int imageUnit, const Int level, const bool layered, const Int layer, const ImageAccess access, const ImageFormat format) {
Implementation::TextureState& textureState = *Context::current().state().texture;
const std::tuple<GLuint, GLint, GLboolean, GLint, GLenum> state{_id, level, layered, layer, GLenum(access)};
/* If already bound in given texture unit, nothing to do */
if(textureState.imageBindings[imageUnit] == state) return;
/* Update state tracker, bind the texture to the unit */
textureState.imageBindings[imageUnit] = state;
glBindImageTexture(imageUnit, _id, level, layered, layer, GLenum(access), GLenum(format));
}
#endif
void AbstractTexture::bind(Int textureUnit) { void AbstractTexture::bind(Int textureUnit) {
Implementation::TextureState& textureState = *Context::current()->state().texture; Implementation::TextureState& textureState = *Context::current().state().texture;
/* If already bound in given texture unit, nothing to do */ /* If already bound in given texture unit, nothing to do */
if(textureState.bindings[textureUnit].second == _id) return; if(textureState.bindings[textureUnit].second == _id) return;
@ -264,7 +344,7 @@ void AbstractTexture::bind(Int textureUnit) {
} }
void AbstractTexture::bindImplementationDefault(GLint textureUnit) { void AbstractTexture::bindImplementationDefault(GLint textureUnit) {
Implementation::TextureState& textureState = *Context::current()->state().texture; Implementation::TextureState& textureState = *Context::current().state().texture;
/* Activate given texture unit if not already active, update state tracker */ /* Activate given texture unit if not already active, update state tracker */
if(textureState.currentTextureUnit != textureUnit) if(textureState.currentTextureUnit != textureUnit)
@ -293,13 +373,13 @@ void AbstractTexture::bindImplementationDSAEXT(GLint textureUnit) {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::setBaseLevel(Int level) { void AbstractTexture::setBaseLevel(Int level) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_BASE_LEVEL, level); (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_BASE_LEVEL, level);
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::setMaxLevel(Int level) { void AbstractTexture::setMaxLevel(Int level) {
(this->*Context::current()->state().texture->parameteriImplementation)( (this->*Context::current().state().texture->parameteriImplementation)(
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GL_TEXTURE_MAX_LEVEL GL_TEXTURE_MAX_LEVEL
#else #else
@ -310,32 +390,32 @@ void AbstractTexture::setMaxLevel(Int level) {
#endif #endif
void AbstractTexture::setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap) { void AbstractTexture::setMinificationFilter(Sampler::Filter filter, Sampler::Mipmap mipmap) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_MIN_FILTER, GLint(filter)|GLint(mipmap)); (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_MIN_FILTER, GLint(filter)|GLint(mipmap));
} }
void AbstractTexture::setMagnificationFilter(const Sampler::Filter filter) { void AbstractTexture::setMagnificationFilter(const Sampler::Filter filter) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_MAG_FILTER, GLint(filter)); (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_MAG_FILTER, GLint(filter));
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::setMinLod(const Float lod) { void AbstractTexture::setMinLod(const Float lod) {
(this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_MIN_LOD, lod); (this->*Context::current().state().texture->parameterfImplementation)(GL_TEXTURE_MIN_LOD, lod);
} }
void AbstractTexture::setMaxLod(const Float lod) { void AbstractTexture::setMaxLod(const Float lod) {
(this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_MAX_LOD, lod); (this->*Context::current().state().texture->parameterfImplementation)(GL_TEXTURE_MAX_LOD, lod);
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::setLodBias(const Float bias) { void AbstractTexture::setLodBias(const Float bias) {
(this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_LOD_BIAS, bias); (this->*Context::current().state().texture->parameterfImplementation)(GL_TEXTURE_LOD_BIAS, bias);
} }
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
void AbstractTexture::setBorderColor(const Color4& color) { void AbstractTexture::setBorderColor(const Color4& color) {
(this->*Context::current()->state().texture->parameterfvImplementation)( (this->*Context::current().state().texture->parameterfvImplementation)(
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
GL_TEXTURE_BORDER_COLOR, GL_TEXTURE_BORDER_COLOR,
#else #else
@ -346,7 +426,7 @@ void AbstractTexture::setBorderColor(const Color4& color) {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::setBorderColor(const Vector4ui& color) { void AbstractTexture::setBorderColor(const Vector4ui& color) {
(this->*Context::current()->state().texture->parameterIuivImplementation)( (this->*Context::current().state().texture->parameterIuivImplementation)(
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
GL_TEXTURE_BORDER_COLOR, GL_TEXTURE_BORDER_COLOR,
#else #else
@ -356,7 +436,7 @@ void AbstractTexture::setBorderColor(const Vector4ui& color) {
} }
void AbstractTexture::setBorderColor(const Vector4i& color) { void AbstractTexture::setBorderColor(const Vector4i& color) {
(this->*Context::current()->state().texture->parameterIivImplementation)( (this->*Context::current().state().texture->parameterIivImplementation)(
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
GL_TEXTURE_BORDER_COLOR, GL_TEXTURE_BORDER_COLOR,
#else #else
@ -368,12 +448,12 @@ void AbstractTexture::setBorderColor(const Vector4i& color) {
#endif #endif
void AbstractTexture::setMaxAnisotropy(const Float anisotropy) { void AbstractTexture::setMaxAnisotropy(const Float anisotropy) {
(this->*Context::current()->state().texture->setMaxAnisotropyImplementation)(anisotropy); (this->*Context::current().state().texture->setMaxAnisotropyImplementation)(anisotropy);
} }
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
void AbstractTexture::setSRGBDecode(bool decode) { void AbstractTexture::setSRGBDecode(bool decode) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_SRGB_DECODE_EXT, (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_SRGB_DECODE_EXT,
decode ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT); decode ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT);
} }
#endif #endif
@ -382,19 +462,19 @@ void AbstractTexture::setSRGBDecode(bool decode) {
void AbstractTexture::setSwizzleInternal(const GLint r, const GLint g, const GLint b, const GLint a) { void AbstractTexture::setSwizzleInternal(const GLint r, const GLint g, const GLint b, const GLint a) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const GLint rgba[] = {r, g, b, a}; const GLint rgba[] = {r, g, b, a};
(this->*Context::current()->state().texture->parameterivImplementation)(GL_TEXTURE_SWIZZLE_RGBA, rgba); (this->*Context::current().state().texture->parameterivImplementation)(GL_TEXTURE_SWIZZLE_RGBA, rgba);
#else #else
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_R, r); (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_R, r);
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_G, g); (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_G, g);
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_B, b); (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_B, b);
(this->*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_A, a); (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_SWIZZLE_A, a);
#endif #endif
} }
#endif #endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::setCompareMode(const Sampler::CompareMode mode) { void AbstractTexture::setCompareMode(const Sampler::CompareMode mode) {
(this->*Context::current()->state().texture->parameteriImplementation)( (this->*Context::current().state().texture->parameteriImplementation)(
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GL_TEXTURE_COMPARE_MODE GL_TEXTURE_COMPARE_MODE
#else #else
@ -404,7 +484,7 @@ void AbstractTexture::setCompareMode(const Sampler::CompareMode mode) {
} }
void AbstractTexture::setCompareFunction(const Sampler::CompareFunction function) { void AbstractTexture::setCompareFunction(const Sampler::CompareFunction function) {
(this->*Context::current()->state().texture->parameteriImplementation)( (this->*Context::current().state().texture->parameteriImplementation)(
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
GL_TEXTURE_COMPARE_FUNC GL_TEXTURE_COMPARE_FUNC
#else #else
@ -416,16 +496,16 @@ void AbstractTexture::setCompareFunction(const Sampler::CompareFunction function
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::setDepthStencilMode(const Sampler::DepthStencilMode mode) { void AbstractTexture::setDepthStencilMode(const Sampler::DepthStencilMode mode) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_DEPTH_STENCIL_TEXTURE_MODE, GLenum(mode)); (this->*Context::current().state().texture->parameteriImplementation)(GL_DEPTH_STENCIL_TEXTURE_MODE, GLenum(mode));
} }
#endif #endif
void AbstractTexture::invalidateImage(const Int level) { void AbstractTexture::invalidateImage(const Int level) {
(this->*Context::current()->state().texture->invalidateImageImplementation)(level); (this->*Context::current().state().texture->invalidateImageImplementation)(level);
} }
void AbstractTexture::generateMipmap() { void AbstractTexture::generateMipmap() {
(this->*Context::current()->state().texture->mipmapImplementation)(); (this->*Context::current().state().texture->mipmapImplementation)();
} }
void AbstractTexture::mipmapImplementationDefault() { void AbstractTexture::mipmapImplementationDefault() {
@ -449,7 +529,7 @@ void AbstractTexture::bindInternal() {
functions need to have the texture bound in *currently active* unit, functions need to have the texture bound in *currently active* unit,
so we would need to call glActiveTexture() afterwards anyway. */ so we would need to call glActiveTexture() afterwards anyway. */
Implementation::TextureState& textureState = *Context::current()->state().texture; Implementation::TextureState& textureState = *Context::current().state().texture;
/* If the texture is already bound in current unit, nothing to do */ /* If the texture is already bound in current unit, nothing to do */
if(textureState.bindings[textureState.currentTextureUnit].second == _id) if(textureState.bindings[textureState.currentTextureUnit].second == _id)
@ -1090,23 +1170,23 @@ void AbstractTexture::parameterIImplementationDSAEXT(GLenum parameter, const GLi
void AbstractTexture::setMaxAnisotropyImplementationNoOp(GLfloat) {} void AbstractTexture::setMaxAnisotropyImplementationNoOp(GLfloat) {}
void AbstractTexture::setMaxAnisotropyImplementationExt(GLfloat anisotropy) { void AbstractTexture::setMaxAnisotropyImplementationExt(GLfloat anisotropy) {
(this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); (this->*Context::current().state().texture->parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
} }
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::getLevelParameterImplementationDefault(const GLenum target, const GLint level, const GLenum parameter, GLint* const values) { void AbstractTexture::getLevelParameterImplementationDefault(const GLint level, const GLenum parameter, GLint* const values) {
bindInternal(); bindInternal();
glGetTexLevelParameteriv(target, level, parameter, values); glGetTexLevelParameteriv(_target, level, parameter, values);
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::getLevelParameterImplementationDSA(GLenum, const GLint level, const GLenum parameter, GLint* const values) { void AbstractTexture::getLevelParameterImplementationDSA(const GLint level, const GLenum parameter, GLint* const values) {
glGetTextureLevelParameteriv(_id, level, parameter, values); glGetTextureLevelParameteriv(_id, level, parameter, values);
} }
void AbstractTexture::getLevelParameterImplementationDSAEXT(const GLenum target, const GLint level, const GLenum parameter, GLint* const values) { void AbstractTexture::getLevelParameterImplementationDSAEXT(const GLint level, const GLenum parameter, GLint* const values) {
_flags |= ObjectFlag::Created; _flags |= ObjectFlag::Created;
glGetTextureLevelParameterivEXT(_id, target, level, parameter, values); glGetTextureLevelParameterivEXT(_id, _target, level, parameter, values);
} }
#endif #endif
#endif #endif
@ -1493,7 +1573,7 @@ void AbstractTexture::invalidateSubImageImplementationARB(GLint level, const Vec
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<UnsignedInt dimensions> void AbstractTexture::image(GLint level, Image<dimensions>& image) { template<UnsignedInt dimensions> void AbstractTexture::image(GLint level, Image<dimensions>& image) {
const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, _target, level); const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, level);
const std::size_t dataSize = Implementation::imageDataSizeFor(image, size); const std::size_t dataSize = Implementation::imageDataSizeFor(image, size);
/* Reallocate only if needed */ /* Reallocate only if needed */
@ -1503,7 +1583,7 @@ template<UnsignedInt dimensions> void AbstractTexture::image(GLint level, Image<
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
image.storage().applyPack(); image.storage().applyPack();
(this->*Context::current()->state().texture->getImageImplementation)(level, image.format(), image.type(), data.size(), data); (this->*Context::current().state().texture->getImageImplementation)(level, image.format(), image.type(), data.size(), data);
image.setData(image.storage(), image.format(), image.type(), size, std::move(data)); image.setData(image.storage(), image.format(), image.type(), size, std::move(data));
} }
@ -1512,7 +1592,7 @@ template void MAGNUM_EXPORT AbstractTexture::image<2>(GLint, Image<2>&);
template void MAGNUM_EXPORT AbstractTexture::image<3>(GLint, Image<3>&); template void MAGNUM_EXPORT AbstractTexture::image<3>(GLint, Image<3>&);
template<UnsignedInt dimensions> void AbstractTexture::image(GLint level, BufferImage<dimensions>& image, BufferUsage usage) { template<UnsignedInt dimensions> void AbstractTexture::image(GLint level, BufferImage<dimensions>& image, BufferUsage usage) {
const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, _target, level); const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, level);
const std::size_t dataSize = Implementation::imageDataSizeFor(image, size); const std::size_t dataSize = Implementation::imageDataSizeFor(image, size);
/* Reallocate only if needed */ /* Reallocate only if needed */
@ -1523,7 +1603,7 @@ template<UnsignedInt dimensions> void AbstractTexture::image(GLint level, Buffer
image.buffer().bindInternal(Buffer::TargetHint::PixelPack); image.buffer().bindInternal(Buffer::TargetHint::PixelPack);
image.storage().applyPack(); image.storage().applyPack();
(this->*Context::current()->state().texture->getImageImplementation)(level, image.format(), image.type(), dataSize, nullptr); (this->*Context::current().state().texture->getImageImplementation)(level, image.format(), image.type(), dataSize, nullptr);
} }
template void MAGNUM_EXPORT AbstractTexture::image<1>(GLint, BufferImage<1>&, BufferUsage); template void MAGNUM_EXPORT AbstractTexture::image<1>(GLint, BufferImage<1>&, BufferUsage);
@ -1531,12 +1611,12 @@ template void MAGNUM_EXPORT AbstractTexture::image<2>(GLint, BufferImage<2>&, Bu
template void MAGNUM_EXPORT AbstractTexture::image<3>(GLint, BufferImage<3>&, BufferUsage); template void MAGNUM_EXPORT AbstractTexture::image<3>(GLint, BufferImage<3>&, BufferUsage);
template<UnsignedInt dimensions> void AbstractTexture::compressedImage(const GLint level, CompressedImage<dimensions>& image) { template<UnsignedInt dimensions> void AbstractTexture::compressedImage(const GLint level, CompressedImage<dimensions>& image) {
const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, _target, level); const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, level);
GLint textureDataSize; GLint textureDataSize;
(this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); (this->*Context::current().state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize);
const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize);
GLint format; GLint format;
(this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_INTERNAL_FORMAT, &format); (this->*Context::current().state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
/* Reallocate only if needed */ /* Reallocate only if needed */
Containers::Array<char> data{image.release()}; Containers::Array<char> data{image.release()};
@ -1545,7 +1625,7 @@ template<UnsignedInt dimensions> void AbstractTexture::compressedImage(const GLi
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
image.storage().applyPack(); image.storage().applyPack();
(this->*Context::current()->state().texture->getCompressedImageImplementation)(level, data.size(), data); (this->*Context::current().state().texture->getCompressedImageImplementation)(level, data.size(), data);
image.setData(image.storage(), CompressedPixelFormat(format), size, std::move(data)); image.setData(image.storage(), CompressedPixelFormat(format), size, std::move(data));
} }
@ -1554,12 +1634,12 @@ template void MAGNUM_EXPORT AbstractTexture::compressedImage<2>(GLint, Compresse
template void MAGNUM_EXPORT AbstractTexture::compressedImage<3>(GLint, CompressedImage<3>&); template void MAGNUM_EXPORT AbstractTexture::compressedImage<3>(GLint, CompressedImage<3>&);
template<UnsignedInt dimensions> void AbstractTexture::compressedImage(const GLint level, CompressedBufferImage<dimensions>& image, BufferUsage usage) { template<UnsignedInt dimensions> void AbstractTexture::compressedImage(const GLint level, CompressedBufferImage<dimensions>& image, BufferUsage usage) {
const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, _target, level); const Math::Vector<dimensions, Int> size = DataHelper<dimensions>::imageSize(*this, level);
GLint textureDataSize; GLint textureDataSize;
(this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize); (this->*Context::current().state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &textureDataSize);
const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize); const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, textureDataSize);
GLint format; GLint format;
(this->*Context::current()->state().texture->getLevelParameterivImplementation)(_target, level, GL_TEXTURE_INTERNAL_FORMAT, &format); (this->*Context::current().state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
/* Reallocate only if needed */ /* Reallocate only if needed */
if(image.dataSize() < dataSize) if(image.dataSize() < dataSize)
@ -1569,7 +1649,7 @@ template<UnsignedInt dimensions> void AbstractTexture::compressedImage(const GLi
image.buffer().bindInternal(Buffer::TargetHint::PixelPack); image.buffer().bindInternal(Buffer::TargetHint::PixelPack);
image.storage().applyPack(); image.storage().applyPack();
(this->*Context::current()->state().texture->getCompressedImageImplementation)(level, dataSize, nullptr); (this->*Context::current().state().texture->getCompressedImageImplementation)(level, dataSize, nullptr);
} }
template void MAGNUM_EXPORT AbstractTexture::compressedImage<1>(GLint, CompressedBufferImage<1>&, BufferUsage); template void MAGNUM_EXPORT AbstractTexture::compressedImage<1>(GLint, CompressedBufferImage<1>&, BufferUsage);
@ -1621,62 +1701,140 @@ template<UnsignedInt dimensions> void AbstractTexture::subImage(const GLint leve
template void MAGNUM_EXPORT AbstractTexture::subImage<1>(GLint, const Range1Di&, BufferImage<1>&, BufferUsage); template void MAGNUM_EXPORT AbstractTexture::subImage<1>(GLint, const Range1Di&, BufferImage<1>&, BufferUsage);
template void MAGNUM_EXPORT AbstractTexture::subImage<2>(GLint, const Range2Di&, BufferImage<2>&, BufferUsage); template void MAGNUM_EXPORT AbstractTexture::subImage<2>(GLint, const Range2Di&, BufferImage<2>&, BufferUsage);
template void MAGNUM_EXPORT AbstractTexture::subImage<3>(GLint, const Range3Di&, BufferImage<3>&, BufferUsage); template void MAGNUM_EXPORT AbstractTexture::subImage<3>(GLint, const Range3Di&, BufferImage<3>&, BufferUsage);
template<UnsignedInt dimensions> std::size_t AbstractTexture::compressedSubImageSize(TextureFormat format, const Math::Vector<dimensions, Int>& size) {
/* Amount of blocks in given range (rounded up) multiplied by block
data size. The user is responsible for proper block-aligned size. */
const Math::Vector<dimensions, Int> blockSize = DataHelper<dimensions>::compressedBlockSize(_target, format);
return ((size + blockSize - Math::Vector<dimensions, Int>{1})/blockSize).product()*
compressedBlockDataSize(_target, format);
}
template<UnsignedInt dimensions> void AbstractTexture::compressedSubImage(const GLint level, const RangeTypeFor<dimensions, Int>& range, CompressedImage<dimensions>& image) {
createIfNotAlready();
const Math::Vector<dimensions, Int> size = range.size();
const Vector3i paddedOffset = Vector3i::pad(range.min());
const Vector3i paddedSize = Vector3i::pad(size, 1);
GLint format;
(this->*Context::current().state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, compressedSubImageSize<dimensions>(TextureFormat(format), size));
/* Reallocate only if needed */
Containers::Array<char> data{image.release()};
if(data.size() < dataSize)
data = Containers::Array<char>{dataSize};
Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
image.storage().applyPack();
glGetCompressedTextureSubImage(_id, level, paddedOffset.x(), paddedOffset.y(), paddedOffset.z(), paddedSize.x(), paddedSize.y(), paddedSize.z(), data.size(), data);
image.setData(CompressedPixelFormat(format), size, std::move(data));
}
template void MAGNUM_EXPORT AbstractTexture::compressedSubImage<1>(GLint, const Range1Di&, CompressedImage<1>&);
template void MAGNUM_EXPORT AbstractTexture::compressedSubImage<2>(GLint, const Range2Di&, CompressedImage<2>&);
template void MAGNUM_EXPORT AbstractTexture::compressedSubImage<3>(GLint, const Range3Di&, CompressedImage<3>&);
template<UnsignedInt dimensions> void AbstractTexture::compressedSubImage(const GLint level, const RangeTypeFor<dimensions, Int>& range, CompressedBufferImage<dimensions>& image, const BufferUsage usage) {
createIfNotAlready();
const Math::Vector<dimensions, Int> size = range.size();
const Vector3i paddedOffset = Vector3i::pad(range.min());
const Vector3i paddedSize = Vector3i::pad(size, 1);
GLint format;
(this->*Context::current().state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_INTERNAL_FORMAT, &format);
const std::size_t dataSize = Implementation::compressedImageDataSizeFor(image, size, compressedSubImageSize<dimensions>(TextureFormat(format), size));
/* Reallocate only if needed */
if(image.dataSize() < dataSize)
image.setData(image.storage(), CompressedPixelFormat(format), size, {nullptr, dataSize}, usage);
else
image.setData(image.storage(), CompressedPixelFormat(format), size, nullptr, usage);
image.buffer().bindInternal(Buffer::TargetHint::PixelPack);
image.storage().applyPack();
glGetCompressedTextureSubImage(_id, level, paddedOffset.x(), paddedOffset.y(), paddedOffset.z(), paddedSize.x(), paddedSize.y(), paddedSize.z(), dataSize, nullptr);
}
template void MAGNUM_EXPORT AbstractTexture::compressedSubImage<1>(GLint, const Range1Di&, CompressedBufferImage<1>&, BufferUsage);
template void MAGNUM_EXPORT AbstractTexture::compressedSubImage<2>(GLint, const Range2Di&, CompressedBufferImage<2>&, BufferUsage);
template void MAGNUM_EXPORT AbstractTexture::compressedSubImage<3>(GLint, const Range3Di&, CompressedBufferImage<3>&, BufferUsage);
#endif #endif
#endif #endif
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture& texture, GLenum, const GLint level) { Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::compressedBlockSize(const GLenum target, const TextureFormat format) {
GLint value;
glGetInternalformativ(target, GLenum(format), GL_TEXTURE_COMPRESSED_BLOCK_WIDTH, 1, &value);
return value;
}
Vector2i AbstractTexture::DataHelper<2>::compressedBlockSize(const GLenum target, const TextureFormat format) {
Vector2i value{Math::NoInit};
glGetInternalformativ(target, GLenum(format), GL_TEXTURE_COMPRESSED_BLOCK_WIDTH, 1, &value.x());
glGetInternalformativ(target, GLenum(format), GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT, 1, &value.y());
return value;
}
Vector3i AbstractTexture::DataHelper<3>::compressedBlockSize(const GLenum target, const TextureFormat format) {
/** @todo use real value when OpenGL has proper queries for 3D compression formats */
return Vector3i{DataHelper<2>::compressedBlockSize(target, format), 1};
}
#endif
#ifndef MAGNUM_TARGET_GLES
Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture& texture, const GLint level) {
Math::Vector<1, GLint> value; Math::Vector<1, GLint> value;
(texture.*Context::current()->state().texture->getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_WIDTH, &value[0]); (texture.*Context::current().state().texture->getLevelParameterivImplementation)(level, GL_TEXTURE_WIDTH, &value[0]);
return value; return value;
} }
#endif #endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLenum target, const GLint level) { Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLint level) {
const Implementation::TextureState& state = *Context::current()->state().texture; const Implementation::TextureState& state = *Context::current().state().texture;
Vector2i value; Vector2i value;
(texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]); (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_WIDTH, &value[0]);
(texture.*state.getLevelParameterivImplementation)(target, level, GL_TEXTURE_HEIGHT, &value[1]); (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_HEIGHT, &value[1]);
return value; return value;
} }
Vector3i AbstractTexture::DataHelper<3>::imageSize(AbstractTexture& texture, GLenum, const GLint level) { Vector3i AbstractTexture::DataHelper<3>::imageSize(AbstractTexture& texture, const GLint level) {
const Implementation::TextureState& state = *Context::current()->state().texture; const Implementation::TextureState& state = *Context::current().state().texture;
Vector3i value; Vector3i value;
(texture.*state.getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_WIDTH, &value[0]); (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_WIDTH, &value[0]);
(texture.*state.getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_HEIGHT, &value[1]); (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_HEIGHT, &value[1]);
(texture.*state.getLevelParameterivImplementation)(texture._target, level, GL_TEXTURE_DEPTH, &value[2]); (texture.*state.getLevelParameterivImplementation)(level, GL_TEXTURE_DEPTH, &value[2]);
return value; return value;
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::DataHelper<1>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Math::Vector< 1, GLsizei >& size) { void AbstractTexture::DataHelper<1>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Math::Vector< 1, GLsizei >& size) {
(texture.*Context::current()->state().texture->storage1DImplementation)(levels, internalFormat, size); (texture.*Context::current().state().texture->storage1DImplementation)(levels, internalFormat, size);
} }
#endif #endif
void AbstractTexture::DataHelper<2>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) { void AbstractTexture::DataHelper<2>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Vector2i& size) {
(texture.*Context::current()->state().texture->storage2DImplementation)(levels, internalFormat, size); (texture.*Context::current().state().texture->storage2DImplementation)(levels, internalFormat, size);
} }
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::DataHelper<3>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) { void AbstractTexture::DataHelper<3>::setStorage(AbstractTexture& texture, const GLsizei levels, const TextureFormat internalFormat, const Vector3i& size) {
(texture.*Context::current()->state().texture->storage3DImplementation)(levels, internalFormat, size); (texture.*Context::current().state().texture->storage3DImplementation)(levels, internalFormat, size);
} }
#endif #endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::DataHelper<2>::setStorageMultisample(AbstractTexture& texture, const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) { void AbstractTexture::DataHelper<2>::setStorageMultisample(AbstractTexture& texture, const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) {
(texture.*Context::current()->state().texture->storage2DMultisampleImplementation)(samples, internalFormat, size, fixedSampleLocations); (texture.*Context::current().state().texture->storage2DMultisampleImplementation)(samples, internalFormat, size, fixedSampleLocations);
} }
void AbstractTexture::DataHelper<3>::setStorageMultisample(AbstractTexture& texture, const GLsizei samples, const TextureFormat internalFormat, const Vector3i& size, const GLboolean fixedSampleLocations) { void AbstractTexture::DataHelper<3>::setStorageMultisample(AbstractTexture& texture, const GLsizei samples, const TextureFormat internalFormat, const Vector3i& size, const GLboolean fixedSampleLocations) {
(texture.*Context::current()->state().texture->storage3DMultisampleImplementation)(samples, internalFormat, size, fixedSampleLocations); (texture.*Context::current().state().texture->storage3DMultisampleImplementation)(samples, internalFormat, size, fixedSampleLocations);
} }
#endif #endif
@ -1712,25 +1870,25 @@ void AbstractTexture::DataHelper<1>::setCompressedImage(AbstractTexture& texture
void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, const ImageView1D& image) { void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, const ImageView1D& image) {
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack); Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->subImage1DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data()); (texture.*Context::current().state().texture->subImage1DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data());
} }
void AbstractTexture::DataHelper<1>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, const CompressedImageView1D& image) { void AbstractTexture::DataHelper<1>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, const CompressedImageView1D& image) {
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack); Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->compressedSubImage1DImplementation)(level, offset, image.size(), image.format(), image.data(), Implementation::occupiedCompressedImageDataSize(image, image.data().size())); (texture.*Context::current().state().texture->compressedSubImage1DImplementation)(level, offset, image.size(), image.format(), image.data(), Implementation::occupiedCompressedImageDataSize(image, image.data().size()));
} }
void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image) { void AbstractTexture::DataHelper<1>::setSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, BufferImage1D& image) {
image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack); image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack);
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->subImage1DImplementation)(level, offset, image.size(), image.format(), image.type(), nullptr); (texture.*Context::current().state().texture->subImage1DImplementation)(level, offset, image.size(), image.format(), image.type(), nullptr);
} }
void AbstractTexture::DataHelper<1>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, CompressedBufferImage1D& image) { void AbstractTexture::DataHelper<1>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, CompressedBufferImage1D& image) {
image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack); image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack);
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->compressedSubImage1DImplementation)(level, offset, image.size(), image.format(), nullptr, Implementation::occupiedCompressedImageDataSize(image, image.dataSize())); (texture.*Context::current().state().texture->compressedSubImage1DImplementation)(level, offset, image.size(), image.format(), nullptr, Implementation::occupiedCompressedImageDataSize(image, image.dataSize()));
} }
#endif #endif
@ -1785,7 +1943,7 @@ void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture& texture, const
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack); Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
#endif #endif
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->subImage2DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data() (texture.*Context::current().state().texture->subImage2DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data()
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
+ Implementation::pixelStorageSkipOffset(image) + Implementation::pixelStorageSkipOffset(image)
#endif #endif
@ -1801,14 +1959,14 @@ void AbstractTexture::DataHelper<2>::setCompressedSubImage(AbstractTexture& text
to reset anything */ to reset anything */
image.storage().applyUnpack(); image.storage().applyUnpack();
#endif #endif
(texture.*Context::current()->state().texture->compressedSubImage2DImplementation)(level, offset, image.size(), image.format(), image.data(), Implementation::occupiedCompressedImageDataSize(image, image.data().size())); (texture.*Context::current().state().texture->compressedSubImage2DImplementation)(level, offset, image.size(), image.format(), image.data(), Implementation::occupiedCompressedImageDataSize(image, image.data().size()));
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture& texture, const GLint level, const Vector2i& offset, BufferImage2D& image) { void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture& texture, const GLint level, const Vector2i& offset, BufferImage2D& image) {
image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack); image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack);
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->subImage2DImplementation)(level, offset, image.size(), image.format(), image.type(), nullptr); (texture.*Context::current().state().texture->subImage2DImplementation)(level, offset, image.size(), image.format(), image.type(), nullptr);
} }
void AbstractTexture::DataHelper<2>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Vector2i& offset, CompressedBufferImage2D& image) { void AbstractTexture::DataHelper<2>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Vector2i& offset, CompressedBufferImage2D& image) {
@ -1818,7 +1976,7 @@ void AbstractTexture::DataHelper<2>::setCompressedSubImage(AbstractTexture& text
to reset anything */ to reset anything */
image.storage().applyUnpack(); image.storage().applyUnpack();
#endif #endif
(texture.*Context::current()->state().texture->compressedSubImage2DImplementation)(level, offset, image.size(), image.format(), nullptr, Implementation::occupiedCompressedImageDataSize(image, image.dataSize())); (texture.*Context::current().state().texture->compressedSubImage2DImplementation)(level, offset, image.size(), image.format(), nullptr, Implementation::occupiedCompressedImageDataSize(image, image.dataSize()));
} }
#endif #endif
@ -1889,7 +2047,7 @@ void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack); Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
#endif #endif
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->subImage3DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data() (texture.*Context::current().state().texture->subImage3DImplementation)(level, offset, image.size(), image.format(), image.type(), image.data()
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2
+ Implementation::pixelStorageSkipOffset(image) + Implementation::pixelStorageSkipOffset(image)
#endif #endif
@ -1905,7 +2063,7 @@ void AbstractTexture::DataHelper<3>::setCompressedSubImage(AbstractTexture& text
to reset anything */ to reset anything */
image.storage().applyUnpack(); image.storage().applyUnpack();
#endif #endif
(texture.*Context::current()->state().texture->compressedSubImage3DImplementation)(level, offset, image.size(), image.format(), image.data(), Implementation::occupiedCompressedImageDataSize(image, image.data().size())); (texture.*Context::current().state().texture->compressedSubImage3DImplementation)(level, offset, image.size(), image.format(), image.data(), Implementation::occupiedCompressedImageDataSize(image, image.data().size()));
} }
#endif #endif
@ -1913,7 +2071,7 @@ void AbstractTexture::DataHelper<3>::setCompressedSubImage(AbstractTexture& text
void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, BufferImage3D& image) { void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, BufferImage3D& image) {
image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack); image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack);
image.storage().applyUnpack(); image.storage().applyUnpack();
(texture.*Context::current()->state().texture->subImage3DImplementation)(level, offset, image.size(), image.format(), image.type(), nullptr); (texture.*Context::current().state().texture->subImage3DImplementation)(level, offset, image.size(), image.format(), image.type(), nullptr);
} }
void AbstractTexture::DataHelper<3>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, CompressedBufferImage3D& image) { void AbstractTexture::DataHelper<3>::setCompressedSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, CompressedBufferImage3D& image) {
@ -1923,32 +2081,32 @@ void AbstractTexture::DataHelper<3>::setCompressedSubImage(AbstractTexture& text
to reset anything */ to reset anything */
image.storage().applyUnpack(); image.storage().applyUnpack();
#endif #endif
(texture.*Context::current()->state().texture->compressedSubImage3DImplementation)(level, offset, image.size(), image.format(), nullptr, Implementation::occupiedCompressedImageDataSize(image, image.dataSize())); (texture.*Context::current().state().texture->compressedSubImage3DImplementation)(level, offset, image.size(), image.format(), nullptr, Implementation::occupiedCompressedImageDataSize(image, image.dataSize()));
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::DataHelper<1>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLint>& size) { void AbstractTexture::DataHelper<1>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Math::Vector<1, GLint>& offset, const Math::Vector<1, GLint>& size) {
(texture.*Context::current()->state().texture->invalidateSubImageImplementation)(level, {offset[0], 0, 0}, {size[0], 1, 1}); (texture.*Context::current().state().texture->invalidateSubImageImplementation)(level, {offset[0], 0, 0}, {size[0], 1, 1});
} }
#endif #endif
void AbstractTexture::DataHelper<2>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Vector2i& offset, const Vector2i& size) { void AbstractTexture::DataHelper<2>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Vector2i& offset, const Vector2i& size) {
(texture.*Context::current()->state().texture->invalidateSubImageImplementation)(level, {offset, 0}, {size, 1}); (texture.*Context::current().state().texture->invalidateSubImageImplementation)(level, {offset, 0}, {size, 1});
} }
void AbstractTexture::DataHelper<3>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, const Vector3i& size) { void AbstractTexture::DataHelper<3>::invalidateSubImage(AbstractTexture& texture, const GLint level, const Vector3i& offset, const Vector3i& size) {
(texture.*Context::current()->state().texture->invalidateSubImageImplementation)(level, offset, size); (texture.*Context::current().state().texture->invalidateSubImageImplementation)(level, offset, size);
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void AbstractTexture::DataHelper<1>::setWrapping(AbstractTexture& texture, const Array1D<Sampler::Wrapping>& wrapping) { void AbstractTexture::DataHelper<1>::setWrapping(AbstractTexture& texture, const Array1D<Sampler::Wrapping>& wrapping) {
(texture.*Context::current()->state().texture->parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); (texture.*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x()));
} }
#endif #endif
void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture& texture, const Array2D<Sampler::Wrapping>& wrapping) { void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture& texture, const Array2D<Sampler::Wrapping>& wrapping) {
const Implementation::TextureState& state = *Context::current()->state().texture; const Implementation::TextureState& state = *Context::current().state().texture;
(texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x()));
(texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y())); (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y()));
@ -1956,7 +2114,7 @@ void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture& texture, const
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractTexture::DataHelper<3>::setWrapping(AbstractTexture& texture, const Array3D<Sampler::Wrapping>& wrapping) { void AbstractTexture::DataHelper<3>::setWrapping(AbstractTexture& texture, const Array3D<Sampler::Wrapping>& wrapping) {
const Implementation::TextureState& state = *Context::current()->state().texture; const Implementation::TextureState& state = *Context::current().state().texture;
(texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x())); (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_S, GLint(wrapping.x()));
(texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y())); (texture.*state.parameteriImplementation)(GL_TEXTURE_WRAP_T, GLint(wrapping.y()));

128
src/Magnum/AbstractTexture.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -69,13 +69,13 @@ documentation for details.
@anchor AbstractTexture-performance-optimization @anchor AbstractTexture-performance-optimization
## Performance optimizations and security ## Performance optimizations and security
The engine tracks currently bound textures in all available texture units to The engine tracks currently bound textures and images in all available texture
avoid unnecessary calls to @fn_gl{ActiveTexture} and @fn_gl{BindTexture}. units to avoid unnecessary calls to @fn_gl{ActiveTexture}, @fn_gl{BindTexture}
Texture configuration functions use dedicated highest available texture unit and @fn_gl{BindImageTexture}. Texture configuration functions use dedicated
to not affect active bindings in user units. Texture limits and highest available texture unit to not affect active bindings in user units.
implementation-defined values (such as @ref maxColorSamples()) are cached, so Texture limits and implementation-defined values (such as @ref maxColorSamples())
repeated queries don't result in repeated @fn_gl{Get} calls. See also are cached, so repeated queries don't result in repeated @fn_gl{Get} calls. See
@ref Context::resetState() and @ref Context::State::Textures. also @ref Context::resetState() and @ref Context::State::Textures.
If @extension{ARB,direct_state_access} (part of OpenGL 4.5) is available, If @extension{ARB,direct_state_access} (part of OpenGL 4.5) is available,
@ref bind(Int) and @ref unbind(Int) use @fn_gl{BindTextureUnit}. Otherwise, if @ref bind(Int) and @ref unbind(Int) use @fn_gl{BindTextureUnit}. Otherwise, if
@ -209,13 +209,14 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
/** /**
* @brief Unbind textures in given range of texture units * @brief Unbind textures in given range of texture units
* *
* Unbinds all texture in the range @f$ [ firstTextureUnit ; firstTextureUnit + count ) @f$. * Unbinds all textures in the range @f$ [ firstTextureUnit ; firstTextureUnit + count ) @f$.
* If @extension{ARB,multi_bind} (part of OpenGL 4.4) is not available, * If @extension{ARB,multi_bind} (part of OpenGL 4.4) is not available,
* the feature is emulated with sequence of @ref unbind(Int) calls. * the feature is emulated with sequence of @ref unbind(Int) calls.
* @note This function is meant to be used only internally from * @note This function is meant to be used only internally from
* @ref AbstractShaderProgram subclasses. See its documentation * @ref AbstractShaderProgram subclasses. See its documentation
* for more information. * for more information.
* @see @ref Shader::maxCombinedTextureImageUnits(), @fn_gl{BindTextures} * @see @ref bind(), @ref Shader::maxCombinedTextureImageUnits(),
* @fn_gl{BindTextures}
*/ */
static void unbind(Int firstTextureUnit, std::size_t count); static void unbind(Int firstTextureUnit, std::size_t count);
@ -234,6 +235,71 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
*/ */
static void bind(Int firstTextureUnit, std::initializer_list<AbstractTexture*> textures); static void bind(Int firstTextureUnit, std::initializer_list<AbstractTexture*> textures);
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/**
* @brief Unbind any image from given image unit
*
* @note This function is meant to be used only internally from
* @ref AbstractShaderProgram subclasses. See its documentation
* for more information.
* @see @ref Texture::bindImage() "*Texture::bindImage()",
* @ref Texture::bindImageLayered() "*Texture::bindImageLayered()",
* @ref unbindImages(), @ref bindImages(),
* @ref AbstractShaderProgram::maxImageUnits(),
* @fn_gl{BindImageTexture}
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
* @requires_gles31 Shader image load/store is not available in OpenGL
* ES 3.0 and older.
* @requires_gles Shader image load/store is not available in WebGL.
*/
static void unbindImage(Int imageUnit);
#endif
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Unbind images in given range of image units
*
* Unbinds all texture in the range @f$ [ firstImageUnit ; firstImageUnit + count ) @f$.
* @note This function is meant to be used only internally from
* @ref AbstractShaderProgram subclasses. See its documentation
* for more information.
* @see @ref Texture::bindImage() "*Texture::bindImage()",
* @ref Texture::bindImageLayered() "*Texture::bindImageLayered()",
* @ref unbindImage(), @ref bindImages(),
* @ref AbstractShaderProgram::maxImageUnits(),
* @fn_gl{BindImageTextures}
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
* @requires_gl44 Extension @extension{ARB,multi_bind}
* @requires_gl Multi bind is not available in OpenGL ES and WebGL.
*/
static void unbindImages(Int firstImageUnit, std::size_t count) {
bindImagesInternal(firstImageUnit, {nullptr, count});
}
/**
* @brief Bind textures to given range of texture units
*
* Binds first level of given texture in the list to @p firstImageUnit,
* second to `firstTextureUnit + 1` etc. 3D, cube map and array
* textures are bound as layered targets. If any texture is `nullptr`,
* given image unit is unbound.
* @note This function is meant to be used only internally from
* @ref AbstractShaderProgram subclasses. See its documentation
* for more information.
* @see @ref Texture::bindImage() "*Texture::bindImage()",
* @ref Texture::bindImageLayered() "*Texture::bindImageLayered()",
* @ref unbindImages(), @ref unbindImage(),
* @ref AbstractShaderProgram::maxImageUnits(),
* @fn_gl{BindImageTextures}
* @requires_gl42 Extension @extension{ARB,shader_image_load_store}
* @requires_gl44 Extension @extension{ARB,multi_bind}
* @requires_gl Multi bind is not available in OpenGL ES and WebGL.
*/
static void bindImages(Int firstImageUnit, std::initializer_list<AbstractTexture*> textures) {
bindImagesInternal(firstImageUnit, {textures.begin(), textures.size()});
}
#endif
/** @brief Copying is not allowed */ /** @brief Copying is not allowed */
AbstractTexture(const AbstractTexture&) = delete; AbstractTexture(const AbstractTexture&) = delete;
@ -338,6 +404,14 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
#endif #endif
template<UnsignedInt textureDimensions> struct DataHelper {}; template<UnsignedInt textureDimensions> struct DataHelper {};
#ifndef MAGNUM_TARGET_GLES
static Int compressedBlockDataSize(GLenum target, TextureFormat format);
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
static void bindImagesInternal(Int firstImageUnit, Containers::ArrayView<AbstractTexture* const> textures);
#endif
explicit AbstractTexture(GLenum target); explicit AbstractTexture(GLenum target);
explicit AbstractTexture(NoCreateT, GLenum target) noexcept: _target{target}, _id{0}, _flags{ObjectFlag::DeleteOnDestruction} {} explicit AbstractTexture(NoCreateT, GLenum target) noexcept: _target{target}, _id{0}, _flags{ObjectFlag::DeleteOnDestruction} {}
explicit AbstractTexture(GLuint id, GLenum target, ObjectFlags flags) noexcept: _target{target}, _id{id}, _flags{flags} {} explicit AbstractTexture(GLuint id, GLenum target, ObjectFlags flags) noexcept: _target{target}, _id{id}, _flags{flags} {}
@ -348,6 +422,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL createIfNotAlready(); void MAGNUM_LOCAL createIfNotAlready();
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void bindImageInternal(Int imageUnit, Int level, bool layered, Int layer, ImageAccess access, ImageFormat format);
#endif
/* Unlike bind() this also sets the texture binding unit as active */ /* Unlike bind() this also sets the texture binding unit as active */
void MAGNUM_LOCAL bindInternal(); void MAGNUM_LOCAL bindInternal();
@ -405,11 +483,18 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
template<UnsignedInt dimensions> void compressedImage(GLint level, CompressedBufferImage<dimensions>& image, BufferUsage usage); template<UnsignedInt dimensions> void compressedImage(GLint level, CompressedBufferImage<dimensions>& image, BufferUsage usage);
template<UnsignedInt dimensions> void subImage(GLint level, const RangeTypeFor<dimensions, Int>& range, Image<dimensions>& image); template<UnsignedInt dimensions> void subImage(GLint level, const RangeTypeFor<dimensions, Int>& range, Image<dimensions>& image);
template<UnsignedInt dimensions> void subImage(GLint level, const RangeTypeFor<dimensions, Int>& range, BufferImage<dimensions>& image, BufferUsage usage); template<UnsignedInt dimensions> void subImage(GLint level, const RangeTypeFor<dimensions, Int>& range, BufferImage<dimensions>& image, BufferUsage usage);
template<UnsignedInt dimensions> void compressedSubImage(GLint level, const RangeTypeFor<dimensions, Int>& range, CompressedImage<dimensions>& image);
template<UnsignedInt dimensions> void compressedSubImage(GLint level, const RangeTypeFor<dimensions, Int>& range, CompressedBufferImage<dimensions>& image, BufferUsage usage);
#endif #endif
GLenum _target; GLenum _target;
private: private:
#ifndef MAGNUM_TARGET_GLES
static Int MAGNUM_LOCAL compressedBlockDataSizeImplementationDefault(GLenum target, TextureFormat format);
static Int MAGNUM_LOCAL compressedBlockDataSizeImplementationBitsWorkaround(GLenum target, TextureFormat format);
#endif
static void MAGNUM_LOCAL unbindImplementationDefault(GLint textureUnit); static void MAGNUM_LOCAL unbindImplementationDefault(GLint textureUnit);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
static void MAGNUM_LOCAL unbindImplementationMulti(GLint textureUnit); static void MAGNUM_LOCAL unbindImplementationMulti(GLint textureUnit);
@ -427,6 +512,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL createImplementationDSA(); void MAGNUM_LOCAL createImplementationDSA();
#endif #endif
#ifndef MAGNUM_TARGET_GLES
template<UnsignedInt dimensions> std::size_t MAGNUM_LOCAL compressedSubImageSize(TextureFormat format, const Math::Vector<dimensions, Int>& size);
#endif
void MAGNUM_LOCAL bindImplementationDefault(GLint textureUnit); void MAGNUM_LOCAL bindImplementationDefault(GLint textureUnit);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL bindImplementationMulti(GLint textureUnit); void MAGNUM_LOCAL bindImplementationMulti(GLint textureUnit);
@ -463,10 +552,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy); void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy);
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values); void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLint level, GLenum parameter, GLint* values);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLenum, GLint level, GLenum parameter, GLint* values); void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLint level, GLenum parameter, GLint* values);
void MAGNUM_LOCAL getLevelParameterImplementationDSAEXT(GLenum target, GLint level, GLenum parameter, GLint* values); void MAGNUM_LOCAL getLevelParameterImplementationDSAEXT(GLint level, GLenum parameter, GLint* values);
#endif #endif
#endif #endif
@ -584,7 +673,8 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<1> { template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<1> {
static Math::Vector<1, GLint> imageSize(AbstractTexture& texture, GLenum, GLint level); static Math::Vector<1, GLint> compressedBlockSize(GLenum target, TextureFormat format);
static Math::Vector<1, GLint> imageSize(AbstractTexture& texture, GLint level);
static void setWrapping(AbstractTexture& texture, const Array1D<Sampler::Wrapping>& wrapping); static void setWrapping(AbstractTexture& texture, const Array1D<Sampler::Wrapping>& wrapping);
@ -604,8 +694,11 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<1> {
}; };
#endif #endif
template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> { template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> {
#ifndef MAGNUM_TARGET_GLES
static Vector2i compressedBlockSize(GLenum target, TextureFormat format);
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
static Vector2i imageSize(AbstractTexture& texture, GLenum target, GLint level); static Vector2i imageSize(AbstractTexture& texture, GLint level);
#endif #endif
static void setWrapping(AbstractTexture& texture, const Array2D<Sampler::Wrapping>& wrapping); static void setWrapping(AbstractTexture& texture, const Array2D<Sampler::Wrapping>& wrapping);
@ -646,8 +739,11 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> {
}; };
template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> { template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> {
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) #if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
#ifndef MAGNUM_TARGET_GLES
static Vector3i compressedBlockSize(GLenum target, TextureFormat format);
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
static Vector3i imageSize(AbstractTexture& texture, GLenum, GLint level); static Vector3i imageSize(AbstractTexture& texture, GLint level);
#endif #endif
static void setWrapping(AbstractTexture& texture, const Array3D<Sampler::Wrapping>& wrapping); static void setWrapping(AbstractTexture& texture, const Array3D<Sampler::Wrapping>& wrapping);

8
src/Magnum/Array.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
@ -77,11 +77,7 @@ template<UnsignedInt dimensions, class T> class Array {
constexpr /*implicit*/ Array(T value); constexpr /*implicit*/ Array(T value);
#else #else
template<class U, class V = typename std::enable_if<std::is_same<T, U>::value && dimensions != 1, T>::type> template<class U, class V = typename std::enable_if<std::is_same<T, U>::value && dimensions != 1, T>::type>
#ifndef CORRADE_MSVC2015_COMPATIBILITY constexpr /*implicit*/ Array(U value): Array(typename Math::Implementation::GenerateSequence<dimensions>::Type(), value) {}
/* Can't use delegating constructors with constexpr -- https://connect.microsoft.com/VisualStudio/feedback/details/1579279/c-constexpr-does-not-work-with-delegating-constructors */
constexpr
#endif
/*implicit*/ Array(U value): Array(typename Math::Implementation::GenerateSequence<dimensions>::Type(), value) {}
#endif #endif
/** @brief Equality */ /** @brief Equality */

2
src/Magnum/Attribute.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/Attribute.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/Audio/AbstractImporter.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/Audio/AbstractImporter.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/Audio/Audio.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/Audio/Audio.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/Audio/Buffer.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

2
src/Magnum/Audio/Buffer.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a

13
src/Magnum/Audio/CMakeLists.txt

@ -1,7 +1,7 @@
# #
# This file is part of Magnum. # This file is part of Magnum.
# #
# Copyright © 2010, 2011, 2012, 2013, 2014, 2015 # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
# Vladimír Vondruš <mosra@centrum.cz> # Vladimír Vondruš <mosra@centrum.cz>
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
@ -25,8 +25,6 @@
find_package(OpenAL REQUIRED) find_package(OpenAL REQUIRED)
include_directories(${OPENAL_INCLUDE_DIR})
set(MagnumAudio_SRCS set(MagnumAudio_SRCS
AbstractImporter.cpp AbstractImporter.cpp
Audio.cpp Audio.cpp
@ -60,13 +58,12 @@ endif()
add_library(MagnumAudio ${SHARED_OR_STATIC} add_library(MagnumAudio ${SHARED_OR_STATIC}
${MagnumAudio_SRCS} ${MagnumAudio_SRCS}
${MagnumAudio_HEADERS}) ${MagnumAudio_HEADERS})
target_include_directories(MagnumAudio PUBLIC ${OPENAL_INCLUDE_DIR})
set_target_properties(MagnumAudio PROPERTIES DEBUG_POSTFIX "-d") set_target_properties(MagnumAudio PROPERTIES DEBUG_POSTFIX "-d")
if(BUILD_STATIC_PIC) if(BUILD_STATIC_PIC)
set_target_properties(MagnumAudio PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(MagnumAudio PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif() endif()
target_link_libraries(MagnumAudio Magnum Corrade::PluginManager ${OPENAL_LIBRARY})
target_link_libraries(MagnumAudio Magnum ${CORRADE_PLUGINMANAGER_LIBRARIES} ${OPENAL_LIBRARY})
if(WITH_SCENEGRAPH) if(WITH_SCENEGRAPH)
target_link_libraries(MagnumAudio MagnumSceneGraph) target_link_libraries(MagnumAudio MagnumSceneGraph)
endif() endif()
@ -81,5 +78,5 @@ if(BUILD_TESTS)
add_subdirectory(Test) add_subdirectory(Test)
endif() endif()
# Magnum Audio library for superprojects # Magnum Audio target alias for superprojects
set(MAGNUM_AUDIO_LIBRARY MagnumAudio CACHE INTERNAL "") add_library(Magnum::Audio ALIAS MagnumAudio)

9
src/Magnum/Audio/Context.cpp

@ -1,7 +1,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Copyright © 2015 Jonathan Hale <squareys@googlemail.com> Copyright © 2015 Jonathan Hale <squareys@googlemail.com>
@ -70,6 +70,13 @@ Debug& operator<<(Debug& debug, const Context::HrtfStatus value) {
Context* Context::_current = nullptr; Context* Context::_current = nullptr;
bool Context::hasCurrent() { return _current; }
Context& Context::current() {
CORRADE_ASSERT(_current, "Audio::Context::current(): no current context", *_current);
return *_current;
}
Context::Context(): Context{Configuration{}} {} Context::Context(): Context{Configuration{}} {}
Context::Context(const Configuration& config) { Context::Context(const Configuration& config) {

33
src/Magnum/Audio/Context.h

@ -3,7 +3,7 @@
/* /*
This file is part of Magnum. This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015 Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz> Vladimír Vondruš <mosra@centrum.cz>
Copyright © 2015 Jonathan Hale <squareys@googlemail.com> Copyright © 2015 Jonathan Hale <squareys@googlemail.com>
@ -127,8 +127,20 @@ class MAGNUM_AUDIO_EXPORT Context {
UnsupportedFormat = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT UnsupportedFormat = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT
}; };
/** @brief Current context */ /**
static Context* current() { return _current; } * @brief Whether there is any current context
*
* @see @ref current()
*/
static bool hasCurrent();
/**
* @brief Current context
*
* Expect that there is current context.
* @see @ref hasCurrent()
*/
static Context& current();
class Configuration; class Configuration;
@ -151,6 +163,11 @@ class MAGNUM_AUDIO_EXPORT Context {
*/ */
~Context(); ~Context();
#if defined(MAGNUM_BUILD_DEPRECATED) && !defined(DOXYGEN_GENERATING_OUTPUT)
CORRADE_DEPRECATED("Audio::Context::current() returns reference now") Context* operator->() { return this; }
CORRADE_DEPRECATED("Audio::Context::current() returns reference now") operator Context*() { return this; }
#endif
/** /**
* @brief Whether HRTFs (Head Related Transfer Functions) are enabled * @brief Whether HRTFs (Head Related Transfer Functions) are enabled
* *
@ -237,7 +254,7 @@ class MAGNUM_AUDIO_EXPORT Context {
* Extensions usable with this function are listed in @ref Extensions * Extensions usable with this function are listed in @ref Extensions
* namespace in header @ref Extensions.h. Example usage: * namespace in header @ref Extensions.h. Example usage:
* @code * @code
* if(Context::current()->isExtensionSupported<Extensions::ALC::SOFTX::HRTF>()) { * if(Context::current().isExtensionSupported<Extensions::ALC::SOFTX::HRTF>()) {
* // amazing binaural audio * // amazing binaural audio
* } else { * } else {
* // probably left/right stereo only * // probably left/right stereo only
@ -265,7 +282,7 @@ class MAGNUM_AUDIO_EXPORT Context {
} }
private: private:
static Context* _current; MAGNUM_AUDIO_LOCAL static Context* _current;
/* Create a context with given configuration. Returns `true` on success. /* Create a context with given configuration. Returns `true` on success.
* @ref alcCreateContext(). */ * @ref alcCreateContext(). */
@ -410,9 +427,9 @@ MAGNUM_ASSERT_AUDIO_EXTENSION_SUPPORTED(Extensions::ALC::SOFTX::HRTF);
#ifdef CORRADE_NO_ASSERT #ifdef CORRADE_NO_ASSERT
#define MAGNUM_ASSERT_AUDIO_EXTENSION_SUPPORTED(extension) do {} while(0) #define MAGNUM_ASSERT_AUDIO_EXTENSION_SUPPORTED(extension) do {} while(0)
#else #else
#define MAGNUM_ASSERT_AUDIO_EXTENSION_SUPPORTED(extension) \ #define MAGNUM_ASSERT_AUDIO_EXTENSION_SUPPORTED(extension) \
do { \ do { \
if(!Magnum::Audio::Context::current()->isExtensionSupported<extension>()) { \ if(!Magnum::Audio::Context::current().isExtensionSupported<extension>()) { \
Corrade::Utility::Error() << "Magnum: required OpenAL extension" << extension::string() << "is not supported"; \ Corrade::Utility::Error() << "Magnum: required OpenAL extension" << extension::string() << "is not supported"; \
std::abort(); \ std::abort(); \
} \ } \
@ -429,7 +446,7 @@ inline bool Context::isHrtfEnabled() const {
} }
inline Context::HrtfStatus Context::hrtfStatus() const { inline Context::HrtfStatus Context::hrtfStatus() const {
if(!Context::current()->isExtensionSupported<Extensions::ALC::SOFT::HRTF>()) if(!isExtensionSupported<Extensions::ALC::SOFT::HRTF>())
return isHrtfEnabled() ? HrtfStatus::Enabled : HrtfStatus::Disabled; return isHrtfEnabled() ? HrtfStatus::Enabled : HrtfStatus::Disabled;
Int status; Int status;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save