summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglshaderprogram.h
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-11-05 00:25:12 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-11-05 06:46:05 (GMT)
commitb91f1a2f749586014e8b28c6766015ff6ba62ee7 (patch)
treeb7c4eebcd52754645f463b363a425ce163f643a9 /src/opengl/qglshaderprogram.h
parent23572588c4b0c759c14a6c1687e5bd86461e31e8 (diff)
downloadQt-b91f1a2f749586014e8b28c6766015ff6ba62ee7.zip
Qt-b91f1a2f749586014e8b28c6766015ff6ba62ee7.tar.gz
Qt-b91f1a2f749586014e8b28c6766015ff6ba62ee7.tar.bz2
Modify QGLShader and QGLShaderProgram in response to API review
Reviewed-by: Sarah Smith
Diffstat (limited to 'src/opengl/qglshaderprogram.h')
-rw-r--r--src/opengl/qglshaderprogram.h43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index 49c3364..deeaee2 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -63,25 +63,23 @@ class Q_OPENGL_EXPORT QGLShader : public QObject
{
Q_OBJECT
public:
- enum ShaderTypeBits
+ enum ShaderTypeBit
{
- VertexShader = 0x0001,
- FragmentShader = 0x0002
+ Vertex = 0x0001,
+ Fragment = 0x0002
};
- Q_DECLARE_FLAGS(ShaderType, ShaderTypeBits)
+ Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit)
explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0);
- QGLShader(const QString& fileName, QGLShader::ShaderType type, QObject *parent = 0);
QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0);
- QGLShader(const QString& fileName, QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0);
virtual ~QGLShader();
QGLShader::ShaderType shaderType() const;
- bool compile(const char *source);
- bool compile(const QByteArray& source);
- bool compile(const QString& source);
- bool compileFile(const QString& fileName);
+ bool compileSourceCode(const char *source);
+ bool compileSourceCode(const QByteArray& source);
+ bool compileSourceCode(const QString& source);
+ bool compileSourceFile(const QString& fileName);
QByteArray sourceCode() const;
@@ -114,10 +112,10 @@ public:
void removeShader(QGLShader *shader);
QList<QGLShader *> shaders() const;
- bool addShader(QGLShader::ShaderType type, const char *source);
- bool addShader(QGLShader::ShaderType type, const QByteArray& source);
- bool addShader(QGLShader::ShaderType type, const QString& source);
- bool addShaderFromFile(QGLShader::ShaderType type, const QString& fileName);
+ bool addShaderFromSourceCode(QGLShader::ShaderType type, const char *source);
+ bool addShaderFromSourceCode(QGLShader::ShaderType type, const QByteArray& source);
+ bool addShaderFromSourceCode(QGLShader::ShaderType type, const QString& source);
+ bool addShaderFromSourceFile(QGLShader::ShaderType type, const QString& fileName);
void removeAllShaders();
@@ -125,8 +123,8 @@ public:
bool isLinked() const;
QString log() const;
- bool enable();
- static void disable();
+ bool bind();
+ void release();
GLuint programId() const;
@@ -159,7 +157,7 @@ public:
void setAttributeValue(const char *name, const GLfloat *values, int columns, int rows);
void setAttributeArray
- (int location, const GLfloat *values, int size, int stride = 0);
+ (int location, const GLfloat *values, int tupleSize, int stride = 0);
void setAttributeArray
(int location, const QVector2D *values, int stride = 0);
void setAttributeArray
@@ -167,13 +165,16 @@ public:
void setAttributeArray
(int location, const QVector4D *values, int stride = 0);
void setAttributeArray
- (const char *name, const GLfloat *values, int size, int stride = 0);
+ (const char *name, const GLfloat *values, int tupleSize, int stride = 0);
void setAttributeArray
(const char *name, const QVector2D *values, int stride = 0);
void setAttributeArray
(const char *name, const QVector3D *values, int stride = 0);
void setAttributeArray
(const char *name, const QVector4D *values, int stride = 0);
+
+ void enableAttributeArray(int location);
+ void enableAttributeArray(const char *name);
void disableAttributeArray(int location);
void disableAttributeArray(const char *name);
@@ -244,7 +245,7 @@ public:
void setUniformValue(const char *name, const GLfloat value[4][4]);
void setUniformValue(const char *name, const QTransform& value);
- void setUniformValueArray(int location, const GLfloat *values, int count, int size);
+ void setUniformValueArray(int location, const GLfloat *values, int count, int tupleSize);
void setUniformValueArray(int location, const GLint *values, int count);
void setUniformValueArray(int location, const GLuint *values, int count);
void setUniformValueArray(int location, const QVector2D *values, int count);
@@ -260,7 +261,7 @@ public:
void setUniformValueArray(int location, const QMatrix4x3 *values, int count);
void setUniformValueArray(int location, const QMatrix4x4 *values, int count);
- void setUniformValueArray(const char *name, const GLfloat *values, int count, int size);
+ void setUniformValueArray(const char *name, const GLfloat *values, int count, int tupleSize);
void setUniformValueArray(const char *name, const GLint *values, int count);
void setUniformValueArray(const char *name, const GLuint *values, int count);
void setUniformValueArray(const char *name, const QVector2D *values, int count);
@@ -276,7 +277,7 @@ public:
void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count);
void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count);
- static bool hasShaderPrograms(const QGLContext *context = 0);
+ static bool hasOpenGLShaderPrograms(const QGLContext *context = 0);
private Q_SLOTS:
void shaderDestroyed();