Browse Source

Added MAGNUM_TARGET_WEBGL definition.

Treating JavaScript and WebGL as first-class compile target. What the
world had come to :-)
pull/51/head
Vladimír Vondruš 12 years ago
parent
commit
6dee292654
  1. 3
      CMakeLists.txt
  2. 1
      doc/portability.dox
  3. 14
      src/Magnum/Magnum.h
  4. 1
      src/Magnum/configure.h.cmake

3
CMakeLists.txt

@ -150,6 +150,9 @@ if(TARGET_GLES)
set(MAGNUM_TARGET_GLES3 1)
endif()
endif()
if(CORRADE_TARGET_EMSCRIPTEN)
set(MAGNUM_TARGET_WEBGL 1)
endif()
if(TARGET_DESKTOP_GLES)
set(MAGNUM_TARGET_DESKTOP_GLES 1)
endif()

1
doc/portability.dox

@ -43,6 +43,7 @@ If you include @ref Magnum.h, you get these predefined macros:
- @ref MAGNUM_TARGET_GLES if targeting OpenGL ES
- @ref MAGNUM_TARGET_GLES2 if targeting OpenGL ES 2.0
- @ref MAGNUM_TARGET_GLES3 if targeting OpenGL ES 3.0
- @ref MAGNUM_TARGET_WEBGL if targeting WebGL
Example usage:
@code

14
src/Magnum/Magnum.h

@ -128,6 +128,20 @@ within standard desktop OpenGL. Implies also @ref MAGNUM_TARGET_GLES.
*/
#define MAGNUM_TARGET_DESKTOP_GLES
#undef MAGNUM_TARGET_DESKTOP_GLES
/**
@brief WebGL target
Defined if the engine is built for WebGL (using Emscripten). WebGL is nearly
equivalent to OpenGL ES 2.0, thus in most cases you don't need to treat it
differently, but there are some
[specific restrictions and features](http://www.khronos.org/registry/webgl/specs/latest/1.0/#6)
which you might want to be aware of. Implies also @ref MAGNUM_TARGET_GLES and
@ref MAGNUM_TARGET_GLES2.
@see @ref CORRADE_TARGET_EMSCRIPTEN, @ref building
*/
#define MAGNUM_TARGET_WEBGL
#undef MAGNUM_TARGET_WEBGL
#endif
/** @{ @name Basic type definitions

1
src/Magnum/configure.h.cmake

@ -29,3 +29,4 @@
#cmakedefine MAGNUM_TARGET_GLES2
#cmakedefine MAGNUM_TARGET_GLES3
#cmakedefine MAGNUM_TARGET_DESKTOP_GLES
#cmakedefine MAGNUM_TARGET_WEBGL

Loading…
Cancel
Save