Commit 3532829b authored by Robert Menzel's avatar Robert Menzel

added check for pre-included glew

parent d5ac0f68
......@@ -159,73 +159,77 @@
#endif
#else // ACGL_OPENGL_ES
// desktop:
#if (defined(__APPLE__) || defined(MACOSX)) && defined(ACGL_OPENGL_PROFILE_FULL)
#if ACGL_OPENGL_VERSION > 21
#warning "On MacOS X only core profile is supported for OpenGL >= 3.2"
#undef ACGL_OPENGL_PROFILE_FULL
#define ACGL_OPENGL_PROFILE_CORE
#ifndef __glew_h__
// if glew was already included, don't include anything else
// not the recommended way to do it but possible
#if (defined(__APPLE__) || defined(MACOSX)) && defined(ACGL_OPENGL_PROFILE_FULL)
#if ACGL_OPENGL_VERSION > 21
#warning "On MacOS X only core profile is supported for OpenGL >= 3.2"
#undef ACGL_OPENGL_PROFILE_FULL
#define ACGL_OPENGL_PROFILE_CORE
#endif
#endif
#endif
#ifdef ACGL_USE_GLEW
// if GLEW_STATIC is defined, GLEW gets linked statically. GLEW itself needs this define
// but for us its the sign that a local version of GLEW gets used, so we find it on
// GL/glew.h on every system.
#ifdef GLEW_STATIC
#include "GL/glew.h"
#else
#if defined(__APPLE__) || defined(MACOSX)
#include <OpenGL/glew.h>
#ifdef ACGL_USE_GLEW
// if GLEW_STATIC is defined, GLEW gets linked statically. GLEW itself needs this define
// but for us its the sign that a local version of GLEW gets used, so we find it on
// GL/glew.h on every system.
#ifdef GLEW_STATIC
#include "GL/glew.h"
#else
#include <GL/glew.h>
#endif
#endif // !GLEW_LOCAL_PATH
#else
// use the internal loader:
#define ACGL_EXTENSION_LOADER_GLLOADGEN
// prevent other GL headers from getting included and redefine GL:
#define __gl3_h_
//
// Include the right header which has just what is needed to catch compatibility problems at compiletime.
// The selection could also be done with some preprocessor magic but it confuses most IDEs.
//
#ifdef ACGL_OPENGL_PROFILE_CORE
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_OPENGL_VERSION_43)
#include <ACGL/OpenGL/glloaders/gl_core_43.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#include <ACGL/OpenGL/glloaders/gl_core_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
#include <ACGL/OpenGL/glloaders/gl_core_33.hh>
#elif defined (ACGL_OPENGL_VERSION_40)
#include <ACGL/OpenGL/glloaders/gl_core_40.hh>
#elif defined (ACGL_OPENGL_VERSION_41)
#include <ACGL/OpenGL/glloaders/gl_core_41.hh>
#elif defined (ACGL_OPENGL_VERSION_42)
#include <ACGL/OpenGL/glloaders/gl_core_42.hh>
#endif
#if defined(__APPLE__) || defined(MACOSX)
#include <OpenGL/glew.h>
#else
#include <GL/glew.h>
#endif
#endif // !GLEW_LOCAL_PATH
#else
// compatibility profile:
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_OPENGL_VERSION_43)
#include <ACGL/OpenGL/glloaders/gl_compatibility_43.hh>
#elif defined (ACGL_OPENGL_VERSION_21)
#include <ACGL/OpenGL/glloaders/gl_21.hh>
#elif defined (ACGL_OPENGL_VERSION_30)
#include <ACGL/OpenGL/glloaders/gl_30.hh>
#elif defined (ACGL_OPENGL_VERSION_31)
#include <ACGL/OpenGL/glloaders/gl_31.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#include <ACGL/OpenGL/glloaders/gl_compatibility_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
#include <ACGL/OpenGL/glloaders/gl_compatibility_33.hh>
#elif defined (ACGL_OPENGL_VERSION_40)
#include <ACGL/OpenGL/glloaders/gl_compatibility_40.hh>
#elif defined (ACGL_OPENGL_VERSION_41)
#include <ACGL/OpenGL/glloaders/gl_compatibility_41.hh>
#elif defined (ACGL_OPENGL_VERSION_42)
#include <ACGL/OpenGL/glloaders/gl_compatibility_42.hh>
#endif
#endif // ACGL_OPENGL_PROFILE_CORE
#endif // ACGL_USE_GLEW
// use the internal loader:
#define ACGL_EXTENSION_LOADER_GLLOADGEN
// prevent other GL headers from getting included and redefine GL:
#define __gl3_h_
//
// Include the right header which has just what is needed to catch compatibility problems at compiletime.
// The selection could also be done with some preprocessor magic but it confuses most IDEs.
//
#ifdef ACGL_OPENGL_PROFILE_CORE
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_OPENGL_VERSION_43)
#include <ACGL/OpenGL/glloaders/gl_core_43.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#include <ACGL/OpenGL/glloaders/gl_core_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
#include <ACGL/OpenGL/glloaders/gl_core_33.hh>
#elif defined (ACGL_OPENGL_VERSION_40)
#include <ACGL/OpenGL/glloaders/gl_core_40.hh>
#elif defined (ACGL_OPENGL_VERSION_41)
#include <ACGL/OpenGL/glloaders/gl_core_41.hh>
#elif defined (ACGL_OPENGL_VERSION_42)
#include <ACGL/OpenGL/glloaders/gl_core_42.hh>
#endif
#else
// compatibility profile:
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_OPENGL_VERSION_43)
#include <ACGL/OpenGL/glloaders/gl_compatibility_43.hh>
#elif defined (ACGL_OPENGL_VERSION_21)
#include <ACGL/OpenGL/glloaders/gl_21.hh>
#elif defined (ACGL_OPENGL_VERSION_30)
#include <ACGL/OpenGL/glloaders/gl_30.hh>
#elif defined (ACGL_OPENGL_VERSION_31)
#include <ACGL/OpenGL/glloaders/gl_31.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#include <ACGL/OpenGL/glloaders/gl_compatibility_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
#include <ACGL/OpenGL/glloaders/gl_compatibility_33.hh>
#elif defined (ACGL_OPENGL_VERSION_40)
#include <ACGL/OpenGL/glloaders/gl_compatibility_40.hh>
#elif defined (ACGL_OPENGL_VERSION_41)
#include <ACGL/OpenGL/glloaders/gl_compatibility_41.hh>
#elif defined (ACGL_OPENGL_VERSION_42)
#include <ACGL/OpenGL/glloaders/gl_compatibility_42.hh>
#endif
#endif // ACGL_OPENGL_PROFILE_CORE
#endif // ACGL_USE_GLEW
#endif // __GLEW__
#endif // ACGL_OPENGL_ES
#endif // ACGL_OPENGL_GL_HH
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment