Browse Source

Fixed NaCl issues with gl2.h.

Headers gl2.h and gl2ext.h shipped with NaCl are different to the
official ones, which is causing linker issues, thus using NaCl's own
gl2.h. They are otherwise similar, thus it should cause no compatibility
issues.

On the other hand, gl2ext.h shipped with NaCl is slightly outdated with
some recent extensions missing. We are including the NaCl's one and then
the official one over it (undefining the include guard). The symbols are
guarded also by extensions, so it should cause no conflicts.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
cdbc12821f
  1. 12
      external/OpenGL/GLES2/CMakeLists.txt
  2. 5
      external/OpenGL/KHR/CMakeLists.txt
  3. 12
      src/OpenGL.h

12
external/OpenGL/GLES2/CMakeLists.txt vendored

@ -22,4 +22,14 @@
# DEALINGS IN THE SOFTWARE.
#
install(FILES gl2.h gl2platform.h gl2ext.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES2)
set(MagnumOpenGL_HEADERS
gl2ext.h)
# NaCl has its own gl2.h, this one causes linker issues
if(NOT TARGET_NACL)
set(MagnumOpenGL_HEADERS ${MagnumOpenGL_HEADERS}
gl2platform.h
gl2.h)
endif()
install(FILES ${MagnumOpenGL_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/GLES2)

5
external/OpenGL/KHR/CMakeLists.txt vendored

@ -22,4 +22,7 @@
# DEALINGS IN THE SOFTWARE.
#
install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/KHR)
# NaCl has its own gl2.h, this one causes linker issues
if(NOT TARGET_NACL)
install(FILES khrplatform.h DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/OpenGL/KHR)
endif()

12
src/OpenGL.h

@ -34,6 +34,8 @@
#include <GL/glew.h>
#include <OpenGL/GL/glcorearb.h>
#else
#ifndef MAGNUM_TARGET_NACL
#include <OpenGL/KHR/khrplatform.h>
#ifndef MAGNUM_TARGET_GLES2
#include <OpenGL/GLES3/gl3platform.h>
@ -43,6 +45,16 @@
#include <OpenGL/GLES2/gl2.h>
#include <OpenGL/GLES2/gl2ext.h>
#endif
/* 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. */
#else
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#undef __gl2ext_h_
#include <OpenGL/GLES2/gl2ext.h>
#endif
#endif
#endif

Loading…
Cancel
Save