42 #ifndef QGLSHADERPROGRAM_H 43 #define QGLSHADERPROGRAM_H 45 #include <QtOpenGL/qgl.h> 46 #include <QtGui/qvector2d.h> 47 #include <QtGui/qvector3d.h> 48 #include <QtGui/qvector4d.h> 49 #include <QtGui/qmatrix4x4.h> 57 #if !defined(QT_OPENGL_ES_1) 78 QGLShader::ShaderType shaderType()
const;
80 bool compileSourceCode(
const char *source);
81 bool compileSourceCode(
const QByteArray& source);
82 bool compileSourceCode(
const QString& source);
87 bool isCompiled()
const;
90 GLuint shaderId()
const;
92 static bool hasOpenGLShaders(ShaderType
type,
const QGLContext *context = 0);
106 #ifndef GL_EXT_geometry_shader4 107 # define GL_LINES_ADJACENCY_EXT 0xA 108 # define GL_LINE_STRIP_ADJACENCY_EXT 0xB 109 # define GL_TRIANGLES_ADJACENCY_EXT 0xC 110 # define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0xD 126 bool addShaderFromSourceCode(QGLShader::ShaderType
type,
const char *source);
127 bool addShaderFromSourceCode(QGLShader::ShaderType type,
const QByteArray& source);
128 bool addShaderFromSourceCode(QGLShader::ShaderType type,
const QString& source);
129 bool addShaderFromSourceFile(QGLShader::ShaderType type,
const QString&
fileName);
131 void removeAllShaders();
134 bool isLinked()
const;
140 GLuint programId()
const;
142 int maxGeometryOutputVertices()
const;
144 void setGeometryOutputVertexCount(
int count);
145 int geometryOutputVertexCount()
const;
147 void setGeometryInputType(
GLenum inputType);
148 GLenum geometryInputType()
const;
150 void setGeometryOutputType(
GLenum outputType);
151 GLenum geometryOutputType()
const;
153 void bindAttributeLocation(
const char *
name,
int location);
154 void bindAttributeLocation(
const QByteArray& name,
int location);
155 void bindAttributeLocation(
const QString& name,
int location);
157 int attributeLocation(
const char *name)
const;
158 int attributeLocation(
const QByteArray& name)
const;
159 int attributeLocation(
const QString& name)
const;
164 void setAttributeValue(
int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
174 void setAttributeValue(
const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
179 void setAttributeValue(
const char *name,
const GLfloat *values,
int columns,
int rows);
181 void setAttributeArray
182 (
int location,
const GLfloat *values,
int tupleSize,
int stride = 0);
183 void setAttributeArray
184 (
int location,
const QVector2D *values,
int stride = 0);
185 void setAttributeArray
186 (
int location,
const QVector3D *values,
int stride = 0);
187 void setAttributeArray
188 (
int location,
const QVector4D *values,
int stride = 0);
189 void setAttributeArray
190 (
int location,
GLenum type,
const void *values,
int tupleSize,
int stride = 0);
191 void setAttributeArray
192 (
const char *name,
const GLfloat *values,
int tupleSize,
int stride = 0);
193 void setAttributeArray
194 (
const char *name,
const QVector2D *values,
int stride = 0);
195 void setAttributeArray
196 (
const char *name,
const QVector3D *values,
int stride = 0);
197 void setAttributeArray
198 (
const char *name,
const QVector4D *values,
int stride = 0);
199 void setAttributeArray
200 (
const char *name,
GLenum type,
const void *values,
int tupleSize,
int stride = 0);
202 void setAttributeBuffer
203 (
int location,
GLenum type,
int offset,
int tupleSize,
int stride = 0);
204 void setAttributeBuffer
205 (
const char *name,
GLenum type,
int offset,
int tupleSize,
int stride = 0);
207 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS 208 void setAttributeArray
209 (
int location, QMacCompatGLenum type,
const void *values,
int tupleSize,
int stride = 0);
210 void setAttributeArray
211 (
const char *name, QMacCompatGLenum type,
const void *values,
int tupleSize,
int stride = 0);
212 void setAttributeBuffer
213 (
int location, QMacCompatGLenum type,
int offset,
int tupleSize,
int stride = 0);
214 void setAttributeBuffer
215 (
const char *name, QMacCompatGLenum type,
int offset,
int tupleSize,
int stride = 0);
218 void enableAttributeArray(
int location);
219 void enableAttributeArray(
const char *name);
220 void disableAttributeArray(
int location);
221 void disableAttributeArray(
const char *name);
223 int uniformLocation(
const char *name)
const;
224 int uniformLocation(
const QByteArray& name)
const;
225 int uniformLocation(
const QString& name)
const;
227 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS 228 void setUniformValue(
int location, QMacCompatGLint value);
229 void setUniformValue(
int location, QMacCompatGLuint value);
230 void setUniformValue(
const char *name, QMacCompatGLint value);
231 void setUniformValue(
const char *name, QMacCompatGLuint value);
232 void setUniformValueArray(
int location,
const QMacCompatGLint *values,
int count);
233 void setUniformValueArray(
int location,
const QMacCompatGLuint *values,
int count);
234 void setUniformValueArray(
const char *name,
const QMacCompatGLint *values,
int count);
235 void setUniformValueArray(
const char *name,
const QMacCompatGLuint *values,
int count);
238 void setUniformValue(
int location, GLfloat value);
239 void setUniformValue(
int location,
GLint value);
240 void setUniformValue(
int location, GLuint value);
241 void setUniformValue(
int location, GLfloat x, GLfloat y);
242 void setUniformValue(
int location, GLfloat x, GLfloat y, GLfloat z);
243 void setUniformValue(
int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
244 void setUniformValue(
int location,
const QVector2D& value);
245 void setUniformValue(
int location,
const QVector3D& value);
246 void setUniformValue(
int location,
const QVector4D& value);
247 void setUniformValue(
int location,
const QColor& color);
248 void setUniformValue(
int location,
const QPoint& point);
249 void setUniformValue(
int location,
const QPointF& point);
250 void setUniformValue(
int location,
const QSize& size);
251 void setUniformValue(
int location,
const QSizeF& size);
252 void setUniformValue(
int location,
const QMatrix2x2& value);
253 void setUniformValue(
int location,
const QMatrix2x3& value);
254 void setUniformValue(
int location,
const QMatrix2x4& value);
255 void setUniformValue(
int location,
const QMatrix3x2& value);
256 void setUniformValue(
int location,
const QMatrix3x3& value);
257 void setUniformValue(
int location,
const QMatrix3x4& value);
258 void setUniformValue(
int location,
const QMatrix4x2& value);
259 void setUniformValue(
int location,
const QMatrix4x3& value);
260 void setUniformValue(
int location,
const QMatrix4x4& value);
261 void setUniformValue(
int location,
const GLfloat value[2][2]);
262 void setUniformValue(
int location,
const GLfloat value[3][3]);
263 void setUniformValue(
int location,
const GLfloat value[4][4]);
264 void setUniformValue(
int location,
const QTransform& value);
266 void setUniformValue(
const char *name, GLfloat value);
267 void setUniformValue(
const char *name,
GLint value);
268 void setUniformValue(
const char *name, GLuint value);
269 void setUniformValue(
const char *name, GLfloat x, GLfloat y);
270 void setUniformValue(
const char *name, GLfloat x, GLfloat y, GLfloat z);
271 void setUniformValue(
const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
272 void setUniformValue(
const char *name,
const QVector2D& value);
273 void setUniformValue(
const char *name,
const QVector3D& value);
274 void setUniformValue(
const char *name,
const QVector4D& value);
275 void setUniformValue(
const char *name,
const QColor& color);
276 void setUniformValue(
const char *name,
const QPoint& point);
277 void setUniformValue(
const char *name,
const QPointF& point);
278 void setUniformValue(
const char *name,
const QSize& size);
279 void setUniformValue(
const char *name,
const QSizeF& size);
280 void setUniformValue(
const char *name,
const QMatrix2x2& value);
281 void setUniformValue(
const char *name,
const QMatrix2x3& value);
282 void setUniformValue(
const char *name,
const QMatrix2x4& value);
283 void setUniformValue(
const char *name,
const QMatrix3x2& value);
284 void setUniformValue(
const char *name,
const QMatrix3x3& value);
285 void setUniformValue(
const char *name,
const QMatrix3x4& value);
286 void setUniformValue(
const char *name,
const QMatrix4x2& value);
287 void setUniformValue(
const char *name,
const QMatrix4x3& value);
288 void setUniformValue(
const char *name,
const QMatrix4x4& value);
289 void setUniformValue(
const char *name,
const GLfloat value[2][2]);
290 void setUniformValue(
const char *name,
const GLfloat value[3][3]);
291 void setUniformValue(
const char *name,
const GLfloat value[4][4]);
292 void setUniformValue(
const char *name,
const QTransform& value);
294 void setUniformValueArray(
int location,
const GLfloat *values,
int count,
int tupleSize);
295 void setUniformValueArray(
int location,
const GLint *values,
int count);
296 void setUniformValueArray(
int location,
const GLuint *values,
int count);
297 void setUniformValueArray(
int location,
const QVector2D *values,
int count);
298 void setUniformValueArray(
int location,
const QVector3D *values,
int count);
299 void setUniformValueArray(
int location,
const QVector4D *values,
int count);
300 void setUniformValueArray(
int location,
const QMatrix2x2 *values,
int count);
301 void setUniformValueArray(
int location,
const QMatrix2x3 *values,
int count);
302 void setUniformValueArray(
int location,
const QMatrix2x4 *values,
int count);
303 void setUniformValueArray(
int location,
const QMatrix3x2 *values,
int count);
304 void setUniformValueArray(
int location,
const QMatrix3x3 *values,
int count);
305 void setUniformValueArray(
int location,
const QMatrix3x4 *values,
int count);
306 void setUniformValueArray(
int location,
const QMatrix4x2 *values,
int count);
307 void setUniformValueArray(
int location,
const QMatrix4x3 *values,
int count);
308 void setUniformValueArray(
int location,
const QMatrix4x4 *values,
int count);
310 void setUniformValueArray(
const char *name,
const GLfloat *values,
int count,
int tupleSize);
311 void setUniformValueArray(
const char *name,
const GLint *values,
int count);
312 void setUniformValueArray(
const char *name,
const GLuint *values,
int count);
313 void setUniformValueArray(
const char *name,
const QVector2D *values,
int count);
314 void setUniformValueArray(
const char *name,
const QVector3D *values,
int count);
315 void setUniformValueArray(
const char *name,
const QVector4D *values,
int count);
316 void setUniformValueArray(
const char *name,
const QMatrix2x2 *values,
int count);
317 void setUniformValueArray(
const char *name,
const QMatrix2x3 *values,
int count);
318 void setUniformValueArray(
const char *name,
const QMatrix2x4 *values,
int count);
319 void setUniformValueArray(
const char *name,
const QMatrix3x2 *values,
int count);
320 void setUniformValueArray(
const char *name,
const QMatrix3x3 *values,
int count);
321 void setUniformValueArray(
const char *name,
const QMatrix3x4 *values,
int count);
322 void setUniformValueArray(
const char *name,
const QMatrix4x2 *values,
int count);
323 void setUniformValueArray(
const char *name,
const QMatrix4x3 *values,
int count);
324 void setUniformValueArray(
const char *name,
const QMatrix4x4 *values,
int count);
326 static bool hasOpenGLShaderPrograms(
const QGLContext *context = 0);
329 void shaderDestroyed();
The QColor class provides colors based on RGB, HSV or CMYK values.
The QVector3D class represents a vector or vertex in 3D space.
#define QT_END_NAMESPACE
This macro expands to.
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
The QByteArray class provides an array of bytes.
The QVector4D class represents a vector or vertex in 4D space.
The QPointF class defines a point in the plane using floating point precision.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
The QGLContext class encapsulates an OpenGL rendering context.
The QGLShader class allows OpenGL shaders to be compiled.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
The QVector2D class represents a vector or vertex in 2D space.
static OSStatus setAttributeValue(EventRef event, const QList< QAElement > &elements)
static QTestResult::TestLocation location
The QPoint class defines a point in the plane using integer precision.
The QSize class defines the size of a two-dimensional object using integer point precision.
#define Q_DECLARE_PRIVATE(Class)
ShaderTypeBit
This enum specifies the type of QGLShader that is being created.
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
static QString fileName(const QString &fileUrl)
The QList class is a template class that provides lists.