Browse Source

Merge branch 'master' into compatibility

Conflicts:
	modules/FindCorrade.cmake
	src/Trade/AbstractMaterialData.cpp
Vladimír Vondruš 13 years ago
parent
commit
ab500860ee
  1. 7
      CMakeLists.txt
  2. 4
      PKGBUILD
  3. 4
      PKGBUILD-es2
  4. 4
      PKGBUILD-es2desktop
  5. 4
      PKGBUILD-es3
  6. 4
      PKGBUILD-mingw32
  7. 2
      PKGBUILD-nacl-glibc
  8. 2
      PKGBUILD-nacl-newlib
  9. 4
      PKGBUILD-release
  10. 12
      doc/building.dox
  11. 2
      doc/cmake.dox
  12. 8
      doc/getting-started.dox
  13. 5
      external/OpenGL/GL/CMakeLists.txt
  14. 12
      external/OpenGL/GL/README.md
  15. 12
      external/OpenGL/GL/extensions.txt
  16. 2756
      external/OpenGL/GL/gl_magnum.c
  17. 3188
      external/OpenGL/GL/gl_magnum.h
  18. 3255
      external/OpenGL/GL/glcorearb.h
  19. 4
      modules/CMakeLists.txt
  20. 27
      modules/FindCorrade.cmake
  21. 67
      modules/FindGLEW.cmake
  22. 18
      modules/FindMagnum.cmake
  23. 2
      package/archlinux/magnum-git/PKGBUILD
  24. 2
      src/Buffer.h
  25. 13
      src/CMakeLists.txt
  26. 13
      src/Context.cpp
  27. 1
      src/Extensions.h
  28. 34
      src/OpenGL.h
  29. 11
      src/Platform/AbstractContextHandler.h
  30. 4
      src/Platform/AbstractXApplication.cpp
  31. 32
      src/Platform/CMakeLists.txt
  32. 52
      src/Platform/ExtensionWrangler.cpp
  33. 50
      src/Platform/ExtensionWrangler.h
  34. 3
      src/Platform/GlutApplication.cpp
  35. 5
      src/Platform/GlxContextHandler.h
  36. 5
      src/Platform/Sdl2Application.cpp
  37. 3
      src/Platform/WindowlessGlxApplication.cpp
  38. 18
      src/Platform/magnum-info.cpp
  39. 4
      src/RenderbufferFormat.h
  40. 4
      src/SceneGraph/instantiation.cpp
  41. 3
      src/Shaders/MeshVisualizer.frag
  42. 4
      src/Shaders/MeshVisualizer.geom
  43. 5
      src/Shaders/Phong.frag
  44. 6
      src/Shaders/compatibility.glsl
  45. 4
      src/Test/CMakeLists.txt
  46. 4
      src/Text/TextRenderer.cpp
  47. 24
      src/TextureFormat.h
  48. 13
      src/TextureTools/distance-field.cpp
  49. 2
      src/Trade/AbstractImporter.h
  50. 8
      src/Trade/AbstractMaterialData.cpp
  51. 24
      src/Trade/AbstractMaterialData.h
  52. 2
      src/Trade/MeshObjectData2D.cpp
  53. 2
      src/Trade/MeshObjectData3D.cpp
  54. 10
      src/Trade/ObjectData2D.cpp
  55. 40
      src/Trade/ObjectData2D.h
  56. 10
      src/Trade/ObjectData3D.cpp
  57. 43
      src/Trade/ObjectData3D.h
  58. 2
      src/Trade/PhongMaterialData.h
  59. 4
      src/Trade/Test/AbstractMaterialDataTest.cpp
  60. 4
      src/Trade/Test/ObjectData2DTest.cpp
  61. 4
      src/Trade/Test/ObjectData3DTest.cpp
  62. 2
      toolchains

7
CMakeLists.txt

