author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 20:15:53 +0300 | |
branch | RCL_3 |
changeset 13 | c0432d11811c |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the demonstration applications of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef GLEXTENSIONS_H |
|
43 |
#define GLEXTENSIONS_H |
|
44 |
||
45 |
#include <QtOpenGL> |
|
46 |
||
47 |
/* |
|
48 |
Functions resolved: |
|
49 |
||
50 |
glGenFramebuffersEXT |
|
51 |
glGenRenderbuffersEXT |
|
52 |
glBindRenderbufferEXT |
|
53 |
glRenderbufferStorageEXT |
|
54 |
glDeleteFramebuffersEXT |
|
55 |
glDeleteRenderbuffersEXT |
|
56 |
glBindFramebufferEXT |
|
57 |
glFramebufferTexture2DEXT |
|
58 |
glFramebufferRenderbufferEXT |
|
59 |
glCheckFramebufferStatusEXT |
|
60 |
||
61 |
glActiveTexture |
|
62 |
glTexImage3D |
|
63 |
||
64 |
glGenBuffers |
|
65 |
glBindBuffer |
|
66 |
glBufferData |
|
67 |
glDeleteBuffers |
|
68 |
glMapBuffer |
|
69 |
glUnmapBuffer |
|
70 |
*/ |
|
71 |
||
72 |
#ifndef Q_WS_MAC |
|
73 |
# ifndef APIENTRYP |
|
74 |
# ifdef APIENTRY |
|
75 |
# define APIENTRYP APIENTRY * |
|
76 |
# else |
|
77 |
# define APIENTRY |
|
78 |
# define APIENTRYP * |
|
79 |
# endif |
|
80 |
# endif |
|
81 |
#else |
|
82 |
# define APIENTRY |
|
83 |
# define APIENTRYP * |
|
84 |
#endif |
|
85 |
||
86 |
#ifndef GL_VERSION_1_2 |
|
87 |
#define GL_TEXTURE_3D 0x806F |
|
88 |
#define GL_TEXTURE_WRAP_R 0x8072 |
|
89 |
#define GL_CLAMP_TO_EDGE 0x812F |
|
90 |
#define GL_BGRA 0x80E1 |
|
91 |
#endif |
|
92 |
||
93 |
#ifndef GL_VERSION_1_3 |
|
94 |
#define GL_TEXTURE0 0x84C0 |
|
95 |
#define GL_TEXTURE1 0x84C1 |
|
96 |
#define GL_TEXTURE2 0x84C2 |
|
97 |
#define GL_TEXTURE_CUBE_MAP 0x8513 |
|
98 |
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 |
|
99 |
//#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 |
|
100 |
//#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 |
|
101 |
//#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 |
|
102 |
//#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 |
|
103 |
//#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A |
|
104 |
#endif |
|
105 |
||
106 |
#ifndef GL_ARB_vertex_buffer_object |
|
107 |
typedef ptrdiff_t GLsizeiptrARB; |
|
108 |
#endif |
|
109 |
||
110 |
#ifndef GL_VERSION_1_5 |
|
111 |
#define GL_ARRAY_BUFFER 0x8892 |
|
112 |
#define GL_ELEMENT_ARRAY_BUFFER 0x8893 |
|
113 |
#define GL_READ_WRITE 0x88BA |
|
114 |
#define GL_STATIC_DRAW 0x88E4 |
|
115 |
#endif |
|
116 |
||
117 |
#ifndef GL_EXT_framebuffer_object |
|
118 |
#define GL_RENDERBUFFER_EXT 0x8D41 |
|
119 |
#define GL_FRAMEBUFFER_EXT 0x8D40 |
|
120 |
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 |
|
121 |
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 |
|
122 |
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 |
|
123 |
#endif |
|
124 |
||
125 |
typedef void (APIENTRY *_glGenFramebuffersEXT) (GLsizei, GLuint *); |
|
126 |
typedef void (APIENTRY *_glGenRenderbuffersEXT) (GLsizei, GLuint *); |
|
127 |
typedef void (APIENTRY *_glBindRenderbufferEXT) (GLenum, GLuint); |
|
128 |
typedef void (APIENTRY *_glRenderbufferStorageEXT) (GLenum, GLenum, GLsizei, GLsizei); |
|
129 |
typedef void (APIENTRY *_glDeleteFramebuffersEXT) (GLsizei, const GLuint*); |
|
130 |
typedef void (APIENTRY *_glDeleteRenderbuffersEXT) (GLsizei, const GLuint*); |
|
131 |
typedef void (APIENTRY *_glBindFramebufferEXT) (GLenum, GLuint); |
|
132 |
typedef void (APIENTRY *_glFramebufferTexture2DEXT) (GLenum, GLenum, GLenum, GLuint, GLint); |
|
133 |
typedef void (APIENTRY *_glFramebufferRenderbufferEXT) (GLenum, GLenum, GLenum, GLuint); |
|
134 |
typedef GLenum (APIENTRY *_glCheckFramebufferStatusEXT) (GLenum); |
|
135 |
||
136 |
typedef void (APIENTRY *_glActiveTexture) (GLenum); |
|
137 |
typedef void (APIENTRY *_glTexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); |
|
138 |
||
139 |
typedef void (APIENTRY *_glGenBuffers) (GLsizei, GLuint *); |
|
140 |
typedef void (APIENTRY *_glBindBuffer) (GLenum, GLuint); |
|
141 |
typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); |
|
142 |
typedef void (APIENTRY *_glDeleteBuffers) (GLsizei, const GLuint *); |
|
143 |
typedef void *(APIENTRY *_glMapBuffer) (GLenum, GLenum); |
|
144 |
typedef GLboolean (APIENTRY *_glUnmapBuffer) (GLenum); |
|
145 |
||
146 |
struct GLExtensionFunctions |
|
147 |
{ |
|
148 |
bool resolve(const QGLContext *context); |
|
149 |
||
150 |
bool fboSupported(); |
|
151 |
bool openGL15Supported(); // the rest: multi-texture, 3D-texture, vertex buffer objects |
|
152 |
||
153 |
_glGenFramebuffersEXT GenFramebuffersEXT; |
|
154 |
_glGenRenderbuffersEXT GenRenderbuffersEXT; |
|
155 |
_glBindRenderbufferEXT BindRenderbufferEXT; |
|
156 |
_glRenderbufferStorageEXT RenderbufferStorageEXT; |
|
157 |
_glDeleteFramebuffersEXT DeleteFramebuffersEXT; |
|
158 |
_glDeleteRenderbuffersEXT DeleteRenderbuffersEXT; |
|
159 |
_glBindFramebufferEXT BindFramebufferEXT; |
|
160 |
_glFramebufferTexture2DEXT FramebufferTexture2DEXT; |
|
161 |
_glFramebufferRenderbufferEXT FramebufferRenderbufferEXT; |
|
162 |
_glCheckFramebufferStatusEXT CheckFramebufferStatusEXT; |
|
163 |
||
164 |
_glActiveTexture ActiveTexture; |
|
165 |
_glTexImage3D TexImage3D; |
|
166 |
||
167 |
_glGenBuffers GenBuffers; |
|
168 |
_glBindBuffer BindBuffer; |
|
169 |
_glBufferData BufferData; |
|
170 |
_glDeleteBuffers DeleteBuffers; |
|
171 |
_glMapBuffer MapBuffer; |
|
172 |
_glUnmapBuffer UnmapBuffer; |
|
173 |
}; |
|
174 |
||
175 |
inline GLExtensionFunctions &getGLExtensionFunctions() |
|
176 |
{ |
|
177 |
static GLExtensionFunctions funcs; |
|
178 |
return funcs; |
|
179 |
} |
|
180 |
||
181 |
#define glGenFramebuffersEXT getGLExtensionFunctions().GenFramebuffersEXT |
|
182 |
#define glGenRenderbuffersEXT getGLExtensionFunctions().GenRenderbuffersEXT |
|
183 |
#define glBindRenderbufferEXT getGLExtensionFunctions().BindRenderbufferEXT |
|
184 |
#define glRenderbufferStorageEXT getGLExtensionFunctions().RenderbufferStorageEXT |
|
185 |
#define glDeleteFramebuffersEXT getGLExtensionFunctions().DeleteFramebuffersEXT |
|
186 |
#define glDeleteRenderbuffersEXT getGLExtensionFunctions().DeleteRenderbuffersEXT |
|
187 |
#define glBindFramebufferEXT getGLExtensionFunctions().BindFramebufferEXT |
|
188 |
#define glFramebufferTexture2DEXT getGLExtensionFunctions().FramebufferTexture2DEXT |
|
189 |
#define glFramebufferRenderbufferEXT getGLExtensionFunctions().FramebufferRenderbufferEXT |
|
190 |
#define glCheckFramebufferStatusEXT getGLExtensionFunctions().CheckFramebufferStatusEXT |
|
191 |
||
192 |
#define glActiveTexture getGLExtensionFunctions().ActiveTexture |
|
193 |
#define glTexImage3D getGLExtensionFunctions().TexImage3D |
|
194 |
||
195 |
#define glGenBuffers getGLExtensionFunctions().GenBuffers |
|
196 |
#define glBindBuffer getGLExtensionFunctions().BindBuffer |
|
197 |
#define glBufferData getGLExtensionFunctions().BufferData |
|
198 |
#define glDeleteBuffers getGLExtensionFunctions().DeleteBuffers |
|
199 |
#define glMapBuffer getGLExtensionFunctions().MapBuffer |
|
200 |
#define glUnmapBuffer getGLExtensionFunctions().UnmapBuffer |
|
201 |
||
202 |
#endif |