GL.hh 2.74 KB
Newer Older
Robert Menzel's avatar
Robert Menzel committed
1
2
3
4
5
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University         //
// All rights reserved.                                                       //
////////////////////////////////////////////////////////////////////////////////

6
7
#ifndef ACGL_OPENGL_GL_HH
#define ACGL_OPENGL_GL_HH
Robert Menzel's avatar
Robert Menzel committed
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

/*
 * This simple OpenGL wrapper is used to include OpenGL and GLEW
 * on different platforms.
 *
 * While these includes are located in a subdirectory of GL/ on most systems,
 * Apple hides them on different locations.
 *
 * This header can get configured via compile-time defines:
 *
 * -DCOMPILE_WITH_QT      : If using ACGL with QT this will also include the qgl.h
 * -DCOMPILED_FOR_OGL     : 20 21 30 31 32 33 40 41
 * -DCOMPILED_FOR_OGL_PROFILE_FULL : full OpenGL profile (>= 2.1)
 * -DCOMPILED_FOR_OGL_PROFILE_CORE : core OpenGL profile (>= 3.2)
 * -DCOMPILED_FOR_OGL_PROFILE_ES   : embedded profile (OpenGL ES 2.0)
 * -DSIMULATE_OGL_ES               : Simulate ES feature set with desktop OGL
 *
 * Not all combinations are valid!
 */

// TODO: remove and move to cmake:
#define COMPILE_WITH_QT

// We can try to build against OpenGL core profile or compatibility (core means automatically
// 3.2 or higher). On MacOS X 10.7 Lion we can choose between 2.1 or 3.2 core, but 3.2
// compatibility is not an option.
//#define USE_OPENGL_CORE_PROFILE

// If we're compiling for an Apple system we need this to distinquish between Mac and iOS:
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif

// always include glew unless on iOS
#define USE_GLEW

#if (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
    #if (TARGET_OS_IPHONE == 1)
        #define PLATFORM_IOS
        #define OPENGL_ES
        #undef USE_GLEW // no glew support on iOS
    #endif
#endif

// we have allways to include glew first!
#ifdef USE_GLEW
    #ifdef GLEW_LOCAL_PATH
        #include GLEW_LOCAL_PATH
    #else
        #if defined(__APPLE__) || defined(MACOSX)
            #include <OpenGL/glew.h>
        #else
            #include <GL/glew.h>
        #endif
    #endif // !GLEW_LOCAL_PATH
#endif // USE_GLEW


#if defined(__APPLE__) || defined(MACOSX)
    #ifdef OPENGL_ES
        #import <OpenGLES/ES1/gl.h>
        #import <OpenGLES/ES1/glext.h>
        #import <OpenGLES/ES2/gl.h>
        #import <OpenGLES/ES2/glext.h>
    #else
        // Desktop MacOS X:
        #ifdef USE_OPENGL_CORE_PROFILE
            #include <GL3/gl3.h>
        #else
            #include <OpenGL/gl.h>
        #endif
    #endif
#else
    #ifdef USE_OPENGL_CORE_PROFILE
        #include <GL3/gl3.h>
    #else
        #include <GL/gl.h>
    #endif
#endif

#ifdef COMPILE_WITH_QT
	#include <QtOpenGL/qgl.h>
#endif // USE_QT

92
#endif // ACGL_OPENGL_GL_HH