@ -36,6 +36,8 @@ option(TARGET_GLES "Build for OpenGL ES instead of desktop OpenGL" OFF)
cmake_dependent_option(TARGET_GLES2 "Build for OpenGL ES 2" ON "TARGET_GLES" OFF)
cmake_dependent_option(TARGET_DESKTOP_GLES "Build for OpenGL ES on desktop" OFF "TARGET_GLES" OFF)
option(WITH_FIND_MODULE "Install FindMagnum.cmake module into CMake's module dir (might require admin privileges)" OFF)
# Parts of the library
option(WITH_AUDIO "Build Audio library" ON)
option(WITH_DEBUGTOOLS "Build DebugTools library" ON)
@ -100,9 +102,6 @@ elseif(TARGET_GLES2)
else()
find_package(OpenGLES3 REQUIRED)
endif()
if(NOT TARGET_GLES)
find_package(GLEW REQUIRED)
endif()
# Configuration variables (saved later to corradeConfigure.h)
if(TARGET_GLES)
@ -138,7 +137,7 @@ include(CorradeLibSuffix)
set(MAGNUM_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
set(MAGNUM_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/magnum)
set(MAGNUM_CMAKE_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
add_subdirectory(external)

4
PKGBUILD

@ -2,11 +2,11 @@
pkgname=magnum
pkgver=dev
pkgrel=1
pkgdesc="OpenGL graphics engine"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine"
arch=('i686' 'x86_64')
url="https://github.com/mosra/magnum"
license=('MIT')
depends=('corrade' 'glew' 'freeglut' 'sdl2')
depends=('corrade' 'openal' 'freeglut' 'sdl2')
makedepends=('cmake')
options=(!strip)
provides=('magnum-git')

4
PKGBUILD-es2

@ -2,11 +2,11 @@
pkgname=magnum
pkgver=dev.es2
pkgrel=1
pkgdesc="OpenGL graphics engine (OpenGL ES 2.0 version)"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine (OpenGL ES 2.0 version)"
arch=('i686' 'x86_64')
url="https://github.com/mosra/magnum"
license=('MIT')
depends=('corrade' 'glew')
depends=('corrade' 'openal')
makedepends=('cmake')
options=(!strip)
provides=('magnum-git')

4
PKGBUILD-es2desktop

@ -2,11 +2,11 @@
pkgname=magnum
pkgver=dev.es2desktop
pkgrel=1
pkgdesc="OpenGL graphics engine (desktop OpenGL ES 2.0 version)"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine (desktop OpenGL ES 2.0 version)"
arch=('i686' 'x86_64')
url="https://github.com/mosra/magnum"
license=('MIT')
depends=('corrade' 'glew')
depends=('corrade' 'openal')
makedepends=('cmake')
options=(!strip)
provides=('magnum-git')

4
PKGBUILD-es3

@ -2,11 +2,11 @@
pkgname=magnum
pkgver=dev.es3
pkgrel=1
pkgdesc="OpenGL graphics engine (OpenGL ES 3.0 version)"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine (OpenGL ES 3.0 version)"
arch=('i686' 'x86_64')
url="https://github.com/mosra/magnum"
license=('MIT')
depends=('corrade' 'glew')
depends=('corrade' 'openal')
makedepends=('cmake')
options=(!strip)
provides=('magnum-git')

4
PKGBUILD-mingw32

@ -2,11 +2,11 @@
pkgname=mingw32-magnum
pkgver=dev
pkgrel=1
pkgdesc="OpenGL graphics engine (mingw32)"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine (mingw32)"
arch=('any')
url="https://github.com/mosra/magnum"
license=('MIT')
depends=('mingw32-runtime' 'mingw32-corrade' 'mingw32-glew' 'mingw32-freeglut')
depends=('mingw32-runtime' 'mingw32-corrade' 'mingw32-freeglut' 'mingw32-openal')
makedepends=('mingw32-gcc' 'cmake' 'corrade')
options=(!buildflags !strip)

2
PKGBUILD-nacl-glibc

@ -2,7 +2,7 @@
pkgname=nacl-magnum
pkgver=dev.glibc
pkgrel=1
pkgdesc="OpenGL graphics engine (NaCl glibc version)"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine (NaCl glibc version)"
arch=('any')
url="https://github.com/mosra/magnum"
license=('MIT')

2
PKGBUILD-nacl-newlib

@ -2,7 +2,7 @@
pkgname=nacl-magnum
pkgver=dev.newlib
pkgrel=1
pkgdesc="OpenGL graphics engine (NaCl newlib version)"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine (NaCl newlib version)"
arch=('any')
url="https://github.com/mosra/magnum"
license=('MIT')

4
PKGBUILD-release

@ -2,11 +2,11 @@
pkgname=magnum
pkgver=dev.release
pkgrel=1
pkgdesc="OpenGL graphics engine"
pkgdesc="C++11 and OpenGL 2D/3D graphics engine"
arch=('i686' 'x86_64')
url="https://github.com/mosra/magnum"
license=('MIT')
depends=('corrade' 'glew' 'sdl-hg' 'freeglut')
depends=('corrade' 'openal' 'sdl2' 'freeglut')
makedepends=('cmake')
provides=('magnum-git')

12
doc/building.dox

@ -41,7 +41,6 @@ Minimal set of tools and libraries required for building is:
>= 3.1. On Windows you can use **MinGW**, Visual Studio compiler still lacks
some needed features.
- **CMake** >= 2.8.8
- **GLEW** - OpenGL extension wrangler (only if targeting desktop OpenGL)
- **Corrade** - Plugin management and utility library. See
@ref building-corrade "Corrade download and installation guide" for more
information.
@ -118,12 +117,6 @@ have installed them to MinGW directory, point to `CMAKE_FIND_ROOT_PATH` to
MinGW installation prefix, e.g. specify `-DCMAKE_FIND_ROOT_PATH=C:/MinGW/`
CMake parameter.
If building fails with GLEW linking errors (`undefined reference to glew...`),
you have to set `GLEW_LIBRARY_DLL` and `GLEW_LIBRARY_LIB` CMake variables
manually. One of them should point to `glew32.dll` and the other to
`glew32.lib`. CMake currently isn't able to distinguish between them and in
most cases points both to the same location.
See also Corrade's @ref building-corrade-windows-troubleshooting "troubleshooting section".
@subsection building-features Enabling or disabling features
@ -251,12 +244,11 @@ flags.
this system there is also prepared `mingw32-magnum` development package in
root, named `PKGBUILD-mingw32`.
You will need MinGW32 versions of the compiler and all libraries (GLEW,
Corrade), i.e. these ArchLinux packages:
You will need MinGW32 versions of the compiler and all dependent libraries
(Corrade), i.e. these ArchLinux packages:
- `mingw32-gcc`, which depends on `mingw32-w32api` containing OpenGL headers
- `mingw32-runtime`
- `mingw32-glew`
- `mingw32-corrade`
Make sure you have `toolchains` submodule updated, as

2
doc/cmake.dox

@ -47,7 +47,7 @@ variables:
- `MAGNUM_PLUGINS_IMPORTER_DIR` -- Directory with importer plugins
However, this command will try to find only the base library, not the optional
components. The base library depends on %Corrade, OpenGL and GLEW libraries (or
components. The base library depends on %Corrade and OpenGL libraries (or
OpenGL ES libraries). Additional dependencies are specified by the components.
The optional components are:

8
doc/getting-started.dox

@ -58,7 +58,6 @@ CMake build system, see @ref cmake for more information.
modules/FindCorrade.cmake
modules/FindMagnum.cmake
modules/FindGLEW.cmake
src/MyApplication.cpp
src/CMakeLists.txt
CMakeLists.txt
@ -100,7 +99,9 @@ class MyApplication: public Platform::Application {
void drawEvent() override;
};
MyApplication::MyApplication(const Arguments& arguments): Platform::Application(arguments) {}
MyApplication::MyApplication(const Arguments& arguments): Platform::Application(arguments) {
// TODO: Add your initialization code here
}
void MyApplication::viewportEvent(const Vector2i& size) {
defaultFramebuffer.setViewport({{}, size});
@ -108,6 +109,9 @@ void MyApplication::viewportEvent(const Vector2i& size) {
void MyApplication::drawEvent() {
defaultFramebuffer.clear(FramebufferClear::Color);
// TODO: Add your drawing code here
swapBuffers();
}

5
external/OpenGL/GL/CMakeLists.txt vendored

@ -22,4 +22,7 @@
# DEALINGS IN THE SOFTWARE.
#
install(FILES glcorearb.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GL)
add_library(MagnumGLLoadGenObjects OBJECT gl_magnum.c)
set_target_properties(MagnumGLLoadGenObjects PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -fvisibility=hidden -DGLLoadGen_EXPORTS")
install(FILES gl_magnum.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GL)

12
external/OpenGL/GL/README.md vendored

@ -0,0 +1,12 @@
OpenGL header and extension loader is generated using glLoadGen, originally
from [BitBucket](https://bitbucket.org/alfonse/glloadgen), with Magnum-related
changes at [](https://github.com/mosra/glloadgen.git).
See `extensions.txt` for a list of requested non-core extensions. Copy the file
into glLoadGen directory and generate the files using Lua:
lua LoadGen.lua -style=pointer_c -indent=space -spec=gl -version=4.4 -profile=core -extfile=extensions.txt magnum
Then copy generated `gl_magnum.c` and `gl_magnum.h` to this directory. You may
want to remove trailing spaces to make the diff cleaner. Be sure to check the
diff for suspicious changes.

12
external/OpenGL/GL/extensions.txt vendored

@ -0,0 +1,12 @@
// The following output is taken from `magnum-info` with removed `GL_`
// suffixes. Only vendor extensions are needed, everything else is pulled in
// with OpenGL 4.4.
AMD_vertex_shader_layer
AMD_shader_trinary_minmax
ARB_robustness
ATI_texture_mirror_once
EXT_texture_filter_anisotropic
EXT_texture_mirror_clamp
EXT_direct_state_access
GREMEDY_string_marker

2756
external/OpenGL/GL/gl_magnum.c vendored

File diff suppressed because it is too large Load Diff

3188
external/OpenGL/GL/gl_magnum.h vendored

File diff suppressed because it is too large Load Diff

3255
external/OpenGL/GL/glcorearb.h vendored

File diff suppressed because it is too large Load Diff

4
modules/CMakeLists.txt

@ -22,6 +22,6 @@
# DEALINGS IN THE SOFTWARE.
#
if(NOT CMAKE_CROSSCOMPILING)
install(FILES FindMagnum.cmake DESTINATION ${MAGNUM_CMAKE_MODULE_INSTALL_DIR})
if(WITH_FIND_MODULE)
install(FILES FindMagnum.cmake DESTINATION ${MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR})
endif()

27
modules/FindCorrade.cmake

@ -19,14 +19,14 @@
# hidden visibility by default.
#
# Features of found Corrade library are exposed in these variables:
# CORRADE_GCC44_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.4
# CORRADE_GCC45_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.5
# CORRADE_GCC46_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.6
# CORRADE_GCC47_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.7
# CORRADE_GCC46_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.6
# CORRADE_GCC45_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.5
# CORRADE_GCC44_COMPATIBILITY - Defined if compiled with compatibility
# mode for GCC 4.4
# CORRADE_BUILD_STATIC - Defined if compiled as static libraries
# CORRADE_TARGET_NACL - Defined if compiled for Google Chrome
# Native Client
@ -120,11 +120,16 @@ find_library(CORRADE_TESTSUITE_LIBRARY CorradeTestSuite)
# RC executable
find_program(CORRADE_RC_EXECUTABLE corrade-rc)
# Paths
# Include dir
find_path(CORRADE_INCLUDE_DIR
NAMES PluginManager Utility
PATH_SUFFIXES Corrade)
# CMake module dir
find_path(_CORRADE_MODULE_DIR
NAMES UseCorrade.cmake CorradeLibSuffix.cmake
PATH_SUFFIXES share/cmake/Corrade)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Corrade DEFAULT_MSG
CORRADE_UTILITY_LIBRARY
@ -132,7 +137,8 @@ find_package_handle_standard_args(Corrade DEFAULT_MSG
CORRADE_PLUGINMANAGER_LIBRARY
CORRADE_TESTSUITE_LIBRARY
CORRADE_INCLUDE_DIR
CORRADE_RC_EXECUTABLE)
CORRADE_RC_EXECUTABLE
_CORRADE_MODULE_DIR)
if(NOT CORRADE_FOUND)
return()
@ -192,6 +198,9 @@ endif()
mark_as_advanced(CORRADE_UTILITY_LIBRARY
CORRADE_INTERCONNECT_LIBRARY
CORRADE_PLUGINMANAGER_LIBRARY
CORRADE_TESTSUITE_LIBRARY)
CORRADE_TESTSUITE_LIBRARY
_CORRADE_MODULE_DIR)
# Include file with macros from our module dir
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${_CORRADE_MODULE_DIR}")
include(UseCorrade)

67
modules/FindGLEW.cmake

@ -1,67 +0,0 @@
# Find GLEW - OpenGL Extension Wrangler handling module for CMake
#
# This module defines:
#
# GLEW_FOUND - True if GLEW library is found
# GLEW_LIBRARIES - GLEW libraries
# GLEW_INCLUDE_DIR - Include dir
#
#
# This file is part of Magnum.
#
# Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
#
# 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.
#
# Include dir
find_path(GLEW_INCLUDE_DIR
NAMES GL/glew.h)
# Library
if(NOT WIN32)
find_library(GLEW_LIBRARY GLEW)
set(GLEW_LIBRARIES_ GLEW_LIBRARY)
mark_as_advanced(GLEW_LIBRARY)
else()
find_library(GLEW_LIBRARY_DLL glew32)
find_library(GLEW_LIBRARY_LIB glew32)
set(GLEW_LIBRARIES_ GLEW_LIBRARY_DLL GLEW_LIBRARY_LIB)
mark_as_advanced(GLEW_LIBRARY_DLL GLEW_LIBRARY_LIB)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args("GLEW" DEFAULT_MSG
${GLEW_LIBRARIES_}
GLEW_INCLUDE_DIR)
if(NOT GLEW_FOUND)
return()
endif()
unset(GLEW_LIBRARIES_)
if(NOT WIN32)
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
mark_as_advanced(GLEW_LIBRARY)
else()
set(GLEW_LIBRARIES ${GLEW_LIBRARY_DLL} ${GLEW_LIBRARY_LIB})
mark_as_advanced(GLEW_LIBRARY_DLL GLEW_LIBRARY_LIB)
endif()

18
modules/FindMagnum.cmake

@ -17,9 +17,9 @@
# MAGNUM_PLUGINS_IMPORTER_DIR - Directory with importer plugins
# MAGNUM_PLUGINS_AUDIOIMPORTER_DIR - Directory with audio importer plugins
# This command will try to find only the base library, not the optional
# components. The base library depends on Corrade, OpenGL and GLEW
# libraries. Additional dependencies are specified by the components. The
# optional components are:
# components. The base library depends on Corrade and OpenGL libraries (or
# OpenGL ES libraries). Additional dependencies are specified by the
# components. The optional components are:
# Audio - Audio library (depends on OpenAL library)
# DebugTools - DebugTools library (depends on MeshTools, Primitives,
# SceneGraph, Shaders and Shapes components)
@ -78,8 +78,8 @@
# directory
# MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR - Audio omporter plugin
# installation directory
# MAGNUM_CMAKE_MODULE_INSTALL_DIR - Installation dir for CMake
# modules
# MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR - Installation dir for CMake
# Find* modules
# MAGNUM_INCLUDE_INSTALL_DIR - Header installation directory
# MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR - Plugin header installation
# directory
@ -149,9 +149,6 @@ if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)
else()
find_package(OpenGLES2 REQUIRED)
endif()
if(NOT MAGNUM_TARGET_GLES)
find_package(GLEW REQUIRED)
endif()
# On Windows and in static builds, *Application libraries need to have
# ${MAGNUM_LIBRARIES} listed in dependencies also after all other library names
@ -334,9 +331,6 @@ if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)
else()
set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARIES} ${OPENGLES2_LIBRARY})
endif()
if(NOT MAGNUM_TARGET_GLES)
set(MAGNUM_LIBRARIES ${MAGNUM_LIBRARIES} ${GLEW_LIBRARIES})
endif()
# Installation dirs
include(CorradeLibSuffix)
@ -347,7 +341,7 @@ set(MAGNUM_PLUGINS_FONTCONVERTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/fontc
set(MAGNUM_PLUGINS_IMAGECONVERTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR ${MAGNUM_PLUGINS_INSTALL_DIR}/audioimporters)
set(MAGNUM_CMAKE_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
set(MAGNUM_CMAKE_FIND_MODULE_INSTALL_DIR ${CMAKE_ROOT}/Modules)
set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum/Plugins)
mark_as_advanced(FORCE

2
package/archlinux/magnum-git/PKGBUILD

@ -6,7 +6,7 @@ pkgdesc="C++11 and OpenGL 2D/3D graphics engine (Git version)"
arch=('i686' 'x86_64')
url="http://mosra.cz/blog/magnum.php"
license=('MIT')
depends=('corrade-git' 'glew' 'glut' 'openal')
depends=('corrade-git' 'openal' 'freeglut')
makedepends=('cmake' 'git')
provides=('magnum')
conflicts=('magnum')

2
src/Buffer.h

@ -944,7 +944,7 @@ inline Buffer& Buffer::operator=(Buffer&& other) noexcept {
#ifndef MAGNUM_TARGET_GLES
template<class T> Containers::Array<T> inline Buffer::data() {
const Int bufferSize = size();
CORRADE_ASSERT(bufferSize%sizeof(T) == 0, "Buffer::data(): the buffer size is" << bufferSize << "bytes, which can't be expressed as array of types with size" << sizeof(T), {});
CORRADE_ASSERT(bufferSize%sizeof(T) == 0, "Buffer::data(): the buffer size is" << bufferSize << "bytes, which can't be expressed as array of types with size" << sizeof(T), nullptr);
return subData<T>(0, bufferSize/sizeof(T));
}

13
src/CMakeLists.txt

@ -90,6 +90,7 @@ set(Magnum_SRCS
Trade/PhongMaterialData.cpp
Trade/SceneData.cpp
Trade/TextureData.cpp)
set(Magnum_OBJECTS $<TARGET_OBJECTS:MagnumObjects>)
# Desktop-only code
if(NOT TARGET_GLES)
@ -153,6 +154,7 @@ endif()
if(NOT TARGET_GLES2)
set(Magnum_HEADERS ${Magnum_HEADERS}
BufferImage.h)
set(Magnum_OBJECTS ${Magnum_OBJECTS} $<TARGET_OBJECTS:MagnumGLLoadGenObjects>)
endif()
# Files shared between main library and math unit test library
@ -165,12 +167,12 @@ set(MagnumMath_SRCS
# TODO: fix when CMake sets target_EXPORTS for OBJECT targets as well
add_library(MagnumMathObjects OBJECT ${MagnumMath_SRCS})
add_library(MagnumObjects OBJECT ${Magnum_SRCS})
set_target_properties(MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumMathObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
set_target_properties(MagnumObjects PROPERTIES COMPILE_FLAGS "-DMagnumObjects_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
set_target_properties(MagnumMathObjects PROPERTIES COMPILE_FLAGS "-DMagnumMathObjects_EXPORTS -DGLLoadGen_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
set_target_properties(MagnumObjects PROPERTIES COMPILE_FLAGS "-DMagnumObjects_EXPORTS -DGLLoadGen_EXPORTS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
# Main library
add_library(Magnum ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumObjects>
${Magnum_OBJECTS}
$<TARGET_OBJECTS:MagnumMathObjects>)
if(BUILD_STATIC_PIC)
# TODO: CMake 2.8.9 has this as POSITION_INDEPENDENT_CODE property
@ -186,9 +188,6 @@ elseif(TARGET_GLES2)
else()
set(Magnum_LIBS ${Magnum_LIBS} ${OPENGLES3_LIBRARY})
endif()
if(NOT TARGET_GLES)
set(Magnum_LIBS ${Magnum_LIBS} ${GLEW_LIBRARIES})
endif()
target_link_libraries(Magnum ${Magnum_LIBS})
install(TARGETS Magnum DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
@ -243,7 +242,7 @@ if(BUILD_TESTS)
target_link_libraries(MagnumMathTestLib ${CORRADE_UTILITY_LIBRARY})
add_library(MagnumTestLib ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumObjects>
${Magnum_OBJECTS}
$<TARGET_OBJECTS:MagnumMathObjects>)
set_target_properties(MagnumTestLib PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)
target_link_libraries(MagnumTestLib ${Magnum_LIBS})

13
src/Context.cpp

@ -174,6 +174,8 @@ const std::vector<Extension>& Extension::extensions(Version version) {
_extension(GL,ARB,map_buffer_alignment),
_extension(GL,ARB,shader_atomic_counters),
_extension(GL,ARB,shader_image_load_store),
/* Mentioned in GLSL 4.20 specs as newly added */
_extension(GL,ARB,shading_language_packing), // done
_extension(GL,ARB,texture_storage)};
static const std::vector<Extension> extensions430{
_extension(GL,ARB,arrays_of_arrays), // done
@ -296,6 +298,17 @@ const std::vector<Extension>& Extension::extensions(Version version) {
Context* Context::_current = nullptr;
Context::Context() {
#ifndef MAGNUM_TARGET_GLES
/* Init glLoadGen. Ignore functions that failed to load (described by
`ogl_LOAD_SUCCEEDED + n` return code), as we requested the latest OpenGL
with many vendor extensions and there won't ever be a driver supporting
everything possible. */
if(ogl_LoadFunctions() == ogl_LOAD_FAILED) {
Error() << "ExtensionWrangler: cannot initialize glLoadGen";
std::exit(1);
}
#endif
/* Version */
#ifndef MAGNUM_TARGET_GLES2
glGetIntegerv(GL_MAJOR_VERSION, &_majorVersion);

1
src/Extensions.h

@ -131,6 +131,7 @@ namespace GL {
_extension(GL,ARB,map_buffer_alignment, GL210, GL420) // #113
_extension(GL,ARB,shader_atomic_counters, GL300, GL420) // #114
_extension(GL,ARB,shader_image_load_store, GL300, GL420) // #115
_extension(GL,ARB,shading_language_packing, /*?*/ GL210, GL420) // #116
_extension(GL,ARB,texture_storage, GL210, GL420) // #117
_extension(GL,ARB,arrays_of_arrays, GL210, GL430) // #120
_extension(GL,ARB,clear_buffer_object, GL210, GL430) // #121

34
src/OpenGL.h

@ -33,33 +33,31 @@
/* Desktop OpenGL */
#ifndef MAGNUM_TARGET_GLES
#include <GL/glew.h>
#include <OpenGL/GL/glcorearb.h>
#include <OpenGL/GL/gl_magnum.h>
/* NaCl has its own gl2.h, the official one causes linker issues. Additionaly
to NaCl's gl2ext.h we are including our own to prevent undeclared symbol
errors with some recent extensions. */
#elif defined(CORRADE_TARGET_NACL)
/* Enable function prototypes (the supported ones shouldn't fail at link time) */
#define GL_GLEXT_PROTOTYPES
/* Enable function prototypes (the supported ones shouldn't fail at link time) */
#define GL_GLEXT_PROTOTYPES
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#undef __gl2ext_h_
#include <OpenGL/GLES2/gl2ext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#undef __gl2ext_h_
#include <OpenGL/GLES2/gl2ext.h>
/* Generic OpenGL ES */
#else
#include <OpenGL/KHR/khrplatform.h>
#ifndef MAGNUM_TARGET_GLES2
#include <OpenGL/GLES3/gl3platform.h>
#include <OpenGL/GLES3/gl3.h>
#else
#include <OpenGL/GLES2/gl2platform.h>
#include <OpenGL/GLES2/gl2.h>
#include <OpenGL/GLES2/gl2ext.h>
#endif
#include <OpenGL/KHR/khrplatform.h>
#ifndef MAGNUM_TARGET_GLES2
#include <OpenGL/GLES3/gl3platform.h>
#include <OpenGL/GLES3/gl3.h>
#else
#include <OpenGL/GLES2/gl2platform.h>
#include <OpenGL/GLES2/gl2.h>
#include <OpenGL/GLES2/gl2ext.h>
#endif
#endif
#endif

11
src/Platform/AbstractContextHandler.h

@ -28,8 +28,6 @@
* @brief Class Magnum::Platform::AbstractContextHandler
*/
#include "ExtensionWrangler.h"
namespace Magnum { namespace Platform {
/**
@ -58,15 +56,6 @@ template<class Display, class VisualId, class Window> class AbstractContextHandl
/** @brief Create context */
virtual void createContext(Window nativeWindow) = 0;
/**
* @brief Whether to enable experimental extension wrangler features
*
* Default is to disable.
*/
virtual ExtensionWrangler::ExperimentalFeatures experimentalExtensionWranglerFeatures() const {
return ExtensionWrangler::ExperimentalFeatures::Disable;
}
/** @brief Make the context current */
virtual void makeCurrent() = 0;

4
src/Platform/AbstractXApplication.cpp

@ -27,7 +27,6 @@
#include <Utility/utilities.h>
#include "Context.h"
#include "ExtensionWrangler.h"
#define None 0L // redef Xlib nonsense
@ -101,9 +100,6 @@ void AbstractXApplication::createContext(const Configuration& configuration) {
/* Set OpenGL context as current */
contextHandler->makeCurrent();
/* Initialize extension wrangler */
ExtensionWrangler::initialize(contextHandler->experimentalExtensionWranglerFeatures());
c = new Context;
}

32
src/Platform/CMakeLists.txt

@ -22,22 +22,14 @@
# DEALINGS IN THE SOFTWARE.
#
set(MagnumPlatform_HEADERS
AbstractContextHandler.h
ExtensionWrangler.h)
# Extension wrangler
add_library(MagnumPlatformExtensionWrangler OBJECT ExtensionWrangler.cpp)
set(MagnumPlatform_HEADERS AbstractContextHandler.h)
install(FILES ${MagnumPlatform_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
# GLUT application
if(WITH_GLUTAPPLICATION)
find_package(GLUT)
if(GLUT_FOUND)
add_library(MagnumGlutApplication STATIC
GlutApplication.cpp
$<TARGET_OBJECTS:MagnumPlatformExtensionWrangler>)
add_library(MagnumGlutApplication STATIC GlutApplication.cpp)
install(FILES GlutApplication.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumGlutApplication DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
else()
@ -50,9 +42,7 @@ if(WITH_SDL2APPLICATION)
find_package(SDL2)
if(SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
add_library(MagnumSdl2Application STATIC
Sdl2Application.cpp
$<TARGET_OBJECTS:MagnumPlatformExtensionWrangler>)
add_library(MagnumSdl2Application STATIC Sdl2Application.cpp)
install(FILES Sdl2Application.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumSdl2Application DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
else()
@ -66,8 +56,7 @@ if(WITH_NACLAPPLICATION)
message(FATAL_ERROR "NaClApplication is available only when targeting Google Chrome Native Client. Set WITH_NACLAPPLICATION to OFF to skip building it.")
endif()
add_library(MagnumNaClApplication STATIC
NaClApplication.cpp)
add_library(MagnumNaClApplication STATIC NaClApplication.cpp)
install(FILES NaClApplication.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumNaClApplication DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
@ -78,8 +67,7 @@ if(WITH_WINDOWLESSNACLAPPLICATION)
message(FATAL_ERROR "WindowlessNaClApplication is available only when targeting Google Chrome Native Client. Set WITH_WINDOWLESSNACLAPPLICATION to OFF to skip building it.")
endif()
add_library(MagnumWindowlessNaClApplication STATIC
WindowlessNaClApplication.cpp)
add_library(MagnumWindowlessNaClApplication STATIC WindowlessNaClApplication.cpp)
install(FILES WindowlessNaClApplication.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumWindowlessNaClApplication DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
@ -95,8 +83,7 @@ if(WITH_GLXAPPLICATION)
set(NEED_GLXCONTEXT 1)
add_library(MagnumGlxApplication STATIC
$<TARGET_OBJECTS:MagnumAbstractXApplication>
$<TARGET_OBJECTS:MagnumGlxContextHandler>
$<TARGET_OBJECTS:MagnumPlatformExtensionWrangler>)
$<TARGET_OBJECTS:MagnumGlxContextHandler>)
install(FILES GlxApplication.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumGlxApplication DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
@ -107,8 +94,7 @@ if(WITH_XEGLAPPLICATION)
set(NEED_EGLCONTEXT 1)
add_library(MagnumXEglApplication STATIC
$<TARGET_OBJECTS:MagnumAbstractXApplication>
$<TARGET_OBJECTS:MagnumEglContextHandler>
$<TARGET_OBJECTS:MagnumPlatformExtensionWrangler>)
$<TARGET_OBJECTS:MagnumEglContextHandler>)
install(FILES XEglApplication.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
install(TARGETS MagnumXEglApplication DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
endif()
@ -122,9 +108,7 @@ endif()
# Windowless GLX application
if(WITH_WINDOWLESSGLXAPPLICATION)
add_library(MagnumWindowlessGlxApplication STATIC
WindowlessGlxApplication.cpp
$<TARGET_OBJECTS:MagnumPlatformExtensionWrangler>)
add_library(MagnumWindowlessGlxApplication STATIC WindowlessGlxApplication.cpp)
# X11 macros are a mess, disable warnings for C-style casts
set_target_properties(MagnumWindowlessGlxApplication PROPERTIES COMPILE_FLAGS "-Wno-old-style-cast")
install(FILES WindowlessGlxApplication.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)

52
src/Platform/ExtensionWrangler.cpp

@ -1,52 +0,0 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
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.
*/
#include "ExtensionWrangler.h"
#include <cstdlib>
#include <Utility/Debug.h>
#include "Magnum.h"
#include "OpenGL.h"
namespace Magnum { namespace Platform {
void ExtensionWrangler::initialize(ExperimentalFeatures experimentalFeatures) {
#ifndef MAGNUM_TARGET_GLES
/* Enable experimental features */
if(experimentalFeatures == ExperimentalFeatures::Enable)
glewExperimental = true;
/* Init GLEW */
GLenum err = glewInit();
if(err != GLEW_OK) {
Error() << "ExtensionWrangler: cannot initialize GLEW:" << glewGetErrorString(err);
std::exit(1);
}
#else
static_cast<void>(experimentalFeatures); /* Shut up about unused parameter */
#endif
}
}}

50
src/Platform/ExtensionWrangler.h

@ -1,50 +0,0 @@
#ifndef Magnum_Platform_ExtensionWrangler_h
#define Magnum_Platform_ExtensionWrangler_h
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013 Vladimír Vondruš <mosra@centrum.cz>
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.
*/
/** @file
* @brief Class Magnum::Platform::ExtensionWrangler
*/
namespace Magnum { namespace Platform {
/** @brief %Extension wrangler interface */
class ExtensionWrangler {
public:
ExtensionWrangler() = delete;
/** @brief Whether to enable or disable experimental features */
enum class ExperimentalFeatures {
Disable,
Enable
};
/** @brief Initialize extension wrangler */
static void initialize(ExperimentalFeatures experimentalFeatures = ExperimentalFeatures::Disable);
};
}}
#endif

3
src/Platform/GlutApplication.cpp

@ -25,7 +25,6 @@
#include "GlutApplication.h"
#include "Context.h"
#include "ExtensionWrangler.h"
namespace Magnum { namespace Platform {
@ -89,8 +88,6 @@ bool GlutApplication::tryCreateContext(const Configuration& configuration) {
glutMotionFunc(staticMouseMoveEvent);
glutDisplayFunc(staticDrawEvent);
ExtensionWrangler::initialize();
c = new Context;
return true;
}

5
src/Platform/GlxContextHandler.h

@ -55,11 +55,6 @@ class GlxContextHandler: public AbstractContextHandler<Display*, VisualID, Windo
VisualID getVisualId(Display* nativeDisplay) override;
void createContext(Window nativeWindow) override;
/* This must be enabled, otherwise (on my NVidia) it crashes when creating VAO. WTF. */
ExtensionWrangler::ExperimentalFeatures experimentalExtensionWranglerFeatures() const override {
return ExtensionWrangler::ExperimentalFeatures::Enable;
}
void makeCurrent() override {
glXMakeCurrent(display, window, context);
}

5
src/Platform/Sdl2Application.cpp

@ -25,7 +25,6 @@
#include "Sdl2Application.h"
#include "Context.h"
#include "ExtensionWrangler.h"
namespace Magnum { namespace Platform {
@ -112,10 +111,6 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
return false;
}
/* This must be enabled, otherwise (on my NVidia) it crashes when creating
VAO. WTF. */
ExtensionWrangler::initialize(ExtensionWrangler::ExperimentalFeatures::Enable);
/* Push resize event, so viewportEvent() is called at startup */
SDL_Event* sizeEvent = new SDL_Event;
sizeEvent->type = SDL_WINDOWEVENT;

3
src/Platform/WindowlessGlxApplication.cpp

@ -108,9 +108,6 @@ void WindowlessGlxApplication::createContext(const Configuration&) {
std::exit(1);
}
/* Initialize extension wrangler */
ExtensionWrangler::initialize(ExtensionWrangler::ExperimentalFeatures::Enable);
c = new Context;
}

18
src/Platform/magnum-info.cpp

@ -22,6 +22,7 @@
DEALINGS IN THE SOFTWARE.
*/
#include <Utility/Arguments.h>
#include <Utility/Debug.h>
#include <corradeCompatibility.h>
#ifdef CORRADE_TARGET_NACL
@ -44,7 +45,16 @@ class MagnumInfo: public Platform::WindowlessApplication {
int exec() override { return 0; }
};
MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplication(arguments) {
MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplication(arguments, nullptr) {
Utility::Arguments args;
args.addBooleanOption("all-extensions")
.setHelp("all-extensions", "show extensions also for fully supported versions")
.setHelp("Displays information about Magnum engine and OpenGL capabilities.")
.parse(arguments.argc, arguments.argv);
/* Create context after parsing arguments, so the help can be displayed
without creating context */
createContext({});
Context* c = Context::current();
/* Pass debug output as messages to JavaScript */
@ -133,8 +143,10 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
Version::None
};
std::size_t future = 0;
while(versions[future] != Version::None && c->isVersionSupported(versions[future]))
++future;
if(!args.isSet("all-extensions"))
while(versions[future] != Version::None && c->isVersionSupported(versions[future]))
++future;
/* Display supported OpenGL extensions from unsupported versions */
for(std::size_t i = future; i != versions.size(); ++i) {

4
src/RenderbufferFormat.h

@ -366,12 +366,8 @@ enum class RenderbufferFormat: GLenum {
R11FG11FB10F = GL_R11F_G11F_B10F,
#endif
/* 1.5.6 <= GLEW < 1.8.0 doesn't have this, even if there is
GL_ARB_ES2_compatibility */
#if defined(GL_RGB565) || defined(DOXYGEN_GENERATING_OUTPUT)
/** RGB, normalized unsigned, red and blue 5bit, green 6bit. */
RGB565 = GL_RGB565,
#endif
/**
* sRGBA, each component normalized unsigned byte.

4
src/SceneGraph/instantiation.cpp

@ -47,8 +47,8 @@ template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeature<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup<2, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractFeatureGroup<3, Float>;
template class AbstractCamera<2, Float>;
template class AbstractCamera<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera<2, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT AbstractCamera<3, Float>;
template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera2D<Float>;
template class MAGNUM_SCENEGRAPH_EXPORT BasicCamera3D<Float>;

3
src/Shaders/MeshVisualizer.frag

@ -25,6 +25,9 @@
#ifndef NEW_GLSL
#define in varying
#define fragmentColor gl_FragColor
#endif
#ifndef RUNTIME_CONST
#define const
#endif

4
src/Shaders/MeshVisualizer.geom

@ -22,6 +22,10 @@
DEALINGS IN THE SOFTWARE.
*/
#ifndef RUNTIME_CONST
#define const
#endif
layout(location = 1) uniform vec2 viewportSize;
layout(triangles) in;

5
src/Shaders/Phong.frag

@ -25,6 +25,11 @@
#ifndef NEW_GLSL
#define in varying
#define color gl_FragColor
#define texture texture2D
#endif
#ifndef RUNTIME_CONST
#define const
#endif
#ifndef GL_ES

6
src/Shaders/compatibility.glsl

@ -56,3 +56,9 @@
#define mediump
#define lowp
#endif
/* const qualifier can be used for readonly variables since GLSL 4.20, however
it's not supported even in ES 3.0 */
#if !defined(GL_ES) && __VERSION__ >= 420
#define RUNTIME_CONST
#endif

4
src/Test/CMakeLists.txt

@ -42,6 +42,4 @@ endif()
set_target_properties(ResourceManagerTest PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT)
# Install bootstrap header for GL tests to be used in dependent projects
if(BUILD_GL_TESTS)
install(FILES AbstractOpenGLTester.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Test)
endif()
install(FILES AbstractOpenGLTester.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Test)

4
src/Text/TextRenderer.cpp

@ -359,7 +359,7 @@ void AbstractTextRenderer::render(const std::string& text) {
delete layouter;
}
template class TextRenderer<2>;
template class TextRenderer<3>;
template class MAGNUM_TEXT_EXPORT TextRenderer<2>;
template class MAGNUM_TEXT_EXPORT TextRenderer<3>;
}}

24
src/TextureFormat.h

@ -519,13 +519,7 @@ enum class TextureFormat: GLenum {
* RGB, normalized unsigned, red and blue component 5bit, green 6bit.
* @requires_gles30 %Extension @es_extension{OES,required_internalformat}
*/
/* 1.5.6 <= GLEW < 1.8.0 doesn't have this, even if there is
GL_ARB_ES2_compatibility */
#ifdef GL_RGB565
RGB565 = GL_RGB565,
#else
RGB565 = 0x8D62,
#endif
#ifndef MAGNUM_TARGET_GLES3
/**
@ -722,39 +716,37 @@ enum class TextureFormat: GLenum {
*/
CompressedSignedRGRgtc2 = GL_COMPRESSED_SIGNED_RG_RGTC2,
/* These are named with _ARB suffix, because glcorearb.h doesn't
have suffixless version (?!) and GLEW has it without suffix as
late as of 1.8.0 { */
/**
* BPTC compressed RGB, unsigned float.
* @requires_gl42 %Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES.
* @todo Remove workaround when glLoadGen has `GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT`
*/
CompressedRGBBptcUnsignedFloat = GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB,
CompressedRGBBptcUnsignedFloat = 0x8E8F,//GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,
/**
* BPTC compressed RGB, signed float.
* @requires_gl42 %Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES.
* @todo Remove workaround when glLoadGen has `GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT`
*/
CompressedRGBBptcSignedFloat = GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB,
CompressedRGBBptcSignedFloat = 0x8E8E,//GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT,
/**
* BPTC compressed RGBA, normalized unsigned.
* @requires_gl42 %Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES.
* @todo Remove workaround when glLoadGen has `GL_COMPRESSED_RGBA_BPTC_UNORM`
*/
CompressedRGBABptcUnorm = GL_COMPRESSED_RGBA_BPTC_UNORM_ARB,
CompressedRGBABptcUnorm = 0x8E8C,//GL_COMPRESSED_RGBA_BPTC_UNORM,
/**
* BPTC compressed sRGBA, normalized unsigned.
* @requires_gl42 %Extension @extension{ARB,texture_compression_bptc}
* @requires_gl BPTC texture compression is not available in OpenGL ES.
* @todo Remove workaround when glLoadGen has `GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM`
*/
CompressedSRGBAlphaBptcUnorm = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB,
/*}*/
CompressedSRGBAlphaBptcUnorm = 0x8E8D,//GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM,
#endif
/**

13
src/TextureTools/distance-field.cpp

@ -78,23 +78,20 @@ int DistanceFieldConverter::exec() {
}
/* Instance plugins */
Trade::AbstractImporter* importer = importerManager.instance(args.value("importer"));
Trade::AbstractImageConverter* converter = converterManager.instance(args.value("converter"));
CORRADE_INTERNAL_ASSERT(importer && converter);
std::unique_ptr<Trade::AbstractImporter> importer = importerManager.instance(args.value("importer"));
CORRADE_INTERNAL_ASSERT(importer);
std::unique_ptr<Trade::AbstractImageConverter> converter = converterManager.instance(args.value("converter"));
CORRADE_INTERNAL_ASSERT(converter);
/* Open input file */
std::optional<Trade::ImageData2D> image;
if(!importer->openFile(args.value("input")) || !(image = importer->image2D(0))) {
Error() << "Cannot open file" << args.value("input");
delete importer;
delete converter;
return 1;
}
delete importer;
if(image->format() != ImageFormat::Red) {
Error() << "Unsupported image format" << image->format();
delete converter;
return 1;
}
@ -120,11 +117,9 @@ int DistanceFieldConverter::exec() {
output.image(0, result);
if(!converter->exportToFile(result, args.value("output"))) {
Error() << "Cannot save file" << args.value("output");
delete converter;
return 1;
}
delete converter;
return 0;
}

2
src/Trade/AbstractImporter.h

@ -70,6 +70,8 @@ checked by the implementation:
is any file opened.
- All `do*()` implementations taking data ID as parameter are called only if
the ID is from valid range.
@todo How to handle casting from std::unique_ptr<> in more convenient way?
*/
class MAGNUM_EXPORT AbstractImporter: public PluginManager::AbstractPlugin {
CORRADE_PLUGIN_INTERFACE("cz.mosra.magnum.Trade.AbstractImporter/0.3")

8
src/Trade/AbstractMaterialData.cpp

@ -28,7 +28,7 @@
namespace Magnum { namespace Trade {
AbstractMaterialData::AbstractMaterialData(Type type): _type(type) {}
AbstractMaterialData::AbstractMaterialData(MaterialType type): _type(type) {}
AbstractMaterialData::~AbstractMaterialData() {}
@ -41,14 +41,14 @@ AbstractMaterialData& AbstractMaterialData::operator=(AbstractMaterialData&& oth
return *this;
}
Debug operator<<(Debug debug, const AbstractMaterialData::Type value) {
Debug operator<<(Debug debug, const MaterialType value) {
switch(value) {
#define _c(value) case AbstractMaterialData::Type::value: return debug << "Trade::AbstractMaterialData::Type::" #value;
#define _c(value) case MaterialType::value: return debug << "Trade::MaterialType::" #value;
_c(Phong)
#undef _c
}
return debug << "Trade::AbstractMaterialData::Type::(unknown)";
return debug << "Trade::MaterialType::(unknown)";
}
}}

24
src/Trade/AbstractMaterialData.h

@ -25,7 +25,7 @@
*/
/** @file
* @brief Class Magnum::Trade::AbstractMaterialData
* @brief Class @ref Magnum::Trade::AbstractMaterialData, enum @ref Magnum::Trade::MaterialType
*/
#include "magnumVisibility.h"
@ -33,6 +33,15 @@
namespace Magnum { namespace Trade {
/**
@brief Material type
@see @ref AbstractMaterialData::type()
*/
enum class MaterialType: UnsignedByte {
Phong /**< Phong shading */
};
/**
@brief Base for material data
@ -40,16 +49,11 @@ Subclasses provide access to parameters for given material type.
*/
class MAGNUM_EXPORT AbstractMaterialData {
public:
/** @brief Material type */
enum class Type: UnsignedByte {
Phong /**< Phong shading */
};
/**
* @brief Constructor
* @param type Material type
*/
explicit AbstractMaterialData(Type type);
explicit AbstractMaterialData(MaterialType type);
/** @brief Destructor */
virtual ~AbstractMaterialData() = 0;
@ -67,14 +71,14 @@ class MAGNUM_EXPORT AbstractMaterialData {
AbstractMaterialData& operator=(AbstractMaterialData&&);
/** @brief Material type */
Type type() const { return _type; }
MaterialType type() const { return _type; }
private:
Type _type;
MaterialType _type;
};
/** @debugoperator{Magnum::Trade::AbstractMaterialData} */
Debug MAGNUM_EXPORT operator<<(Debug debug, AbstractMaterialData::Type value);
Debug MAGNUM_EXPORT operator<<(Debug debug, MaterialType value);
}}

2
src/Trade/MeshObjectData2D.cpp

@ -26,7 +26,7 @@
namespace Magnum { namespace Trade {
MeshObjectData2D::MeshObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation, UnsignedInt instance, UnsignedInt material): ObjectData2D(std::move(children), transformation, InstanceType::Mesh, instance), _material(material) {}
MeshObjectData2D::MeshObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation, UnsignedInt instance, UnsignedInt material): ObjectData2D(std::move(children), transformation, ObjectInstanceType2D::Mesh, instance), _material(material) {}
/* GCC 4.4 doesn't like it defaulted */
MeshObjectData2D::MeshObjectData2D(MeshObjectData2D&& other): ObjectData2D(std::move(other)), _material(other._material) {}

2
src/Trade/MeshObjectData3D.cpp

@ -26,7 +26,7 @@
namespace Magnum { namespace Trade {
MeshObjectData3D::MeshObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, UnsignedInt instance, UnsignedInt material): ObjectData3D(std::move(children), transformation, InstanceType::Mesh, instance), _material(material) {}
MeshObjectData3D::MeshObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, UnsignedInt instance, UnsignedInt material): ObjectData3D(std::move(children), transformation, ObjectInstanceType3D::Mesh, instance), _material(material) {}
/* GCC 4.4 doesn't like it defaulted */
MeshObjectData3D::MeshObjectData3D(MeshObjectData3D&& other): ObjectData3D(std::move(other)), _material(other._material) {}

10
src/Trade/ObjectData2D.cpp

@ -26,9 +26,9 @@
namespace Magnum { namespace Trade {
ObjectData2D::ObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation, ObjectData2D::InstanceType instanceType, UnsignedInt instance): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instance(instance) {}
ObjectData2D::ObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation, ObjectInstanceType2D instanceType, UnsignedInt instance): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instance(instance) {}
ObjectData2D::ObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation): _children(children), _transformation(transformation), _instanceType(InstanceType::Empty), _instance(-1) {}
ObjectData2D::ObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation): _children(std::move(children)), _transformation(transformation), _instanceType(ObjectInstanceType2D::Empty), _instance(-1) {}
/* GCC 4.4 doesn't like it defaulted */
ObjectData2D::ObjectData2D(ObjectData2D&& other): _children(std::move(other._children)), _transformation(std::move(other._transformation)), _instanceType(std::move(other._instanceType)), _instance(std::move(other._instance)) {}
@ -45,16 +45,16 @@ ObjectData2D& ObjectData2D::operator=(ObjectData2D&& other) {
}
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug operator<<(Debug debug, ObjectData2D::InstanceType value) {
Debug operator<<(Debug debug, ObjectInstanceType2D value) {
switch(value) {
#define _c(value) case ObjectData2D::InstanceType::value: return debug << "Trade::ObjectData2D::InstanceType::" #value;
#define _c(value) case ObjectInstanceType2D::value: return debug << "Trade::ObjectInstanceType2D::" #value;
_c(Camera)
_c(Mesh)
_c(Empty)
#undef _c
}
return debug << "ObjectData2D::InstanceType::(invalid)";
return debug << "Trade::ObjectInstanceType2D::(invalid)";
}
#endif

40
src/Trade/ObjectData2D.h

@ -25,7 +25,7 @@
*/
/** @file
* @brief Class Magnum::Trade::ObjectData2D
* @brief Class @ref Magnum::Trade::ObjectData2D, enum @ref Magnum::Trade::ObjectInstanceType2D
*/
#include <vector>
@ -35,6 +35,23 @@
namespace Magnum { namespace Trade {
/**
@brief Type of instance held by given 2D object
@see @ref ObjectData2D::instanceType()
*/
enum class ObjectInstanceType2D: UnsignedByte {
Camera, /**< Camera instance (see CameraData) */
/**
* Mesh instance. The data can be cast to @ref MeshObjectData2D to provide
* more information.
*/
Mesh,
Empty /**< Empty */
};
/**
@brief Two-dimensional object data
@ -43,19 +60,6 @@ Provides access to object transformation and hierarchy.
*/
class MAGNUM_EXPORT ObjectData2D {
public:
/** @brief Type of instance held by this object */
enum class InstanceType: UnsignedByte {
Camera, /**< Camera instance (see CameraData) */
/**
* Three-dimensional mesh instance. The data can be cast to
* MeshObjectData2D to provide more information.
*/
Mesh,
Empty /**< Empty */
};
/**
* @brief Constructor
* @param children Child objects
@ -63,7 +67,7 @@ class MAGNUM_EXPORT ObjectData2D {
* @param instanceType Instance type
* @param instance Instance ID
*/
explicit ObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation, InstanceType instanceType, UnsignedInt instance);
explicit ObjectData2D(std::vector<UnsignedInt> children, const Matrix3& transformation, ObjectInstanceType2D instanceType, UnsignedInt instance);
/**
* @brief Constructor for empty instance
@ -98,7 +102,7 @@ class MAGNUM_EXPORT ObjectData2D {
*
* @see instance()
*/
InstanceType instanceType() const { return _instanceType; }
ObjectInstanceType2D instanceType() const { return _instanceType; }
/**
* @brief Instance ID
@ -110,12 +114,12 @@ class MAGNUM_EXPORT ObjectData2D {
private:
std::vector<UnsignedInt> _children;
Matrix3 _transformation;
InstanceType _instanceType;
ObjectInstanceType2D _instanceType;
Int _instance;
};
/** @debugoperator{Magnum::Trade::ObjectData2D} */
Debug MAGNUM_EXPORT operator<<(Debug debug, ObjectData2D::InstanceType value);
Debug MAGNUM_EXPORT operator<<(Debug debug, ObjectInstanceType2D value);
}}

10
src/Trade/ObjectData3D.cpp

@ -26,9 +26,9 @@
namespace Magnum { namespace Trade {
ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, ObjectData3D::InstanceType instanceType, UnsignedInt instance): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instance(instance) {}
ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, ObjectInstanceType3D instanceType, UnsignedInt instance): _children(std::move(children)), _transformation(transformation), _instanceType(instanceType), _instance(instance) {}
ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation): _children(std::move(children)), _transformation(transformation), _instanceType(InstanceType::Empty), _instance(-1) {}
ObjectData3D::ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation): _children(std::move(children)), _transformation(transformation), _instanceType(ObjectInstanceType3D::Empty), _instance(-1) {}
/* GCC 4.4 doesn't like it defaulted */
ObjectData3D::ObjectData3D(ObjectData3D&& other): _children(std::move(other._children)), _transformation(std::move(other._transformation)), _instanceType(std::move(other._instanceType)), _instance(std::move(other._instance)) {}
@ -45,9 +45,9 @@ ObjectData3D& ObjectData3D::operator=(ObjectData3D&& other) {
}
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug operator<<(Debug debug, ObjectData3D::InstanceType value) {
Debug operator<<(Debug debug, ObjectInstanceType3D value) {
switch(value) {
#define _c(value) case ObjectData3D::InstanceType::value: return debug << "Trade::ObjectData3D::InstanceType::" #value;
#define _c(value) case ObjectInstanceType3D::value: return debug << "Trade::ObjectInstanceType3D::" #value;
_c(Camera)
_c(Light)
_c(Mesh)
@ -55,7 +55,7 @@ Debug operator<<(Debug debug, ObjectData3D::InstanceType value) {
#undef _c
}
return debug << "ObjectData3D::InstanceType::(invalid)";
return debug << "Trade::ObjectInstanceType3D::(invalid)";
}
#endif

43
src/Trade/ObjectData3D.h

@ -25,7 +25,7 @@
*/
/** @file
* @brief Class Magnum::Trade::ObjectData3D
* @brief Class @ref Magnum::Trade::ObjectData3D, enum @ref Magnum::Trade::ObjectInstanceType3D
*/
#include <vector>
@ -35,6 +35,25 @@
namespace Magnum { namespace Trade {
/**
@brief Type of instance held by given 3D object
@see @ref ObjectData3D::instanceType()
*/
enum class ObjectInstanceType3D: UnsignedByte {
Camera, /**< Camera instance (see CameraData) */
Light, /**< Light instance (see LightData) */
/**
* Mesh instance. The data can be cast to @ref MeshObjectData3D to provide
* more information.
*/
Mesh,
Empty /**< Empty */
};
/**
@brief Three-dimensional object data
@ -43,20 +62,6 @@ Provides access to object transformation and hierarchy.
*/
class MAGNUM_EXPORT ObjectData3D {
public:
/** @brief Type of instance held by this object */
enum class InstanceType: UnsignedByte {
Camera, /**< Camera instance (see CameraData) */
Light, /**< Light instance (see LightData) */
/**
* Three-dimensional mesh instance. The data can be cast to
* MeshObjectData3D to provide more information.
*/
Mesh,
Empty /**< Empty */
};
/**
* @brief Constructor
* @param children Child objects
@ -64,7 +69,7 @@ class MAGNUM_EXPORT ObjectData3D {
* @param instanceType Instance type
* @param instance Instance ID
*/
explicit ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, InstanceType instanceType, UnsignedInt instance);
explicit ObjectData3D(std::vector<UnsignedInt> children, const Matrix4& transformation, ObjectInstanceType3D instanceType, UnsignedInt instance);
/**
* @brief Constructor for empty instance
@ -99,7 +104,7 @@ class MAGNUM_EXPORT ObjectData3D {
*
* @see instance()
*/
InstanceType instanceType() const { return _instanceType; }
ObjectInstanceType3D instanceType() const { return _instanceType; }
/**
* @brief Instance ID
@ -111,12 +116,12 @@ class MAGNUM_EXPORT ObjectData3D {
private:
std::vector<UnsignedInt> _children;
Matrix4 _transformation;
InstanceType _instanceType;
ObjectInstanceType3D _instanceType;
Int _instance;
};
/** @debugoperator{Magnum::Trade::ObjectData3D} */
Debug MAGNUM_EXPORT operator<<(Debug debug, ObjectData3D::InstanceType value);
Debug MAGNUM_EXPORT operator<<(Debug debug, ObjectInstanceType3D value);
}}

2
src/Trade/PhongMaterialData.h

@ -71,7 +71,7 @@ class MAGNUM_EXPORT PhongMaterialData: public AbstractMaterialData {
* Colors and textures should be specified using member functions based
* on what flags are set.
*/
explicit PhongMaterialData(Flags flags, Float shininess): AbstractMaterialData(Type::Phong), _shininess(shininess), _flags(flags) {}
explicit PhongMaterialData(Flags flags, Float shininess): AbstractMaterialData(MaterialType::Phong), _shininess(shininess), _flags(flags) {}
/** @brief Material flags */
Flags flags() const { return _flags; }

4
src/Trade/Test/AbstractMaterialDataTest.cpp

@ -43,8 +43,8 @@ AbstractMaterialDataTest::AbstractMaterialDataTest() {
void AbstractMaterialDataTest::debug() {
std::ostringstream out;
Debug(&out) << AbstractMaterialData::Type::Phong;
CORRADE_COMPARE(out.str(), "Trade::AbstractMaterialData::Type::Phong\n");
Debug(&out) << MaterialType::Phong;
CORRADE_COMPARE(out.str(), "Trade::MaterialType::Phong\n");
}
}}}

4
src/Trade/Test/ObjectData2DTest.cpp

@ -42,8 +42,8 @@ ObjectData2DTest::ObjectData2DTest() {
void ObjectData2DTest::debug() {
std::ostringstream o;
Debug(&o) << ObjectData2D::InstanceType::Empty;
CORRADE_COMPARE(o.str(), "Trade::ObjectData2D::InstanceType::Empty\n");
Debug(&o) << ObjectInstanceType2D::Empty;
CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType2D::Empty\n");
}
}}}

4
src/Trade/Test/ObjectData3DTest.cpp

@ -42,8 +42,8 @@ ObjectData3DTest::ObjectData3DTest() {
void ObjectData3DTest::debug() {
std::ostringstream o;
Debug(&o) << ObjectData3D::InstanceType::Light;
CORRADE_COMPARE(o.str(), "Trade::ObjectData3D::InstanceType::Light\n");
Debug(&o) << ObjectInstanceType3D::Light;
CORRADE_COMPARE(o.str(), "Trade::ObjectInstanceType3D::Light\n");
}
}}}

2
toolchains

@ -1 +1 @@
Subproject commit 4f69504e4df9b3a1a328ba344ff1857199046e9c
Subproject commit a941827bff39e48b85c6d780e08bbc369deb9ea4
Loading…
Cancel
Save