291c23b85f880d2b15805fa91ce5404fbaed1b28
[profile/ivi/qtbase.git] / src / gui / opengl / qopengl.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.  For licensing terms and
14 ** conditions see http://qt.digia.com/licensing.  For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights.  These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file.  Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QOPENGL_H
43 #define QOPENGL_H
44
45 #ifndef QT_NO_OPENGL
46
47 #include <QtCore/qglobal.h>
48
49 QT_BEGIN_HEADER
50
51 #if defined(QT_OPENGL_ES_2)
52 # if defined(Q_OS_MAC)
53 #  include <OpenGLES/ES2/gl.h>
54 # else
55 #  include <GLES2/gl2.h>
56 # endif
57
58 /*
59    Some GLES2 implementations (like the one on Harmattan) are missing the
60    typedef for GLchar. Work around it here by adding it. The Kkronos headers
61    specify GLChar as a typedef to char, so if an implementation already
62    provides it, then this doesn't do any harm.
63 */
64 typedef char GLchar;
65
66 # include "qopengles2ext.h"
67 # ifndef GL_DOUBLE
68 #  define GL_DOUBLE GL_FLOAT
69 # endif
70 # ifndef GLdouble
71 typedef GLfloat GLdouble;
72 # endif
73 #else
74 // Mac OSX is a "controlled platform" for OpenGL ABI so we use
75 // the system provided headers there. Controlled means that the
76 // headers always match the actual driver implementation so there
77 // is no possibility of drivers exposing additional functionality
78 // from the system headers. Also it means that the vendor can
79 // (and does) make different choices about some OpenGL types. For
80 // e.g. Apple uses void* for GLhandleARB whereas other platforms
81 // use unsigned int.
82 //
83 // For the "uncontrolled" Windows and Linux platforms we use the
84 // official Khronos glext.h header. On these platforms this gives
85 // access to additional functionality the drivers may expose but
86 // which the system headers do not.
87 # if defined(Q_OS_MAC)
88 #  include <OpenGL/gl.h>
89 #  if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
90 #   define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED
91 #   include <OpenGL/gl3.h>
92 #  endif
93 #  include <OpenGL/glext.h>
94 # else
95 #  if defined(Q_OS_WIN)
96 #   include <QtCore/qt_windows.h>
97 #  endif
98 #  include <GL/gl.h>
99 #  include "qopenglext.h"
100 # endif // Q_OS_MAC
101 #endif
102
103 // Desktops, apart from Mac OS X prior to 10.7 can support OpenGL 3
104 #if !defined(QT_OPENGL_ES_2)
105 # if !defined(Q_OS_MAC) || (defined(Q_OS_MAC) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7)
106 #  define QT_OPENGL_3
107 # endif
108 #endif
109
110 QT_BEGIN_NAMESPACE
111
112
113 QT_END_NAMESPACE
114
115 QT_END_HEADER
116
117 #endif // QT_NO_OPENGL
118
119 #endif // QOPENGL_H