0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the QtOpenGL module 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 |
#include "qgl_p.h"
|
|
43 |
|
|
44 |
QT_BEGIN_NAMESPACE
|
|
45 |
|
|
46 |
static void *qt_gl_getProcAddress_search
|
|
47 |
(QGLContext *ctx, const char *name1, const char *name2,
|
|
48 |
const char *name3, const char *name4)
|
|
49 |
{
|
|
50 |
void *addr;
|
|
51 |
|
|
52 |
addr = ctx->getProcAddress(QLatin1String(name1));
|
|
53 |
if (addr)
|
|
54 |
return addr;
|
|
55 |
|
|
56 |
addr = ctx->getProcAddress(QLatin1String(name2));
|
|
57 |
if (addr)
|
|
58 |
return addr;
|
|
59 |
|
|
60 |
addr = ctx->getProcAddress(QLatin1String(name3));
|
|
61 |
if (addr)
|
|
62 |
return addr;
|
|
63 |
|
|
64 |
if (name4)
|
|
65 |
return ctx->getProcAddress(QLatin1String(name4));
|
|
66 |
|
|
67 |
return 0;
|
|
68 |
}
|
|
69 |
|
|
70 |
// Search for an extension function starting with the most likely
|
|
71 |
// function suffix first, and then trying the other variations.
|
|
72 |
#if defined(QT_OPENGL_ES)
|
|
73 |
#define qt_gl_getProcAddress(ctx,name) \
|
|
74 |
qt_gl_getProcAddress_search((ctx), name, name "OES", name "EXT", name "ARB")
|
|
75 |
#define qt_gl_getProcAddressEXT(ctx,name) \
|
|
76 |
qt_gl_getProcAddress_search((ctx), name "OES", name, name "EXT", name "ARB")
|
|
77 |
#define qt_gl_getProcAddressARB(ctx,name) \
|
|
78 |
qt_gl_getProcAddress_search((ctx), name "OES", name, name "ARB", name "EXT")
|
|
79 |
#define qt_gl_getProcAddressOES(ctx,name) \
|
|
80 |
qt_gl_getProcAddress_search((ctx), name "OES", name, name "EXT", name "ARB")
|
|
81 |
#else
|
|
82 |
#define qt_gl_getProcAddress(ctx,name) \
|
|
83 |
qt_gl_getProcAddress_search((ctx), name, name "ARB", name "EXT", 0)
|
|
84 |
#define qt_gl_getProcAddressEXT(ctx,name) \
|
|
85 |
qt_gl_getProcAddress_search((ctx), name "EXT", name, name "ARB", 0)
|
|
86 |
#define qt_gl_getProcAddressARB(ctx,name) \
|
|
87 |
qt_gl_getProcAddress_search((ctx), name "ARB", name, name "EXT", 0)
|
|
88 |
#define qt_gl_getProcAddressOES(ctx,name) \
|
|
89 |
qt_gl_getProcAddress_search((ctx), name "OES", name, name "EXT", name "ARB")
|
|
90 |
#endif
|
|
91 |
|
|
92 |
bool qt_resolve_framebufferobject_extensions(QGLContext *ctx)
|
|
93 |
{
|
|
94 |
#if defined(QT_OPENGL_ES_2)
|
|
95 |
static bool have_resolved = false;
|
|
96 |
if (have_resolved)
|
|
97 |
return true;
|
|
98 |
have_resolved = true;
|
|
99 |
#else
|
|
100 |
if (glIsRenderbuffer != 0)
|
|
101 |
return true;
|
|
102 |
#endif
|
|
103 |
|
|
104 |
if (ctx == 0) {
|
|
105 |
qWarning("QGLFramebufferObject: Unable to resolve framebuffer object extensions -"
|
|
106 |
" make sure there is a current context when creating the framebuffer object.");
|
|
107 |
return false;
|
|
108 |
}
|
|
109 |
|
|
110 |
|
|
111 |
glBlitFramebufferEXT = (_glBlitFramebufferEXT) qt_gl_getProcAddressEXT(ctx, "glBlitFramebuffer");
|
|
112 |
glRenderbufferStorageMultisampleEXT =
|
|
113 |
(_glRenderbufferStorageMultisampleEXT) qt_gl_getProcAddressEXT(ctx, "glRenderbufferStorageMultisample");
|
|
114 |
|
|
115 |
#if !defined(QT_OPENGL_ES_2)
|
|
116 |
glIsRenderbuffer = (_glIsRenderbuffer) qt_gl_getProcAddressEXT(ctx, "glIsRenderbuffer");
|
|
117 |
if (!glIsRenderbuffer)
|
|
118 |
return false; // Not much point searching for anything else.
|
|
119 |
glBindRenderbuffer = (_glBindRenderbuffer) qt_gl_getProcAddressEXT(ctx, "glBindRenderbuffer");
|
|
120 |
glDeleteRenderbuffers = (_glDeleteRenderbuffers) qt_gl_getProcAddressEXT(ctx, "glDeleteRenderbuffers");
|
|
121 |
glGenRenderbuffers = (_glGenRenderbuffers) qt_gl_getProcAddressEXT(ctx, "glGenRenderbuffers");
|
|
122 |
glRenderbufferStorage = (_glRenderbufferStorage) qt_gl_getProcAddressEXT(ctx, "glRenderbufferStorage");
|
|
123 |
glGetRenderbufferParameteriv =
|
|
124 |
(_glGetRenderbufferParameteriv) qt_gl_getProcAddressEXT(ctx, "glGetRenderbufferParameteriv");
|
|
125 |
glIsFramebuffer = (_glIsFramebuffer) qt_gl_getProcAddressEXT(ctx, "glIsFramebuffer");
|
|
126 |
glBindFramebuffer = (_glBindFramebuffer) qt_gl_getProcAddressEXT(ctx, "glBindFramebuffer");
|
|
127 |
glDeleteFramebuffers = (_glDeleteFramebuffers) qt_gl_getProcAddressEXT(ctx, "glDeleteFramebuffers");
|
|
128 |
glGenFramebuffers = (_glGenFramebuffers) qt_gl_getProcAddressEXT(ctx, "glGenFramebuffers");
|
|
129 |
glCheckFramebufferStatus = (_glCheckFramebufferStatus) qt_gl_getProcAddressEXT(ctx, "glCheckFramebufferStatus");
|
|
130 |
glFramebufferTexture2D = (_glFramebufferTexture2D) qt_gl_getProcAddressEXT(ctx, "glFramebufferTexture2D");
|
|
131 |
glFramebufferRenderbuffer = (_glFramebufferRenderbuffer) qt_gl_getProcAddressEXT(ctx, "glFramebufferRenderbuffer");
|
|
132 |
glGetFramebufferAttachmentParameteriv =
|
|
133 |
(_glGetFramebufferAttachmentParameteriv) qt_gl_getProcAddressEXT(ctx, "glGetFramebufferAttachmentParameteriv");
|
|
134 |
glGenerateMipmap = (_glGenerateMipmap) qt_gl_getProcAddressEXT(ctx, "glGenerateMipmap");
|
|
135 |
|
|
136 |
return glIsRenderbuffer != 0;
|
|
137 |
#else
|
|
138 |
return true;
|
|
139 |
#endif
|
|
140 |
}
|
|
141 |
|
|
142 |
#if !defined(QT_OPENGL_ES_2)
|
|
143 |
bool qt_resolve_version_1_3_functions(QGLContext *ctx)
|
|
144 |
{
|
|
145 |
if (glMultiTexCoord4f != 0)
|
|
146 |
return true;
|
|
147 |
|
|
148 |
QGLContext cx(QGLFormat::defaultFormat());
|
|
149 |
glMultiTexCoord4f = (_glMultiTexCoord4f) ctx->getProcAddress(QLatin1String("glMultiTexCoord4f"));
|
|
150 |
|
|
151 |
glActiveTexture = (_glActiveTexture) ctx->getProcAddress(QLatin1String("glActiveTexture"));
|
|
152 |
return glMultiTexCoord4f && glActiveTexture;
|
|
153 |
}
|
|
154 |
#endif
|
|
155 |
|
|
156 |
#if !defined(QT_OPENGL_ES_2)
|
|
157 |
bool qt_resolve_stencil_face_extension(QGLContext *ctx)
|
|
158 |
{
|
|
159 |
if (glActiveStencilFaceEXT != 0)
|
|
160 |
return true;
|
|
161 |
|
|
162 |
QGLContext cx(QGLFormat::defaultFormat());
|
|
163 |
glActiveStencilFaceEXT = (_glActiveStencilFaceEXT) ctx->getProcAddress(QLatin1String("glActiveStencilFaceEXT"));
|
|
164 |
|
|
165 |
return glActiveStencilFaceEXT;
|
|
166 |
}
|
|
167 |
#endif
|
|
168 |
|
|
169 |
|
|
170 |
#if !defined(QT_OPENGL_ES_2)
|
|
171 |
bool qt_resolve_frag_program_extensions(QGLContext *ctx)
|
|
172 |
{
|
|
173 |
if (glProgramStringARB != 0)
|
|
174 |
return true;
|
|
175 |
|
|
176 |
// ARB_fragment_program
|
|
177 |
glProgramStringARB = (_glProgramStringARB) ctx->getProcAddress(QLatin1String("glProgramStringARB"));
|
|
178 |
glBindProgramARB = (_glBindProgramARB) ctx->getProcAddress(QLatin1String("glBindProgramARB"));
|
|
179 |
glDeleteProgramsARB = (_glDeleteProgramsARB) ctx->getProcAddress(QLatin1String("glDeleteProgramsARB"));
|
|
180 |
glGenProgramsARB = (_glGenProgramsARB) ctx->getProcAddress(QLatin1String("glGenProgramsARB"));
|
|
181 |
glProgramLocalParameter4fvARB = (_glProgramLocalParameter4fvARB) ctx->getProcAddress(QLatin1String("glProgramLocalParameter4fvARB"));
|
|
182 |
|
|
183 |
return glProgramStringARB
|
|
184 |
&& glBindProgramARB
|
|
185 |
&& glDeleteProgramsARB
|
|
186 |
&& glGenProgramsARB
|
|
187 |
&& glProgramLocalParameter4fvARB;
|
|
188 |
}
|
|
189 |
#endif
|
|
190 |
|
|
191 |
|
|
192 |
bool qt_resolve_buffer_extensions(QGLContext *ctx)
|
|
193 |
{
|
|
194 |
if (glMapBufferARB && glUnmapBufferARB
|
|
195 |
#if !defined(QT_OPENGL_ES_2)
|
|
196 |
&& glBindBuffer && glDeleteBuffers && glGenBuffers && glBufferData
|
|
197 |
#endif
|
|
198 |
)
|
|
199 |
return true;
|
|
200 |
|
|
201 |
#if !defined(QT_OPENGL_ES_2)
|
|
202 |
glBindBuffer = (_glBindBuffer) qt_gl_getProcAddressARB(ctx, "glBindBuffer");
|
|
203 |
glDeleteBuffers = (_glDeleteBuffers) qt_gl_getProcAddressARB(ctx, "glDeleteBuffers");
|
|
204 |
glGenBuffers = (_glGenBuffers) qt_gl_getProcAddressARB(ctx, "glGenBuffers");
|
|
205 |
glBufferData = (_glBufferData) qt_gl_getProcAddressARB(ctx, "glBufferData");
|
|
206 |
#endif
|
|
207 |
glMapBufferARB = (_glMapBufferARB) qt_gl_getProcAddressARB(ctx, "glMapBuffer");
|
|
208 |
glUnmapBufferARB = (_glUnmapBufferARB) qt_gl_getProcAddressARB(ctx, "glUnmapBuffer");
|
|
209 |
|
|
210 |
return glMapBufferARB
|
|
211 |
&& glUnmapBufferARB
|
|
212 |
#if !defined(QT_OPENGL_ES_2)
|
|
213 |
&& glBindBuffer
|
|
214 |
&& glDeleteBuffers
|
|
215 |
&& glGenBuffers
|
|
216 |
&& glBufferData
|
|
217 |
#endif
|
|
218 |
;
|
|
219 |
}
|
|
220 |
|
|
221 |
bool qt_resolve_glsl_extensions(QGLContext *ctx)
|
|
222 |
{
|
|
223 |
#if defined(QT_OPENGL_ES_2)
|
|
224 |
// The GLSL shader functions are always present in OpenGL/ES 2.0.
|
|
225 |
// The only exceptions are glGetProgramBinaryOES and glProgramBinaryOES.
|
|
226 |
if (!QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved) {
|
|
227 |
glGetProgramBinaryOES = (_glGetProgramBinaryOES) ctx->getProcAddress(QLatin1String("glGetProgramBinaryOES"));
|
|
228 |
glProgramBinaryOES = (_glProgramBinaryOES) ctx->getProcAddress(QLatin1String("glProgramBinaryOES"));
|
|
229 |
QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved = true;
|
|
230 |
}
|
|
231 |
return true;
|
|
232 |
#else
|
|
233 |
if (glCreateShader)
|
|
234 |
return true;
|
|
235 |
|
|
236 |
glCreateShader = (_glCreateShader) ctx->getProcAddress(QLatin1String("glCreateShader"));
|
|
237 |
if (glCreateShader) {
|
|
238 |
glShaderSource = (_glShaderSource) ctx->getProcAddress(QLatin1String("glShaderSource"));
|
|
239 |
glShaderBinary = (_glShaderBinary) ctx->getProcAddress(QLatin1String("glShaderBinary"));
|
|
240 |
glCompileShader = (_glCompileShader) ctx->getProcAddress(QLatin1String("glCompileShader"));
|
|
241 |
glDeleteShader = (_glDeleteShader) ctx->getProcAddress(QLatin1String("glDeleteShader"));
|
|
242 |
glIsShader = (_glIsShader) ctx->getProcAddress(QLatin1String("glIsShader"));
|
|
243 |
|
|
244 |
glCreateProgram = (_glCreateProgram) ctx->getProcAddress(QLatin1String("glCreateProgram"));
|
|
245 |
glAttachShader = (_glAttachShader) ctx->getProcAddress(QLatin1String("glAttachShader"));
|
|
246 |
glDetachShader = (_glDetachShader) ctx->getProcAddress(QLatin1String("glDetachShader"));
|
|
247 |
glLinkProgram = (_glLinkProgram) ctx->getProcAddress(QLatin1String("glLinkProgram"));
|
|
248 |
glUseProgram = (_glUseProgram) ctx->getProcAddress(QLatin1String("glUseProgram"));
|
|
249 |
glDeleteProgram = (_glDeleteProgram) ctx->getProcAddress(QLatin1String("glDeleteProgram"));
|
|
250 |
glIsProgram = (_glIsProgram) ctx->getProcAddress(QLatin1String("glIsProgram"));
|
|
251 |
|
|
252 |
glGetShaderInfoLog = (_glGetShaderInfoLog) ctx->getProcAddress(QLatin1String("glGetShaderInfoLog"));
|
|
253 |
glGetShaderiv = (_glGetShaderiv) ctx->getProcAddress(QLatin1String("glGetShaderiv"));
|
|
254 |
glGetShaderSource = (_glGetShaderSource) ctx->getProcAddress(QLatin1String("glGetShaderSource"));
|
|
255 |
glGetProgramiv = (_glGetProgramiv) ctx->getProcAddress(QLatin1String("glGetProgramiv"));
|
|
256 |
glGetProgramInfoLog = (_glGetProgramInfoLog) ctx->getProcAddress(QLatin1String("glGetProgramInfoLog"));
|
|
257 |
|
|
258 |
glGetUniformLocation = (_glGetUniformLocation) ctx->getProcAddress(QLatin1String("glGetUniformLocation"));
|
|
259 |
glUniform4fv = (_glUniform4fv) ctx->getProcAddress(QLatin1String("glUniform4fv"));
|
|
260 |
glUniform3fv = (_glUniform3fv) ctx->getProcAddress(QLatin1String("glUniform3fv"));
|
|
261 |
glUniform2fv = (_glUniform2fv) ctx->getProcAddress(QLatin1String("glUniform2fv"));
|
|
262 |
glUniform1fv = (_glUniform1fv) ctx->getProcAddress(QLatin1String("glUniform1fv"));
|
|
263 |
glUniform1i = (_glUniform1i) ctx->getProcAddress(QLatin1String("glUniform1i"));
|
|
264 |
glUniform1iv = (_glUniform1iv) ctx->getProcAddress(QLatin1String("glUniform1iv"));
|
|
265 |
glUniformMatrix2fv = (_glUniformMatrix2fv) ctx->getProcAddress(QLatin1String("glUniformMatrix2fv"));
|
|
266 |
glUniformMatrix3fv = (_glUniformMatrix3fv) ctx->getProcAddress(QLatin1String("glUniformMatrix3fv"));
|
|
267 |
glUniformMatrix4fv = (_glUniformMatrix4fv) ctx->getProcAddress(QLatin1String("glUniformMatrix4fv"));
|
|
268 |
glUniformMatrix2x3fv = (_glUniformMatrix2x3fv) ctx->getProcAddress(QLatin1String("glUniformMatrix2x3fv"));
|
|
269 |
glUniformMatrix2x4fv = (_glUniformMatrix2x4fv) ctx->getProcAddress(QLatin1String("glUniformMatrix2x4fv"));
|
|
270 |
glUniformMatrix3x2fv = (_glUniformMatrix3x2fv) ctx->getProcAddress(QLatin1String("glUniformMatrix3x2fv"));
|
|
271 |
glUniformMatrix3x4fv = (_glUniformMatrix3x4fv) ctx->getProcAddress(QLatin1String("glUniformMatrix3x4fv"));
|
|
272 |
glUniformMatrix4x2fv = (_glUniformMatrix4x2fv) ctx->getProcAddress(QLatin1String("glUniformMatrix4x2fv"));
|
|
273 |
glUniformMatrix4x3fv = (_glUniformMatrix4x3fv) ctx->getProcAddress(QLatin1String("glUniformMatrix4x3fv"));
|
|
274 |
|
|
275 |
glBindAttribLocation = (_glBindAttribLocation) ctx->getProcAddress(QLatin1String("glBindAttribLocation"));
|
|
276 |
glGetAttribLocation = (_glGetAttribLocation) ctx->getProcAddress(QLatin1String("glGetAttribLocation"));
|
|
277 |
glVertexAttrib1fv = (_glVertexAttrib1fv) ctx->getProcAddress(QLatin1String("glVertexAttrib1fv"));
|
|
278 |
glVertexAttrib2fv = (_glVertexAttrib2fv) ctx->getProcAddress(QLatin1String("glVertexAttrib2fv"));
|
|
279 |
glVertexAttrib3fv = (_glVertexAttrib3fv) ctx->getProcAddress(QLatin1String("glVertexAttrib3fv"));
|
|
280 |
glVertexAttrib4fv = (_glVertexAttrib4fv) ctx->getProcAddress(QLatin1String("glVertexAttrib4fv"));
|
|
281 |
glVertexAttribPointer = (_glVertexAttribPointer) ctx->getProcAddress(QLatin1String("glVertexAttribPointer"));
|
|
282 |
glDisableVertexAttribArray = (_glDisableVertexAttribArray) ctx->getProcAddress(QLatin1String("glDisableVertexAttribArray"));
|
|
283 |
glEnableVertexAttribArray = (_glEnableVertexAttribArray) ctx->getProcAddress(QLatin1String("glEnableVertexAttribArray"));
|
|
284 |
|
|
285 |
} else {
|
|
286 |
// We may not have the standard shader functions, but we might
|
|
287 |
// have the older ARB functions instead.
|
|
288 |
glCreateShader = (_glCreateShader) ctx->getProcAddress(QLatin1String("glCreateShaderObjectARB"));
|
|
289 |
glShaderSource = (_glShaderSource) ctx->getProcAddress(QLatin1String("glShaderSourceARB"));
|
|
290 |
glShaderBinary = (_glShaderBinary) ctx->getProcAddress(QLatin1String("glShaderBinaryARB"));
|
|
291 |
glCompileShader = (_glCompileShader) ctx->getProcAddress(QLatin1String("glCompileShaderARB"));
|
|
292 |
glDeleteShader = (_glDeleteShader) ctx->getProcAddress(QLatin1String("glDeleteObjectARB"));
|
|
293 |
glIsShader = 0;
|
|
294 |
|
|
295 |
glCreateProgram = (_glCreateProgram) ctx->getProcAddress(QLatin1String("glCreateProgramObjectARB"));
|
|
296 |
glAttachShader = (_glAttachShader) ctx->getProcAddress(QLatin1String("glAttachObjectARB"));
|
|
297 |
glDetachShader = (_glDetachShader) ctx->getProcAddress(QLatin1String("glDetachObjectARB"));
|
|
298 |
glLinkProgram = (_glLinkProgram) ctx->getProcAddress(QLatin1String("glLinkProgramARB"));
|
|
299 |
glUseProgram = (_glUseProgram) ctx->getProcAddress(QLatin1String("glUseProgramObjectARB"));
|
|
300 |
glDeleteProgram = (_glDeleteProgram) ctx->getProcAddress(QLatin1String("glDeleteObjectARB"));
|
|
301 |
glIsProgram = 0;
|
|
302 |
|
|
303 |
glGetShaderInfoLog = (_glGetShaderInfoLog) ctx->getProcAddress(QLatin1String("glGetInfoLogARB"));
|
|
304 |
glGetShaderiv = (_glGetShaderiv) ctx->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
|
|
305 |
glGetShaderSource = (_glGetShaderSource) ctx->getProcAddress(QLatin1String("glGetShaderSourceARB"));
|
|
306 |
glGetProgramiv = (_glGetProgramiv) ctx->getProcAddress(QLatin1String("glGetObjectParameterivARB"));
|
|
307 |
glGetProgramInfoLog = (_glGetProgramInfoLog) ctx->getProcAddress(QLatin1String("glGetInfoLogARB"));
|
|
308 |
|
|
309 |
glGetUniformLocation = (_glGetUniformLocation) ctx->getProcAddress(QLatin1String("glGetUniformLocationARB"));
|
|
310 |
glUniform4fv = (_glUniform4fv) ctx->getProcAddress(QLatin1String("glUniform4fvARB"));
|
|
311 |
glUniform3fv = (_glUniform3fv) ctx->getProcAddress(QLatin1String("glUniform3fvARB"));
|
|
312 |
glUniform2fv = (_glUniform2fv) ctx->getProcAddress(QLatin1String("glUniform2fvARB"));
|
|
313 |
glUniform1fv = (_glUniform1fv) ctx->getProcAddress(QLatin1String("glUniform1fvARB"));
|
|
314 |
glUniform1i = (_glUniform1i) ctx->getProcAddress(QLatin1String("glUniform1iARB"));
|
|
315 |
glUniform1iv = (_glUniform1iv) ctx->getProcAddress(QLatin1String("glUniform1ivARB"));
|
|
316 |
glUniformMatrix2fv = (_glUniformMatrix2fv) ctx->getProcAddress(QLatin1String("glUniformMatrix2fvARB"));
|
|
317 |
glUniformMatrix3fv = (_glUniformMatrix3fv) ctx->getProcAddress(QLatin1String("glUniformMatrix3fvARB"));
|
|
318 |
glUniformMatrix4fv = (_glUniformMatrix4fv) ctx->getProcAddress(QLatin1String("glUniformMatrix4fvARB"));
|
|
319 |
glUniformMatrix2x3fv = (_glUniformMatrix2x3fv) ctx->getProcAddress(QLatin1String("glUniformMatrix2x3fvARB"));
|
|
320 |
glUniformMatrix2x4fv = (_glUniformMatrix2x4fv) ctx->getProcAddress(QLatin1String("glUniformMatrix2x4fvARB"));
|
|
321 |
glUniformMatrix3x2fv = (_glUniformMatrix3x2fv) ctx->getProcAddress(QLatin1String("glUniformMatrix3x2fvARB"));
|
|
322 |
glUniformMatrix3x4fv = (_glUniformMatrix3x4fv) ctx->getProcAddress(QLatin1String("glUniformMatrix3x4fvARB"));
|
|
323 |
glUniformMatrix4x2fv = (_glUniformMatrix4x2fv) ctx->getProcAddress(QLatin1String("glUniformMatrix4x2fvARB"));
|
|
324 |
glUniformMatrix4x3fv = (_glUniformMatrix4x3fv) ctx->getProcAddress(QLatin1String("glUniformMatrix4x3fvARB"));
|
|
325 |
|
|
326 |
glBindAttribLocation = (_glBindAttribLocation) ctx->getProcAddress(QLatin1String("glBindAttribLocationARB"));
|
|
327 |
glGetAttribLocation = (_glGetAttribLocation) ctx->getProcAddress(QLatin1String("glGetAttribLocationARB"));
|
|
328 |
glVertexAttrib1fv = (_glVertexAttrib1fv) ctx->getProcAddress(QLatin1String("glVertexAttrib1fvARB"));
|
|
329 |
glVertexAttrib2fv = (_glVertexAttrib2fv) ctx->getProcAddress(QLatin1String("glVertexAttrib2fvARB"));
|
|
330 |
glVertexAttrib3fv = (_glVertexAttrib3fv) ctx->getProcAddress(QLatin1String("glVertexAttrib3fvARB"));
|
|
331 |
glVertexAttrib4fv = (_glVertexAttrib4fv) ctx->getProcAddress(QLatin1String("glVertexAttrib4fvARB"));
|
|
332 |
glVertexAttribPointer = (_glVertexAttribPointer) ctx->getProcAddress(QLatin1String("glVertexAttribPointerARB"));
|
|
333 |
glDisableVertexAttribArray = (_glDisableVertexAttribArray) ctx->getProcAddress(QLatin1String("glDisableVertexAttribArrayARB"));
|
|
334 |
glEnableVertexAttribArray = (_glEnableVertexAttribArray) ctx->getProcAddress(QLatin1String("glEnableVertexAttribArrayARB"));
|
|
335 |
}
|
|
336 |
|
|
337 |
// Note: glShaderBinary(), glIsShader(), glIsProgram(), and
|
|
338 |
// glUniformMatrixNxMfv() are optional, but all other functions
|
|
339 |
// are required.
|
|
340 |
|
|
341 |
return glCreateShader &&
|
|
342 |
glShaderSource &&
|
|
343 |
glCompileShader &&
|
|
344 |
glDeleteProgram &&
|
|
345 |
glCreateProgram &&
|
|
346 |
glAttachShader &&
|
|
347 |
glDetachShader &&
|
|
348 |
glLinkProgram &&
|
|
349 |
glUseProgram &&
|
|
350 |
glDeleteProgram &&
|
|
351 |
glGetShaderInfoLog &&
|
|
352 |
glGetShaderiv &&
|
|
353 |
glGetShaderSource &&
|
|
354 |
glGetProgramiv &&
|
|
355 |
glGetProgramInfoLog &&
|
|
356 |
glGetUniformLocation &&
|
|
357 |
glUniform1fv &&
|
|
358 |
glUniform2fv &&
|
|
359 |
glUniform3fv &&
|
|
360 |
glUniform4fv &&
|
|
361 |
glUniform1i &&
|
|
362 |
glUniform1iv &&
|
|
363 |
glUniformMatrix2fv &&
|
|
364 |
glUniformMatrix3fv &&
|
|
365 |
glUniformMatrix4fv &&
|
|
366 |
glBindAttribLocation &&
|
|
367 |
glGetAttribLocation &&
|
|
368 |
glVertexAttrib1fv &&
|
|
369 |
glVertexAttrib2fv &&
|
|
370 |
glVertexAttrib3fv &&
|
|
371 |
glVertexAttrib4fv &&
|
|
372 |
glVertexAttribPointer &&
|
|
373 |
glDisableVertexAttribArray &&
|
|
374 |
glEnableVertexAttribArray;
|
|
375 |
#endif
|
|
376 |
}
|
|
377 |
|
|
378 |
#if !defined(QT_OPENGL_ES_2)
|
|
379 |
bool qt_resolve_version_2_0_functions(QGLContext *ctx)
|
|
380 |
{
|
|
381 |
bool gl2supported = true;
|
|
382 |
if (!qt_resolve_glsl_extensions(ctx))
|
|
383 |
gl2supported = false;
|
|
384 |
|
|
385 |
if (!qt_resolve_version_1_3_functions(ctx))
|
|
386 |
gl2supported = false;
|
|
387 |
|
|
388 |
if (!qt_resolve_framebufferobject_extensions(ctx))
|
|
389 |
gl2supported = false;
|
|
390 |
|
|
391 |
if (glStencilOpSeparate)
|
|
392 |
return gl2supported;
|
|
393 |
|
|
394 |
glBlendColor = (_glBlendColor) ctx->getProcAddress(QLatin1String("glBlendColor"));
|
|
395 |
glStencilOpSeparate = (_glStencilOpSeparate) ctx->getProcAddress(QLatin1String("glStencilOpSeparate"));
|
|
396 |
if (!glBlendColor || !glStencilOpSeparate)
|
|
397 |
gl2supported = false;
|
|
398 |
|
|
399 |
return gl2supported;
|
|
400 |
}
|
|
401 |
#endif
|
|
402 |
|
|
403 |
|
|
404 |
QT_END_NAMESPACE
|