source: trunk/src/opengl/qglextensions_p.h@ 595

Last change on this file since 595 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 31.6 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtOpenGL module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
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** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QGL_EXTENSIONS_P_H
43#define QGL_EXTENSIONS_P_H
44
45//
46// W A R N I N G
47// -------------
48//
49// This file is not part of the Qt API. It exists for the convenience
50// of the Qt OpenGL classes. This header file may change from
51// version to version without notice, or even be removed.
52//
53// We mean it.
54//
55
56// extension prototypes
57#ifndef Q_WS_MAC
58# ifndef APIENTRYP
59# ifdef APIENTRY
60# define APIENTRYP APIENTRY *
61# else
62# define APIENTRY
63# define APIENTRYP *
64# endif
65# endif
66#else
67# define APIENTRY
68# define APIENTRYP *
69#endif
70
71#include <QtCore/qglobal.h>
72
73#ifndef GL_ARB_vertex_buffer_object
74typedef ptrdiff_t GLsizeiptrARB;
75#endif
76
77#ifndef GL_VERSION_2_0
78typedef char GLchar;
79#endif
80
81// ARB_pixel_buffer_object
82typedef void (APIENTRY *_glBindBuffer) (GLenum, GLuint);
83typedef void (APIENTRY *_glDeleteBuffers) (GLsizei, const GLuint *);
84typedef void (APIENTRY *_glGenBuffers) (GLsizei, GLuint *);
85typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptrARB, const GLvoid *, GLenum);
86typedef GLvoid* (APIENTRY *_glMapBufferARB) (GLenum, GLenum);
87typedef GLboolean (APIENTRY *_glUnmapBufferARB) (GLenum);
88
89// ARB_fragment_program
90typedef void (APIENTRY *_glProgramStringARB) (GLenum, GLenum, GLsizei, const GLvoid *);
91typedef void (APIENTRY *_glBindProgramARB) (GLenum, GLuint);
92typedef void (APIENTRY *_glDeleteProgramsARB) (GLsizei, const GLuint *);
93typedef void (APIENTRY *_glGenProgramsARB) (GLsizei, GLuint *);
94typedef void (APIENTRY *_glProgramLocalParameter4fvARB) (GLenum, GLuint, const GLfloat *);
95
96// GLSL
97typedef GLuint (APIENTRY *_glCreateShader) (GLenum);
98typedef void (APIENTRY *_glShaderSource) (GLuint, GLsizei, const char **, const GLint *);
99typedef void (APIENTRY *_glShaderBinary) (GLint, const GLuint*, GLenum, const void*, GLint);
100typedef void (APIENTRY *_glCompileShader) (GLuint);
101typedef void (APIENTRY *_glDeleteShader) (GLuint);
102typedef GLboolean (APIENTRY *_glIsShader) (GLuint);
103
104typedef GLuint (APIENTRY *_glCreateProgram) ();
105typedef void (APIENTRY *_glAttachShader) (GLuint, GLuint);
106typedef void (APIENTRY *_glDetachShader) (GLuint, GLuint);
107typedef void (APIENTRY *_glLinkProgram) (GLuint);
108typedef void (APIENTRY *_glUseProgram) (GLuint);
109typedef void (APIENTRY *_glDeleteProgram) (GLuint);
110typedef GLboolean (APIENTRY *_glIsProgram) (GLuint);
111
112typedef void (APIENTRY *_glGetShaderInfoLog) (GLuint, GLsizei, GLsizei *, char *);
113typedef void (APIENTRY *_glGetShaderiv) (GLuint, GLenum, GLint *);
114typedef void (APIENTRY *_glGetShaderSource) (GLuint, GLsizei, GLsizei *, char *);
115typedef void (APIENTRY *_glGetProgramiv) (GLuint, GLenum, GLint *);
116typedef void (APIENTRY *_glGetProgramInfoLog) (GLuint, GLsizei, GLsizei *, char *);
117
118typedef GLuint (APIENTRY *_glGetUniformLocation) (GLuint, const char*);
119typedef void (APIENTRY *_glUniform4fv) (GLint, GLsizei, const GLfloat *);
120typedef void (APIENTRY *_glUniform3fv) (GLint, GLsizei, const GLfloat *);
121typedef void (APIENTRY *_glUniform2fv) (GLint, GLsizei, const GLfloat *);
122typedef void (APIENTRY *_glUniform1fv) (GLint, GLsizei, const GLfloat *);
123typedef void (APIENTRY *_glUniform1i) (GLint, GLint);
124typedef void (APIENTRY *_glUniform1iv) (GLint, GLsizei, const GLint *);
125typedef void (APIENTRY *_glUniformMatrix2fv) (GLint, GLsizei, GLboolean, const GLfloat *);
126typedef void (APIENTRY *_glUniformMatrix3fv) (GLint, GLsizei, GLboolean, const GLfloat *);
127typedef void (APIENTRY *_glUniformMatrix4fv) (GLint, GLsizei, GLboolean, const GLfloat *);
128typedef void (APIENTRY *_glUniformMatrix2x3fv) (GLint, GLsizei, GLboolean, const GLfloat *);
129typedef void (APIENTRY *_glUniformMatrix2x4fv) (GLint, GLsizei, GLboolean, const GLfloat *);
130typedef void (APIENTRY *_glUniformMatrix3x2fv) (GLint, GLsizei, GLboolean, const GLfloat *);
131typedef void (APIENTRY *_glUniformMatrix3x4fv) (GLint, GLsizei, GLboolean, const GLfloat *);
132typedef void (APIENTRY *_glUniformMatrix4x2fv) (GLint, GLsizei, GLboolean, const GLfloat *);
133typedef void (APIENTRY *_glUniformMatrix4x3fv) (GLint, GLsizei, GLboolean, const GLfloat *);
134
135typedef void (APIENTRY *_glBindAttribLocation) (GLuint, GLuint, const char *);
136typedef GLint (APIENTRY *_glGetAttribLocation) (GLuint, const char *);
137typedef void (APIENTRY *_glVertexAttrib1fv) (GLuint, const GLfloat *);
138typedef void (APIENTRY *_glVertexAttrib2fv) (GLuint, const GLfloat *);
139typedef void (APIENTRY *_glVertexAttrib3fv) (GLuint, const GLfloat *);
140typedef void (APIENTRY *_glVertexAttrib4fv) (GLuint, const GLfloat *);
141typedef void (APIENTRY *_glVertexAttribPointer) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
142typedef void (APIENTRY *_glDisableVertexAttribArray) (GLuint);
143typedef void (APIENTRY *_glEnableVertexAttribArray) (GLuint);
144
145typedef void (APIENTRY *_glGetProgramBinaryOES) (GLuint, GLsizei, GLsizei *, GLenum *, void *);
146typedef void (APIENTRY *_glProgramBinaryOES) (GLuint, GLenum, const void *, GLint);
147
148
149typedef void (APIENTRY *_glMultiTexCoord4f) (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
150typedef void (APIENTRY *_glActiveStencilFaceEXT) (GLenum );
151
152// Needed for GL2 engine:
153typedef void (APIENTRY *_glStencilOpSeparate) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
154typedef void (APIENTRY *_glActiveTexture) (GLenum);
155typedef void (APIENTRY *_glBlendColor) (GLclampf, GLclampf, GLclampf, GLclampf);
156
157
158// EXT_GL_framebuffer_object
159typedef GLboolean (APIENTRY *_glIsRenderbuffer) (GLuint renderbuffer);
160typedef void (APIENTRY *_glBindRenderbuffer) (GLenum target, GLuint renderbuffer);
161typedef void (APIENTRY *_glDeleteRenderbuffers) (GLsizei n, const GLuint *renderbuffers);
162typedef void (APIENTRY *_glGenRenderbuffers) (GLsizei n, GLuint *renderbuffers);
163typedef void (APIENTRY *_glRenderbufferStorage) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
164typedef void (APIENTRY *_glGetRenderbufferParameteriv) (GLenum target, GLenum pname, GLint *params);
165typedef GLboolean (APIENTRY *_glIsFramebuffer) (GLuint framebuffer);
166typedef void (APIENTRY *_glBindFramebuffer) (GLenum target, GLuint framebuffer);
167typedef void (APIENTRY *_glDeleteFramebuffers) (GLsizei n, const GLuint *framebuffers);
168typedef void (APIENTRY *_glGenFramebuffers) (GLsizei n, GLuint *framebuffers);
169typedef GLenum (APIENTRY *_glCheckFramebufferStatus) (GLenum target);
170typedef void (APIENTRY *_glFramebufferTexture2D) (GLenum target, GLenum attachment, GLenum textarget,
171 GLuint texture, GLint level);
172typedef void (APIENTRY *_glFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget,
173 GLuint renderbuffer);
174typedef void (APIENTRY *_glGetFramebufferAttachmentParameteriv) (GLenum target, GLenum attachment, GLenum pname,
175 GLint *params);
176typedef void (APIENTRY *_glGenerateMipmap) (GLenum target);
177
178// EXT_GL_framebuffer_blit
179typedef void (APIENTRY *_glBlitFramebufferEXT) (int srcX0, int srcY0, int srcX1, int srcY1,
180 int dstX0, int dstY0, int dstX1, int dstY1,
181 GLbitfield mask, GLenum filter);
182
183// EXT_GL_framebuffer_multisample
184typedef void (APIENTRY *_glRenderbufferStorageMultisampleEXT) (GLenum target, GLsizei samples,
185 GLenum internalformat, GLsizei width, GLsizei height);
186
187// ARB_texture_compression
188typedef void (APIENTRY *_glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei,
189 GLsizei, GLint, GLsizei, const GLvoid *);
190
191QT_BEGIN_NAMESPACE
192
193struct QGLExtensionFuncs
194{
195 QGLExtensionFuncs() {
196#if !defined(QT_OPENGL_ES_2)
197 qt_glProgramStringARB = 0;
198 qt_glBindProgramARB = 0;
199 qt_glDeleteProgramsARB = 0;
200 qt_glGenProgramsARB = 0;
201 qt_glProgramLocalParameter4fvARB = 0;
202
203 // GLSL
204 qt_glCreateShader = 0;
205 qt_glShaderSource = 0;
206 qt_glShaderBinary = 0;
207 qt_glCompileShader = 0;
208 qt_glDeleteShader = 0;
209 qt_glIsShader = 0;
210
211 qt_glCreateProgram = 0;
212 qt_glAttachShader = 0;
213 qt_glDetachShader = 0;
214 qt_glLinkProgram = 0;
215 qt_glUseProgram = 0;
216 qt_glDeleteProgram = 0;
217 qt_glIsProgram = 0;
218
219 qt_glGetShaderInfoLog = 0;
220 qt_glGetShaderiv = 0;
221 qt_glGetShaderSource = 0;
222 qt_glGetProgramiv = 0;
223 qt_glGetProgramInfoLog = 0;
224
225 qt_glGetUniformLocation = 0;
226 qt_glUniform4fv = 0;
227 qt_glUniform3fv = 0;
228 qt_glUniform2fv = 0;
229 qt_glUniform1fv = 0;
230 qt_glUniform1i = 0;
231 qt_glUniform1iv = 0;
232 qt_glUniformMatrix2fv = 0;
233 qt_glUniformMatrix3fv = 0;
234 qt_glUniformMatrix4fv = 0;
235 qt_glUniformMatrix2x3fv = 0;
236 qt_glUniformMatrix2x4fv = 0;
237 qt_glUniformMatrix3x2fv = 0;
238 qt_glUniformMatrix3x4fv = 0;
239 qt_glUniformMatrix4x2fv = 0;
240 qt_glUniformMatrix4x3fv = 0;
241
242 qt_glBindAttribLocation = 0;
243 qt_glGetAttribLocation = 0;
244 qt_glVertexAttrib1fv = 0;
245 qt_glVertexAttrib2fv = 0;
246 qt_glVertexAttrib3fv = 0;
247 qt_glVertexAttrib4fv = 0;
248 qt_glVertexAttribPointer = 0;
249 qt_glDisableVertexAttribArray = 0;
250 qt_glEnableVertexAttribArray = 0;
251
252 // Extras for GL2 engine:
253 qt_glActiveTexture = 0;
254 qt_glStencilOpSeparate = 0;
255 qt_glBlendColor = 0;
256
257 qt_glActiveStencilFaceEXT = 0;
258 qt_glMultiTexCoord4f = 0;
259#else
260 qt_glslResolved = false;
261
262 qt_glGetProgramBinaryOES = 0;
263 qt_glProgramBinaryOES = 0;
264#endif
265
266 // FBOs
267#if !defined(QT_OPENGL_ES_2)
268 qt_glIsRenderbuffer = 0;
269 qt_glBindRenderbuffer = 0;
270 qt_glDeleteRenderbuffers = 0;
271 qt_glGenRenderbuffers = 0;
272 qt_glRenderbufferStorage = 0;
273 qt_glGetRenderbufferParameteriv = 0;
274 qt_glIsFramebuffer = 0;
275 qt_glBindFramebuffer = 0;
276 qt_glDeleteFramebuffers = 0;
277 qt_glGenFramebuffers = 0;
278 qt_glCheckFramebufferStatus = 0;
279 qt_glFramebufferTexture2D = 0;
280 qt_glFramebufferRenderbuffer = 0;
281 qt_glGetFramebufferAttachmentParameteriv = 0;
282 qt_glGenerateMipmap = 0;
283#endif
284 qt_glBlitFramebufferEXT = 0;
285 qt_glRenderbufferStorageMultisampleEXT = 0;
286
287 // Buffer objects:
288#if !defined(QT_OPENGL_ES_2)
289 qt_glBindBuffer = 0;
290 qt_glDeleteBuffers = 0;
291 qt_glGenBuffers = 0;
292 qt_glBufferData = 0;
293#endif
294 qt_glMapBufferARB = 0;
295 qt_glUnmapBufferARB = 0;
296
297#if !defined(QT_OPENGL_ES)
298 // Texture compression
299 qt_glCompressedTexImage2DARB = 0;
300#endif
301 }
302
303
304#if !defined(QT_OPENGL_ES_2)
305 _glProgramStringARB qt_glProgramStringARB;