1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the demonstration applications of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** 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 are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
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 | glCreateShaderObjectARB
|
---|
51 | glShaderSourceARB
|
---|
52 | glCompileShaderARB
|
---|
53 | glGetObjectParameterivARB
|
---|
54 | glDeleteObjectARB
|
---|
55 | glGetInfoLogARB
|
---|
56 | glCreateProgramObjectARB
|
---|
57 | glAttachObjectARB
|
---|
58 | glDetachObjectARB
|
---|
59 | glLinkProgramARB
|
---|
60 | glUseProgramObjectARB
|
---|
61 | glGetUniformLocationARB
|
---|
62 | glUniform1iARB
|
---|
63 | glUniform1fARB
|
---|
64 | glUniform4fARB
|
---|
65 | glUniformMatrix4fvARB
|
---|
66 |
|
---|
67 | glGenFramebuffersEXT
|
---|
68 | glGenRenderbuffersEXT
|
---|
69 | glBindRenderbufferEXT
|
---|
70 | glRenderbufferStorageEXT
|
---|
71 | glDeleteFramebuffersEXT
|
---|
72 | glDeleteRenderbuffersEXT
|
---|
73 | glBindFramebufferEXT
|
---|
74 | glFramebufferTexture2DEXT
|
---|
75 | glFramebufferRenderbufferEXT
|
---|
76 | glCheckFramebufferStatusEXT
|
---|
77 |
|
---|
78 | glActiveTexture
|
---|
79 | glTexImage3D
|
---|
80 |
|
---|
81 | glGenBuffers
|
---|
82 | glBindBuffer
|
---|
83 | glBufferData
|
---|
84 | glDeleteBuffers
|
---|
85 | glMapBuffer
|
---|
86 | glUnmapBuffer
|
---|
87 | */
|
---|
88 |
|
---|
89 | #ifndef Q_WS_MAC
|
---|
90 | # ifndef APIENTRYP
|
---|
91 | # ifdef APIENTRY
|
---|
92 | # define APIENTRYP APIENTRY *
|
---|
93 | # else
|
---|
94 | # define APIENTRY
|
---|
95 | # define APIENTRYP *
|
---|
96 | # endif
|
---|
97 | # endif
|
---|
98 | #else
|
---|
99 | # define APIENTRY
|
---|
100 | # define APIENTRYP *
|
---|
101 | #endif
|
---|
102 |
|
---|
103 | #ifndef GL_VERSION_1_2
|
---|
104 | #define GL_TEXTURE_3D 0x806F
|
---|
105 | #define GL_TEXTURE_WRAP_R 0x8072
|
---|
106 | #define GL_CLAMP_TO_EDGE 0x812F
|
---|
107 | #define GL_BGRA 0x80E1
|
---|
108 | #endif
|
---|
109 |
|
---|
110 | #ifndef GL_VERSION_1_3
|
---|
111 | #define GL_TEXTURE0 0x84C0
|
---|
112 | #define GL_TEXTURE1 0x84C1
|
---|
113 | #define GL_TEXTURE2 0x84C2
|
---|
114 | #define GL_TEXTURE_CUBE_MAP 0x8513
|
---|
115 | #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
---|
116 | //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
|
---|
117 | //#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
|
---|
118 | //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
|
---|
119 | //#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
---|
120 | //#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
---|
121 | #endif
|
---|
122 |
|
---|
123 | #ifndef GL_VERSION_1_5
|
---|
124 | typedef ptrdiff_t GLsizeiptr;
|
---|
125 | #define GL_ARRAY_BUFFER 0x8892
|
---|
126 | #define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
---|
127 | #define GL_READ_WRITE 0x88BA
|
---|
128 | #define GL_STATIC_DRAW 0x88E4
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | #ifndef GL_EXT_framebuffer_object
|
---|
132 | #define GL_RENDERBUFFER_EXT 0x8D41
|
---|
133 | #define GL_FRAMEBUFFER_EXT 0x8D40
|
---|
134 | #define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
|
---|
135 | #define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
|
---|
136 | #define GL_DEPTH_ATTACHMENT_EXT 0x8D00
|
---|
137 | #endif
|
---|
138 |
|
---|
139 | #ifndef GL_ARB_vertex_shader
|
---|
140 | #define GL_VERTEX_SHADER_ARB 0x8B31
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | #ifndef GL_ARB_fragment_shader
|
---|
144 | #define GL_FRAGMENT_SHADER_ARB 0x8B30
|
---|
145 | #endif
|
---|
146 |
|
---|
147 | #ifndef GL_ARB_shader_objects
|
---|
148 | typedef char GLcharARB;
|
---|
149 | typedef unsigned int GLhandleARB;
|
---|
150 | #define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
|
---|
151 | #define GL_OBJECT_LINK_STATUS_ARB 0x8B82
|
---|
152 | #define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
|
---|
153 | #endif
|
---|
154 |
|
---|
155 | typedef GLhandleARB (APIENTRY *_glCreateShaderObjectARB) (GLenum);
|
---|
156 | typedef void (APIENTRY *_glShaderSourceARB) (GLhandleARB, GLuint, const GLcharARB**, GLint *);
|
---|
157 | typedef void (APIENTRY *_glCompileShaderARB) (GLhandleARB);
|
---|
158 | typedef void (APIENTRY *_glGetObjectParameterivARB) (GLhandleARB, GLenum, int *);
|
---|
159 | typedef void (APIENTRY *_glDeleteObjectARB) (GLhandleARB);
|
---|
160 | typedef void (APIENTRY *_glGetInfoLogARB) (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
|
---|
161 | typedef GLhandleARB (APIENTRY *_glCreateProgramObjectARB) ();
|
---|
162 | typedef void (APIENTRY *_glAttachObjectARB) (GLhandleARB, GLhandleARB);
|
---|
163 | typedef void (APIENTRY *_glDetachObjectARB) (GLhandleARB, GLhandleARB);
|
---|
164 | typedef void (APIENTRY *_glLinkProgramARB) (GLhandleARB);
|
---|
165 | typedef void (APIENTRY *_glUseProgramObjectARB) (GLhandleARB);
|
---|
166 | typedef GLint (APIENTRY *_glGetUniformLocationARB) (GLhandleARB, const GLcharARB *);
|
---|
167 | typedef void (APIENTRY *_glUniform1iARB) (GLint, GLint);
|
---|
168 | typedef void (APIENTRY *_glUniform1fARB) (GLint, GLfloat);
|
---|
169 | typedef void (APIENTRY *_glUniform4fARB) (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
|
---|
170 | typedef void (APIENTRY *_glUniformMatrix4fvARB) (GLint, GLuint, GLboolean, const GLfloat *);
|
---|
171 |
|
---|
172 | typedef void (APIENTRY *_glGenFramebuffersEXT) (GLsizei, GLuint *);
|
---|
173 | typedef void (APIENTRY *_glGenRenderbuffersEXT) (GLsizei, GLuint *);
|
---|
174 | typedef void (APIENTRY *_glBindRenderbufferEXT) (GLenum, GLuint);
|
---|
175 | typedef void (APIENTRY *_glRenderbufferStorageEXT) (GLenum, GLenum, GLsizei, GLsizei);
|
---|
176 | typedef void (APIENTRY *_glDeleteFramebuffersEXT) (GLsizei, const GLuint*);
|
---|
177 | typedef void (APIENTRY *_glDeleteRenderbuffersEXT) (GLsizei, const GLuint*);
|
---|
178 | typedef void (APIENTRY *_glBindFramebufferEXT) (GLenum, GLuint);
|
---|
179 | typedef void (APIENTRY *_glFramebufferTexture2DEXT) (GLenum, GLenum, GLenum, GLuint, GLint);
|
---|
180 | typedef void (APIENTRY *_glFramebufferRenderbufferEXT) (GLenum, GLenum, GLenum, GLuint);
|
---|
181 | typedef GLenum (APIENTRY *_glCheckFramebufferStatusEXT) (GLenum);
|
---|
182 |
|
---|
183 | typedef void (APIENTRY *_glActiveTexture) (GLenum);
|
---|
184 | typedef void (APIENTRY *_glTexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
---|
185 |
|
---|
186 | typedef void (APIENTRY *_glGenBuffers) (GLsizei, GLuint *);
|
---|
187 | typedef void (APIENTRY *_glBindBuffer) (GLenum, GLuint);
|
---|
188 | typedef void (APIENTRY *_glBufferData) (GLenum, GLsizeiptr, const GLvoid *, GLenum);
|
---|
189 | typedef void (APIENTRY *_glDeleteBuffers) (GLsizei, const GLuint *);
|
---|
190 | typedef void *(APIENTRY *_glMapBuffer) (GLenum, GLenum);
|
---|
191 | typedef GLboolean (APIENTRY *_glUnmapBuffer) (GLenum);
|
---|
192 |
|
---|
193 | struct GLExtensionFunctions
|
---|
194 | {
|
---|
195 | bool resolve(const QGLContext *context);
|
---|
196 |
|
---|
197 | bool glslSupported();
|
---|
198 | bool fboSupported();
|
---|
|
---|