45 #include <QtCore/private/qobject_p.h> 46 #include <QtCore/qdebug.h> 47 #include <QtCore/qfile.h> 48 #include <QtCore/qvarlengtharray.h> 49 #include <QtCore/qvector.h> 53 #if !defined(QT_OPENGL_ES_1) 159 #ifndef GL_FRAGMENT_SHADER 160 #define GL_FRAGMENT_SHADER 0x8B30 162 #ifndef GL_VERTEX_SHADER 163 #define GL_VERTEX_SHADER 0x8B31 165 #ifndef GL_COMPILE_STATUS 166 #define GL_COMPILE_STATUS 0x8B81 168 #ifndef GL_LINK_STATUS 169 #define GL_LINK_STATUS 0x8B82 171 #ifndef GL_INFO_LOG_LENGTH 172 #define GL_INFO_LOG_LENGTH 0x8B84 174 #ifndef GL_ACTIVE_UNIFORMS 175 #define GL_ACTIVE_UNIFORMS 0x8B86 177 #ifndef GL_ACTIVE_UNIFORM_MAX_LENGTH 178 #define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 180 #ifndef GL_ACTIVE_ATTRIBUTES 181 #define GL_ACTIVE_ATTRIBUTES 0x8B89 183 #ifndef GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 184 #define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A 186 #ifndef GL_CURRENT_VERTEX_ATTRIB 187 #define GL_CURRENT_VERTEX_ATTRIB 0x8626 189 #ifndef GL_SHADER_SOURCE_LENGTH 190 #define GL_SHADER_SOURCE_LENGTH 0x8B88 192 #ifndef GL_SHADER_BINARY_FORMATS 193 #define GL_SHADER_BINARY_FORMATS 0x8DF8 195 #ifndef GL_NUM_SHADER_BINARY_FORMATS 196 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 221 #define ctx shaderGuard.context() 245 qWarning() <<
"QGLShader: could not create shader";
267 char *logbuf =
new char [value];
273 const char *
types[] = {
280 const char *
type = types[3];
307 #define ctx d->shaderGuard.context() 346 qWarning(
"QGLShader::QGLShader: \'context\' must be the current context or sharing with it.");
368 return d->shaderType;
375 #define QGL_DEFINE_QUALIFIERS 1 385 #define QGL_REDEFINE_HIGHP 1 386 static const char redefineHighp[] =
387 "#ifndef GL_FRAGMENT_PRECISION_HIGH\n" 388 "#define highp mediump\n" 401 if (
d->shaderGuard.id()) {
405 while (source && source[headerLen] ==
'#') {
409 if (
qstrncmp(source + headerLen,
"#version", 8) != 0 &&
410 qstrncmp(source + headerLen,
"#extension", 10) != 0) {
413 while (source[headerLen] !=
'\0' && source[headerLen] !=
'\n')
415 if (source[headerLen] ==
'\n')
422 #ifdef QGL_DEFINE_QUALIFIERS 426 #ifdef QGL_REDEFINE_HIGHP 428 src.
append(redefineHighp);
432 src.
append(source + headerLen);
435 return d->compile(
this);
482 QFile file(fileName);
500 GLuint shader =
d->shaderGuard.id();
508 char *source =
new char [size];
545 return d->shaderGuard.id();
553 #define ctx programGuard.context() 560 : programGuard(context)
563 , removingShaders(false)
564 , geometryVertexCount(64)
565 , geometryInputType(0)
566 , geometryOutputType(0)
584 bool hasShader(QGLShader::ShaderType
type)
const;
589 if (programGuard.id()) {
605 #define ctx d->programGuard.context() 643 if (
d->programGuard.id() ||
d->inited)
646 const QGLContext *context =
d->programGuard.context();
649 d->programGuard.setContext(context);
657 qWarning() <<
"QGLShaderProgram: could not create shader program";
660 d->programGuard.setId(program);
663 qWarning() <<
"QGLShaderProgram: shader programs are not supported";
685 if (
d->shaders.contains(shader))
687 if (
d->programGuard.id() && shader) {
689 d->programGuard.context())) {
690 qWarning(
"QGLShaderProgram::addShader: Program and shader are not associated with same context.");
693 if (!shader->d_func()->shaderGuard.id())
695 glAttachShader(
d->programGuard.id(), shader->d_func()->shaderGuard.id());
697 d->shaders.append(shader);
725 d->log = shader->
log();
729 d->anonShaders.append(shader);
799 d->log = shader->
log();
803 d->anonShaders.append(shader);
815 if (
d->programGuard.id() && shader && shader->d_func()->shaderGuard.id()) {
817 glDetachShader(
d->programGuard.id(), shader->d_func()->shaderGuard.id());
821 d->shaders.removeAll(shader);
822 d->anonShaders.removeAll(shader);
850 d->removingShaders =
true;
852 if (
d->programGuard.id() && shader && shader->d_func()->shaderGuard.id())
853 glDetachShader(
d->programGuard.id(), shader->d_func()->shaderGuard.id());
860 d->anonShaders.clear();
862 d->removingShaders =
false;
882 GLuint program =
d->programGuard.id();
887 if (
d->shaders.isEmpty()) {
894 d->linked = (value != 0);
904 d->geometryInputType);
906 d->geometryOutputType);
908 d->geometryVertexCount);
917 d->linked = (value != 0);
922 char *logbuf =
new char [value];
928 qWarning() <<
"QGLShader::link:" <<
d->log;
930 qWarning() <<
"QGLShader::link[" << name <<
"]:" <<
d->log;
972 GLuint program =
d->programGuard.id();
975 if (!
d->linked && !
link())
979 qWarning(
"QGLShaderProgram::bind: program is not valid in the current context.");
988 #define ctx QGLContext::currentContext() 1001 qWarning(
"QGLShaderProgram::release: program is not valid in the current context.");
1003 #if defined(QT_OPENGL_ES_2) 1012 #define ctx d->programGuard.context() 1022 GLuint
id =
d->programGuard.id();
1029 if (!const_cast<QGLShaderProgram *>(
this)->
init())
1031 return d->programGuard.id();
1109 qWarning() <<
"QGLShaderProgram::attributeLocation(" << name
1110 <<
"): shader program is not linked";
1187 if (location != -1) {
1188 GLfloat
values[2] = {x, y};
1220 if (location != -1) {
1221 GLfloat
values[3] = {x, y, z};
1238 (
const char *
name, GLfloat x, GLfloat y, GLfloat z)
1250 (
int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1254 if (location != -1) {
1255 GLfloat
values[4] = {x, y, z, w};
1272 (
const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1370 if (location != -1) {
1402 (
int location,
const GLfloat *
values,
int columns,
int rows)
1406 if (rows < 1 || rows > 4) {
1407 qWarning() <<
"QGLShaderProgram::setAttributeValue: rows" << rows <<
"not supported";
1410 if (location != -1) {
1411 while (columns-- > 0) {
1441 (
const char *name,
const GLfloat *values,
int columns,
int rows)
1461 (
int location,
const GLfloat *values,
int tupleSize,
int stride)
1465 if (location != -1) {
1489 if (location != -1) {
1513 if (location != -1) {
1537 if (location != -1) {
1565 (
int location,
GLenum type,
const void *values,
int tupleSize,
int stride)
1569 if (location != -1) {
1595 (
const char *name,
const GLfloat *values,
int tupleSize,
int stride)
1699 (
const char *name,
GLenum type,
const void *values,
int tupleSize,
int stride)
1724 (
int location,
GLenum type,
int offset,
int tupleSize,
int stride)
1728 if (location != -1) {
1730 reinterpret_cast<const void *>(offset));
1759 (
const char *name,
GLenum type,
int offset,
int tupleSize,
int stride)
1844 qWarning() <<
"QGLShaderProgram::uniformLocation(" << name
1845 <<
"): shader program is not linked";
1982 if (location != -1) {
1983 GLfloat values[2] = {x, y};
2011 (
int location, GLfloat x, GLfloat y, GLfloat z)
2015 if (location != -1) {
2016 GLfloat values[3] = {x, y, z};
2033 (
const char *name, GLfloat x, GLfloat y, GLfloat z)
2045 (
int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2049 if (location != -1) {
2050 GLfloat values[4] = {x, y, z, w};
2067 (
const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
2082 glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
2111 glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
2140 glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
2169 if (location != -1) {
2170 GLfloat values[4] = {GLfloat(color.
redF()), GLfloat(color.
greenF()),
2202 if (location != -1) {
2203 GLfloat values[4] = {GLfloat(point.
x()), GLfloat(point.
y())};
2234 if (location != -1) {
2235 GLfloat values[4] = {GLfloat(point.
x()), GLfloat(point.
y())};
2266 if (location != -1) {
2267 GLfloat values[4] = {GLfloat(size.
width()), GLfloat(size.
height())};
2298 if (location != -1) {
2299 GLfloat values[4] = {GLfloat(size.
width()), GLfloat(size.
height())};
2321 #define setUniformMatrix(func,location,value,cols,rows) \ 2322 if (location == -1) \ 2324 if (sizeof(qreal) == sizeof(GLfloat)) { \ 2325 func(location, 1, GL_FALSE, \ 2326 reinterpret_cast<const GLfloat *>(value.constData())); \ 2328 GLfloat mat[cols * rows]; \ 2329 const qreal *data = value.constData(); \ 2330 for (int i = 0; i < cols * rows; ++i) \ 2332 func(location, 1, GL_FALSE, mat); \ 2334 #if !defined(QT_OPENGL_ES_2) 2335 #define setUniformGenericMatrix(func,colfunc,location,value,cols,rows) \ 2336 if (location == -1) \ 2338 if (sizeof(qreal) == sizeof(GLfloat)) { \ 2339 const GLfloat *data = reinterpret_cast<const GLfloat *> \ 2340 (value.constData()); \ 2342 func(location, 1, GL_FALSE, data); \ 2344 colfunc(location, cols, data); \ 2346 GLfloat mat[cols * rows]; \ 2347 const qreal *data = value.constData(); \ 2348 for (int i = 0; i < cols * rows; ++i) \ 2351 func(location, 1, GL_FALSE, mat); \ 2353 colfunc(location, cols, mat); \ 2356 #define setUniformGenericMatrix(func,colfunc,location,value,cols,rows) \ 2357 if (location == -1) \ 2359 if (sizeof(qreal) == sizeof(GLfloat)) { \ 2360 const GLfloat *data = reinterpret_cast<const GLfloat *> \ 2361 (value.constData()); \ 2362 colfunc(location, cols, data); \ 2364 GLfloat mat[cols * rows]; \ 2365 const qreal *data = value.constData(); \ 2366 for (int i = 0; i < cols * rows; ++i) \ 2368 colfunc(location, cols, mat); \ 2766 if (location != -1) {
2767 GLfloat mat[3][3] = {
2768 {GLfloat(value.
m11()), GLfloat(value.
m12()), GLfloat(value.
m13())},
2769 {GLfloat(value.
m21()), GLfloat(value.
m22()), GLfloat(value.
m23())},
2770 {GLfloat(value.
m31()), GLfloat(value.
m32()), GLfloat(value.
m33())}
2820 (
const char *name,
const GLint *values,
int count)
2837 glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
2853 (
const char *name,
const GLuint *values,
int count)
2869 if (location != -1) {
2872 else if (tupleSize == 2)
2874 else if (tupleSize == 3)
2876 else if (tupleSize == 4)
2879 qWarning() <<
"QGLShaderProgram::setUniformValue: size" << tupleSize <<
"not supported";
2896 (
const char *name,
const GLfloat *values,
int count,
int tupleSize)
2912 glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values));
2942 glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values));
2972 glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values));
2992 #define setUniformMatrixArray(func,location,values,count,type,cols,rows) \ 2993 if (location == -1 || count <= 0) \ 2995 if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ 2996 func(location, count, GL_FALSE, \ 2997 reinterpret_cast<const GLfloat *>(values[0].constData())); \ 2999 QVarLengthArray<GLfloat> temp(cols * rows * count); \ 3000 for (int index = 0; index < count; ++index) { \ 3001 for (int index2 = 0; index2 < (cols * rows); ++index2) { \ 3002 temp.data()[cols * rows * index + index2] = \ 3003 values[index].constData()[index2]; \ 3006 func(location, count, GL_FALSE, temp.constData()); \ 3008 #if !defined(QT_OPENGL_ES_2) 3009 #define setUniformGenericMatrixArray(func,colfunc,location,values,count,type,cols,rows) \ 3010 if (location == -1 || count <= 0) \ 3012 if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ 3013 const GLfloat *data = reinterpret_cast<const GLfloat *> \ 3014 (values[0].constData()); \ 3016 func(location, count, GL_FALSE, data); \ 3018 colfunc(location, count * cols, data); \ 3020 QVarLengthArray<GLfloat> temp(cols * rows * count); \ 3021 for (int index = 0; index < count; ++index) { \ 3022 for (int index2 = 0; index2 < (cols * rows); ++index2) { \ 3023 temp.data()[cols * rows * index + index2] = \ 3024 values[index].constData()[index2]; \ 3028 func(location, count, GL_FALSE, temp.constData()); \ 3030 colfunc(location, count * cols, temp.constData()); \ 3033 #define setUniformGenericMatrixArray(func,colfunc,location,values,count,type,cols,rows) \ 3034 if (location == -1 || count <= 0) \ 3036 if (sizeof(type) == sizeof(GLfloat) * cols * rows) { \ 3037 const GLfloat *data = reinterpret_cast<const GLfloat *> \ 3038 (values[0].constData()); \ 3039 colfunc(location, count * cols, data); \ 3041 QVarLengthArray<GLfloat> temp(cols * rows * count); \ 3042 for (int index = 0; index < count; ++index) { \ 3043 for (int index2 = 0; index2 < (cols * rows); ++index2) { \ 3044 temp.data()[cols * rows * index + index2] = \ 3045 values[index].constData()[index2]; \ 3048 colfunc(location, count * cols, temp.constData()); \ 3358 qWarning(
"QGLShaderProgram::setGeometryOutputVertexCount: count: %d higher than maximum: %d",
3362 d_func()->geometryVertexCount = count;
3376 return d_func()->geometryVertexCount;
3387 d_func()->geometryInputType = inputType;
3401 return d_func()->geometryInputType;
3415 d_func()->geometryOutputType = outputType;
3428 return d_func()->geometryOutputType;
3441 #if !defined(QT_OPENGL_ES_2) 3460 if (shader && !
d->removingShaders)
3484 if ((type & ~(Geometry | Vertex | Fragment)) || type == 0)
3491 if ((type & Geometry) && !
QByteArray((
const char *) glGetString(
GL_EXTENSIONS)).contains(
"GL_EXT_geometry_shader4"))
3499 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS 3502 (
int location, QMacCompatGLenum type,
const void *values,
int tupleSize,
int stride)
3509 (
const char *name, QMacCompatGLenum type,
const void *values,
int tupleSize,
int stride)
3516 (
int location, QMacCompatGLenum type,
int offset,
int tupleSize,
int stride)
3523 (
const char *name, QMacCompatGLenum type,
int offset,
int tupleSize,
int stride)
3577 #endif // !defined(QT_OPENGL_ES_1) GLenum geometryInputType() const
Returns the geometry shader input type, if active.
The QColor class provides colors based on RGB, HSV or CMYK values.
void bindAttributeLocation(const char *name, int location)
Binds the attribute name to the specified location.
int maxGeometryOutputVertices() const
Returns the hardware limit for how many vertices a geometry shader can output.
void setGeometryOutputType(GLenum outputType)
Sets the output type from the geometry shader, if active, to outputType.
void disableAttributeArray(int location)
Disables the vertex array at location in this shader program that was enabled by a previous call to e...
qreal alphaF() const
Returns the alpha color component of this color.
The QVector3D class represents a vector or vertex in 3D space.
const QGLContext * context() const
#define GL_COMPILE_STATUS
bool compile(QGLShader *q)
bool compileSourceCode(const char *source)
Sets the source code for this shader and compiles it.
void removeAllShaders()
Removes all of the shaders that were added to this program previously.
#define QT_END_NAMESPACE
This macro expands to.
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
void setAttributeArray(int location, const GLfloat *values, int tupleSize, int stride=0)
Sets an array of vertex values on the attribute at location in this shader program.
GLuint programId() const
Returns the OpenGL identifier associated with this shader program.
#define glGetShaderSource
qreal greenF() const
Returns the green color component of this color.
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
#define GL_GEOMETRY_INPUT_TYPE_EXT
qreal width() const
Returns the width.
The QByteArray class provides an array of bytes.
The QVector4D class represents a vector or vertex in 4D space.
virtual ~QGLShaderProgram()
Deletes this shader program.
The QPointF class defines a point in the plane using floating point precision.
qreal height() const
Returns the height.
#define setUniformMatrixArray(func, location, values, count, type, cols, rows)
#define glBindAttribLocation
#define glVertexAttribPointer
#define setUniformMatrix(func, location, value, cols, rows)
#define glVertexAttrib3fv
#define glVertexAttrib2fv
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program's parameter list...
QString log() const
Returns the errors and warnings that occurred during the last link() or addShader() with explicitly s...
bool isCompiled() const
Returns true if this shader has been compiled; false otherwise.
#define glEnableVertexAttribArray
QGLShader::ShaderType shaderType() const
Returns the type of this shader.
The QString class provides a Unicode character string.
T * qobject_cast(QObject *object)
GLuint shaderId() const
Returns the OpenGL identifier associated with this shader.
#define glVertexAttrib1fv
The QObject class is the base class of all Qt objects.
QGLSharedResourceGuard shaderGuard
The QSizeF class defines the size of a two-dimensional object using floating point precision...
#define glUniformMatrix3x2fv
QByteArray sourceCode() const
Returns the source code for this shader.
#define glGetAttribLocation
#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT
bool qt_resolve_glsl_extensions(QGLContext *ctx)
static const char qualifierDefines[]
#define glVertexAttrib4fv
qreal x() const
Returns the x-coordinate of this point.
static const QGLContext * currentContext()
Returns the current context, i.e.
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
bool addShaderFromSourceCode(QGLShader::ShaderType type, const char *source)
Compiles source as a shader of the specified type and adds it to this shader program.
static bool areSharing(const QGLContext *context1, const QGLContext *context2)
Returns true if context1 and context2 are sharing their GL resources such as textures, shader programs, etc; otherwise returns false.
void setAttributeBuffer(int location, GLenum type, int offset, int tupleSize, int stride=0)
Sets an array of vertex values on the attribute at location in this shader program, starting at a specific offset in the currently bound vertex buffer.
void setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize)
Sets the uniform variable array at location in the current context to the count elements of values...
#define glUniformMatrix3fv
QGLShaderPrivate(const QGLContext *context, QGLShader::ShaderType type)
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
void setGeometryOutputVertexCount(int count)
Sets the maximum number of vertices the current geometry shader program will produce, if active, to count.
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program's parameter list...
The QGLContext class encapsulates an OpenGL rendering context.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
QGLShaderProgram(QObject *parent=0)
Constructs a new shader program and attaches it to parent.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
#define glUniformMatrix2x3fv
QList< QGLShader * > shaders
The QGLShader class allows OpenGL shaders to be compiled.
bool hasShader(QGLShader::ShaderType type) const
#define GL_SHADER_SOURCE_LENGTH
Q_CORE_EXPORT void qWarning(const char *,...)
void removeShader(QGLShader *shader)
Removes shader from this shader program.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
The QVector2D class represents a vector or vertex in 2D space.
GLenum geometryOutputType
void release()
Releases the active shader program from the current QGLContext.
#define GL_INFO_LOG_LENGTH
#define glGetShaderInfoLog
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
#define setUniformGenericMatrixArray(func, colfunc, location, values, count, type, cols, rows)
#define glUniformMatrix2x4fv
QGLShader::ShaderType shaderType
#define GL_FRAGMENT_SHADER
#define glUniformMatrix4x2fv
#define setUniformGenericMatrix(func, colfunc, location, value, cols, rows)
const char * constData() const
Returns a pointer to the data stored in the byte array.
virtual bool link()
Links together the shaders that were added to this program with addShader().
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
static bool hasOpenGLShaders(ShaderType type, const QGLContext *context=0)
Returns true if shader programs of type type are supported on this system; false otherwise.
uint qstrlen(const char *str)
QString log() const
Returns the errors and warnings that occurred during the last compile.
#define Q_DECLARE_PUBLIC(Class)
~QGLShaderProgramPrivate()
#define glUniformMatrix3x4fv
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.
The QFile class provides an interface for reading from and writing to files.
GLenum geometryOutputType() const
Returns the geometry shader output type, if active.
QGLShader(QGLShader::ShaderType type, QObject *parent=0)
Constructs a new QGLShader object of the specified type and attaches it to parent.
#define glDisableVertexAttribArray
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
#define glUniformMatrix4fv
#define glProgramParameteriEXT
qreal redF() const
Returns the red color component of this color.
#define GL_GEOMETRY_OUTPUT_TYPE_EXT
QObject * parent() const
Returns a pointer to the parent object.
QGLShaderProgramPrivate(const QGLContext *context)
static QTestResult::TestLocation location
The QPoint class defines a point in the plane using integer precision.
QGLSharedResourceGuard programGuard
int qstrncmp(const char *str1, const char *str2, uint len)
QString objectName() const
int height() const
Returns the height.
qreal blueF() const
Returns the blue color component of this color.
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
#define glGetUniformLocation
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.
int y() const
Returns the y coordinate of this point.
bool addShader(QGLShader *shader)
Adds a compiled shader to this shader program.
qreal y() const
Returns the y-coordinate of this point.
#define GL_GEOMETRY_SHADER_EXT
#define GL_GEOMETRY_VERTICES_OUT_EXT
bool addShaderFromSourceFile(QGLShader::ShaderType type, const QString &fileName)
Compiles the contents of fileName as a shader of the specified type and adds it to this shader progra...
The QSize class defines the size of a two-dimensional object using integer point precision.
int x() const
Returns the x coordinate of this point.
void setGeometryInputType(GLenum inputType)
Sets the input type from inputType.
bool compileSourceFile(const QString &fileName)
Sets the source code for this shader to the contents of fileName and compiles it. ...
bool bind()
Binds this shader program to the active QGLContext and makes it the current shader program...
QList< QGLShader * > shaders() const
Returns a list of all shaders that have been added to this shader program using addShader().
#define glUniformMatrix4x3fv
#define glUniformMatrix2fv
int geometryOutputVertexCount() const
Returns the maximum number of vertices the current geometry shader program will produce, if active.
#define qPrintable(string)
void enableAttributeArray(int location)
Enables the vertex array at location in this shader program so that the value set by setAttributeArra...
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static QString fileName(const QString &fileUrl)
static bool hasOpenGLShaderPrograms(const QGLContext *context=0)
Returns true if shader programs written in the OpenGL Shading Language (GLSL) are supported on this s...
virtual ~QGLShader()
Deletes this shader.
bool isLinked() const
Returns true if this shader program has been linked; false otherwise.
QList< QGLShader * > anonShaders
#define glGetProgramInfoLog
The QList class is a template class that provides lists.