The QGLShaderProgram class allows OpenGL shader programs to be linked and used. 更多...
头: | #include <QGLShaderProgram> |
qmake: | QT += opengl |
Since: | Qt 4.6 |
继承: | QObject |
该类已过时。 提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。
该类在 Qt 4.6 引入。
QGLShaderProgram (const QGLContext * context , QObject * parent = nullptr) | |
QGLShaderProgram (QObject * parent = nullptr) | |
virtual | ~QGLShaderProgram () |
bool | addShader (QGLShader * shader ) |
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 ) |
int | attributeLocation (const char * name ) const |
int | attributeLocation (const QByteArray & name ) const |
int | attributeLocation (const QString & name ) const |
bool | bind () |
void | bindAttributeLocation (const char * name , int location ) |
void | bindAttributeLocation (const QByteArray & name , int location ) |
void | bindAttributeLocation (const QString & name , int location ) |
void | disableAttributeArray (int location ) |
void | disableAttributeArray (const char * name ) |
void | enableAttributeArray (int location ) |
void | enableAttributeArray (const char * name ) |
GLenum | geometryInputType () const |
GLenum | geometryOutputType () const |
int | geometryOutputVertexCount () const |
bool | isLinked () const |
virtual bool | link () |
QString | log () const |
int | maxGeometryOutputVertices () const |
GLuint | programId () const |
void | release () |
void | removeAllShaders () |
void | removeShader (QGLShader * shader ) |
void | setAttributeArray (int location , const GLfloat * 值 , int tupleSize , int stride = 0) |
void | setAttributeArray (int location , const QVector2D * 值 , int stride = 0) |
void | setAttributeArray (int location , const QVector3D * 值 , int stride = 0) |
void | setAttributeArray (int location , const QVector4D * 值 , int stride = 0) |
void | setAttributeArray (int location , GLenum type , const void * 值 , int tupleSize , int stride = 0) |
void | setAttributeArray (const char * name , const GLfloat * 值 , int tupleSize , int stride = 0) |
void | setAttributeArray (const char * name , const QVector2D * 值 , int stride = 0) |
void | setAttributeArray (const char * name , const QVector3D * 值 , int stride = 0) |
void | setAttributeArray (const char * name , const QVector4D * 值 , int stride = 0) |
void | setAttributeArray (const char * name , GLenum type , const void * 值 , int tupleSize , int stride = 0) |
void | setAttributeBuffer (int location , GLenum type , int offset , int tupleSize , int stride = 0) |
void | setAttributeBuffer (const char * name , GLenum type , int offset , int tupleSize , int stride = 0) |
void | setAttributeValue (int location , GLfloat value ) |
void | setAttributeValue (int location , GLfloat x , GLfloat y ) |
void | setAttributeValue (int location , GLfloat x , GLfloat y , GLfloat z ) |
void | setAttributeValue (int location , GLfloat x , GLfloat y , GLfloat z , GLfloat w ) |
void | setAttributeValue (int location , const QVector2D & value ) |
void | setAttributeValue (int location , const QVector3D & value ) |
void | setAttributeValue (int location , const QVector4D & value ) |
void | setAttributeValue (int location , const QColor & value ) |
void | setAttributeValue (int location , const GLfloat * 值 , int columns , int rows ) |
void | setAttributeValue (const char * name , GLfloat value ) |
void | setAttributeValue (const char * name , GLfloat x , GLfloat y ) |
void | setAttributeValue (const char * name , GLfloat x , GLfloat y , GLfloat z ) |
void | setAttributeValue (const char * name , GLfloat x , GLfloat y , GLfloat z , GLfloat w ) |
void | setAttributeValue (const char * name , const QVector2D & value ) |
void | setAttributeValue (const char * name , const QVector3D & value ) |
void | setAttributeValue (const char * name , const QVector4D & value ) |
void | setAttributeValue (const char * name , const QColor & value ) |
void | setAttributeValue (const char * name , const GLfloat * 值 , int columns , int rows ) |
void | setGeometryInputType (GLenum inputType ) |
void | setGeometryOutputType (GLenum outputType ) |
void | setGeometryOutputVertexCount (int count ) |
void | setUniformValue (int location , GLfloat value ) |
void | setUniformValue (int location , GLint value ) |
void | setUniformValue (const char * name , const QColor & color ) |
void | setUniformValue (const char * name , const QPoint & point ) |
void | setUniformValue (const char * name , const QPointF & point ) |
void | setUniformValue (const char * name , const QSize & size ) |
void | setUniformValue (const char * name , const QSizeF & size ) |
void | setUniformValue (const char * name , const QMatrix2x2 & value ) |
void | setUniformValue (const char * name , const QMatrix2x3 & value ) |
void | setUniformValue (const char * name , const QMatrix2x4 & value ) |
void | setUniformValue (const char * name , const QMatrix3x2 & value ) |
void | setUniformValue (const char * name , const QMatrix3x3 & value ) |
void | setUniformValue (const char * name , const QMatrix3x4 & value ) |
void | setUniformValue (const char * name , const QMatrix4x2 & value ) |
void | setUniformValue (const char * name , const QMatrix4x3 & value ) |
void | setUniformValue (const char * name , const QMatrix4x4 & value ) |
void | setUniformValue (const char * name , const GLfloat [2][2] value = 2) |
void | setUniformValue (const char * name , const GLfloat [3][3] value = 3) |
void | setUniformValue (const char * name , const GLfloat [4][4] value = 4) |
void | setUniformValue (const char * name , const QTransform & value ) |
void | setUniformValue (int location , GLuint value ) |
void | setUniformValue (int location , GLfloat x , GLfloat y ) |
void | setUniformValue (int location , GLfloat x , GLfloat y , GLfloat z ) |
void | setUniformValue (int location , GLfloat x , GLfloat y , GLfloat z , GLfloat w ) |
void | setUniformValue (int location , const QVector2D & value ) |
void | setUniformValue (int location , const QVector3D & value ) |
void | setUniformValue (int location , const QVector4D & value ) |
void | setUniformValue (int location , const QColor & color ) |
void | setUniformValue (int location , const QPoint & point ) |
void | setUniformValue (int location , const QPointF & point ) |
void | setUniformValue (int location , const QSize & size ) |
void | setUniformValue (int location , const QSizeF & size ) |
void | setUniformValue (int location , const QMatrix2x2 & value ) |
void | setUniformValue (int location , const QMatrix2x3 & value ) |
void | setUniformValue (int location , const QMatrix2x4 & value ) |
void | setUniformValue (int location , const QMatrix3x2 & value ) |
void | setUniformValue (int location , const QMatrix3x3 & value ) |
void | setUniformValue (int location , const QMatrix3x4 & value ) |
void | setUniformValue (int location , const QMatrix4x2 & value ) |
void | setUniformValue (int location , const QMatrix4x3 & value ) |
void | setUniformValue (int location , const QMatrix4x4 & value ) |
void | setUniformValue (int location , const GLfloat [2][2] value = 2) |
void | setUniformValue (int location , const GLfloat [3][3] value = 3) |
void | setUniformValue (int location , const GLfloat [4][4] value = 4) |
void | setUniformValue (int location , const QTransform & value ) |
void | setUniformValue (const char * name , GLfloat value ) |
void | setUniformValue (const char * name , GLint value ) |
void | setUniformValue (const char * name , GLuint value ) |
void | setUniformValue (const char * name , GLfloat x , GLfloat y ) |
void | setUniformValue (const char * name , GLfloat x , GLfloat y , GLfloat z ) |
void | setUniformValue (const char * name , GLfloat x , GLfloat y , GLfloat z , GLfloat w ) |
void | setUniformValue (const char * name , const QVector2D & value ) |
void | setUniformValue (const char * name , const QVector3D & value ) |
void | setUniformValue (const char * name , const QVector4D & value ) |
void | setUniformValueArray (int location , const GLfloat * 值 , int count , int tupleSize ) |
void | setUniformValueArray (int location , const GLint * 值 , int count ) |
void | setUniformValueArray (int location , const GLuint * 值 , int count ) |
void | setUniformValueArray (int location , const QVector2D * 值 , int count ) |
void | setUniformValueArray (int location , const QVector3D * 值 , int count ) |
void | setUniformValueArray (int location , const QVector4D * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix2x2 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix2x3 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix2x4 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix3x2 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix3x3 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix3x4 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix4x2 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix4x3 * 值 , int count ) |
void | setUniformValueArray (int location , const QMatrix4x4 * 值 , int count ) |
void | setUniformValueArray (const char * name , const GLfloat * 值 , int count , int tupleSize ) |
void | setUniformValueArray (const char * name , const GLint * 值 , int count ) |
void | setUniformValueArray (const char * name , const GLuint * 值 , int count ) |
void | setUniformValueArray (const char * name , const QVector2D * 值 , int count ) |
void | setUniformValueArray (const char * name , const QVector3D * 值 , int count ) |
void | setUniformValueArray (const char * name , const QVector4D * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix2x2 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix2x3 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix2x4 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix3x2 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix3x3 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix3x4 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix4x2 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix4x3 * 值 , int count ) |
void | setUniformValueArray (const char * name , const QMatrix4x4 * 值 , int count ) |
QList<QGLShader *> | shaders () const |
int | uniformLocation (const char * name ) const |
int | uniformLocation (const QByteArray & name ) const |
int | uniformLocation (const QString & name ) const |
bool | hasOpenGLShaderPrograms (const QGLContext * context = nullptr) |
This class supports shader programs written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).
QGLShader and QGLShaderProgram shelter the programmer from the details of compiling and linking vertex and fragment shaders.
The following example creates a vertex shader program using the supplied source
code
. Once compiled and linked, the shader program is activated in the current
QGLContext
通过调用
QGLShaderProgram::bind
():
QGLShader shader(QGLShader::Vertex); shader.compileSourceCode(code); QGLShaderProgram program(context); program.addShader(shader); program.link(); program.bind();
Shader programs can be difficult to reuse across OpenGL implementations because of varying levels of support for standard vertex attributes and uniform variables. In particular, GLSL/ES lacks all of the standard variables that are present on desktop OpenGL systems:
gl_Vertex
,
gl_Normal
,
gl_Color
, and so on. Desktop OpenGL lacks the variable qualifiers
highp
,
mediump
,和
lowp
.
The QGLShaderProgram class makes the process of writing portable shaders easier by prefixing all shader programs with the following lines on desktop OpenGL:
#define highp #define mediump #define lowp
This makes it possible to run most GLSL/ES shader programs on desktop systems. The programmer should restrict themselves to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop.
program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec4 vertex;\n" "uniform highp mat4 matrix;\n" "void main(void)\n" "{\n" " gl_Position = matrix * vertex;\n" "}"); program.addShaderFromSourceCode(QGLShader::Fragment, "uniform mediump vec4 color;\n" "void main(void)\n" "{\n" " gl_FragColor = color;\n" "}"); program.link(); program.bind(); int vertexLocation = program.attributeLocation("vertex"); int matrixLocation = program.uniformLocation("matrix"); int colorLocation = program.uniformLocation("color");
With the above shader program active, we can draw a green triangle as follows:
static GLfloat const triangleVertices[] = { 60.0f, 10.0f, 0.0f, 110.0f, 110.0f, 0.0f, 10.0f, 110.0f, 0.0f }; QColor color(0, 255, 0, 255); QMatrix4x4 pmvMatrix; pmvMatrix.ortho(rect()); program.enableAttributeArray(vertexLocation); program.setAttributeArray(vertexLocation, triangleVertices, 3); program.setUniformValue(matrixLocation, pmvMatrix); program.setUniformValue(colorLocation, color); glDrawArrays(GL_TRIANGLES, 0, 3); program.disableAttributeArray(vertexLocation);
Binary shaders may be specified using
glShaderBinary()
on the return value from
QGLShader::shaderId
()。
QGLShader
instance containing the binary can then be added to the shader program with
addShader
() and linked in the usual fashion with
link
().
Binary programs may be specified using
glProgramBinaryOES()
on the return value from
programId
(). Then the application should call
link
(), which will notice that the program has already been specified and linked, allowing other operations to be performed on the shader program.
注意: This class has been deprecated in favor of QOpenGLShaderProgram .
另请参阅 QGLShader .
Constructs a new shader program and attaches it to parent . The program will be invalid until addShader () 被调用。
The shader program will be associated with context .
另请参阅 addShader ().
Constructs a new shader program and attaches it to parent . The program will be invalid until addShader () 被调用。
The shader program will be associated with the current QGLContext.
另请参阅 addShader ().
[虚拟]
QGLShaderProgram::
~QGLShaderProgram
()
Deletes this shader program.
Adds a compiled
shader
to this shader program. Returns
true
if the shader could be added, or false otherwise.
Ownership of the shader object remains with the caller. It will not be deleted when this QGLShaderProgram instance is deleted. This allows the caller to add the same shader to multiple shader programs.
另请参阅 addShaderFromSourceCode (), addShaderFromSourceFile (), removeShader (), link (),和 removeAllShaders ().
Compiles
source
as a shader of the specified
type
and adds it to this shader program. Returns
true
if compilation was successful, false otherwise. The compilation errors and warnings will be made available via
log
().
This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first.
另请参阅 addShader (), addShaderFromSourceFile (), removeShader (), link (), log (),和 removeAllShaders ().
这是重载函数。
Compiles
source
as a shader of the specified
type
and adds it to this shader program. Returns
true
if compilation was successful, false otherwise. The compilation errors and warnings will be made available via
log
().
This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first.
另请参阅 addShader (), addShaderFromSourceFile (), removeShader (), link (), log (),和 removeAllShaders ().
这是重载函数。
Compiles
source
as a shader of the specified
type
and adds it to this shader program. Returns
true
if compilation was successful, false otherwise. The compilation errors and warnings will be made available via
log
().
This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first.
另请参阅 addShader (), addShaderFromSourceFile (), removeShader (), link (), log (),和 removeAllShaders ().
Compiles the contents of
fileName
as a shader of the specified
type
and adds it to this shader program. Returns
true
if compilation was successful, false otherwise. The compilation errors and warnings will be made available via
log
().
This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QGLShader first.
另请参阅 addShader () 和 addShaderFromSourceCode ().
Returns the location of the attribute name within this shader program's parameter list. Returns -1 if name is not a valid attribute for this shader program.
另请参阅 uniformLocation () 和 bindAttributeLocation ().
这是重载函数。
Returns the location of the attribute name within this shader program's parameter list. Returns -1 if name is not a valid attribute for this shader program.
另请参阅 uniformLocation () 和 bindAttributeLocation ().
这是重载函数。
Returns the location of the attribute name within this shader program's parameter list. Returns -1 if name is not a valid attribute for this shader program.
另请参阅 uniformLocation () 和 bindAttributeLocation ().
Binds this shader program to the active QGLContext and makes it the current shader program. Any previously bound shader program is released. This is equivalent to calling
glUseProgram()
on
programId
()。返回
true
if the program was successfully bound; false otherwise. If the shader program has not yet been linked, or it needs to be re-linked, this function will call
link
().
Binds the attribute name 到指定 location . This function can be called before or after the program has been linked. Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically.
When this function is called after the program has been linked, the program will need to be relinked for the change to take effect.
另请参阅 attributeLocation ().
这是重载函数。
Binds the attribute name 到指定 location . This function can be called before or after the program has been linked. Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically.
When this function is called after the program has been linked, the program will need to be relinked for the change to take effect.
另请参阅 attributeLocation ().
这是重载函数。
Binds the attribute name 到指定 location . This function can be called before or after the program has been linked. Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically.
When this function is called after the program has been linked, the program will need to be relinked for the change to take effect.
另请参阅 attributeLocation ().
Disables the vertex array at location in this shader program that was enabled by a previous call to enableAttributeArray ().
另请参阅 enableAttributeArray (), setAttributeArray (), setAttributeValue (),和 setUniformValue ().
这是重载函数。
Disables the vertex array called name in this shader program that was enabled by a previous call to enableAttributeArray ().
另请参阅 enableAttributeArray (), setAttributeArray (), setAttributeValue (),和 setUniformValue ().
Enables the vertex array at location in this shader program so that the value set by setAttributeArray () 在 location will be used by the shader program.
另请参阅 disableAttributeArray (), setAttributeArray (), setAttributeValue (),和 setUniformValue ().
这是重载函数。
Enables the vertex array called name in this shader program so that the value set by setAttributeArray () 在 name will be used by the shader program.
另请参阅 disableAttributeArray (), setAttributeArray (), setAttributeValue (),和 setUniformValue ().
Returns the geometry shader input type, if active.
This parameter takes effect the next time the program is linked.
该函数在 Qt 4.7 引入。
另请参阅 setGeometryInputType ().
Returns the geometry shader output type, if active.
This parameter takes effect the next time the program is linked.
该函数在 Qt 4.7 引入。
另请参阅 setGeometryOutputType ().
Returns the maximum number of vertices the current geometry shader program will produce, if active.
This parameter takes effect the ntext time the program is linked.
该函数在 Qt 4.7 引入。
另请参阅 setGeometryOutputVertexCount ().
[static]
bool
QGLShaderProgram::
hasOpenGLShaderPrograms
(const
QGLContext
*
context
= nullptr)
返回
true
if shader programs written in the OpenGL Shading Language (GLSL) are supported on this system; false otherwise.
The
context
is used to resolve the GLSL extensions. If
context
is
nullptr
,那么
QGLContext::currentContext
() is used.
返回
true
if this shader program has been linked; false otherwise.
另请参阅 link ().
[虚拟]
bool
QGLShaderProgram::
link
()
Links together the shaders that were added to this program with
addShader
()。返回
true
if the link was successful or false otherwise. If the link failed, the error messages can be retrieved with
log
().
Subclasses can override this function to initialize attributes and uniform variables for use in specific shader programs.
If the shader program was already linked, calling this function again will force it to be re-linked.
Returns the errors and warnings that occurred during the last link () 或 addShader () with explicitly specified source code.
另请参阅 link ().
Returns the hardware limit for how many vertices a geometry shader can output.
该函数在 Qt 4.7 引入。
另请参阅 setGeometryOutputVertexCount ().
Returns the OpenGL identifier associated with this shader program.
另请参阅 QGLShader::shaderId ().
Releases the active shader program from the current QGLContext. This is equivalent to calling
glUseProgram(0)
.
另请参阅 bind ().
Removes all of the shaders that were added to this program previously. The QGLShader objects for the shaders will not be deleted if they were constructed externally. QGLShader objects that are constructed internally by QGLShaderProgram will be deleted.
另请参阅 addShader () 和 removeShader ().
移除 shader from this shader program. The object is not deleted.
The shader program must be valid in the current QGLContext.
另请参阅 addShader (), link (),和 removeAllShaders ().
Sets an array of vertex 值 on the attribute at location in this shader program. The tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on the location . Otherwise the value specified with setAttributeValue () 对于 location 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
Sets an array of 2D vertex 值 on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on the location . Otherwise the value specified with setAttributeValue () 对于 location 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
Sets an array of 3D vertex 值 on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on the location . Otherwise the value specified with setAttributeValue () 对于 location 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
Sets an array of 4D vertex 值 on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on the location . Otherwise the value specified with setAttributeValue () 对于 location 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
Sets an array of vertex 值 on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The
type
indicates the type of elements in the
值
array, usually
GL_FLOAT
,
GL_UNSIGNED_BYTE
, etc. The
tupleSize
indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray () is called on the location . Otherwise the value specified with setAttributeValue () 对于 location 会被使用。
The setAttributeBuffer () function can be used to set the attribute array to an offset within a vertex buffer.
注意: Normalization will be enabled. If this is not desired, call glVertexAttribPointer directly through QGLFunctions.
该函数在 Qt 4.7 引入。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (), disableAttributeArray (),和 setAttributeBuffer ().
这是重载函数。
Sets an array of vertex 值 on the attribute called name in this shader program. The tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on name . Otherwise the value specified with setAttributeValue () 对于 name 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
这是重载函数。
Sets an array of 2D vertex 值 on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on name . Otherwise the value specified with setAttributeValue () 对于 name 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
这是重载函数。
Sets an array of 3D vertex 值 on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on name . Otherwise the value specified with setAttributeValue () 对于 name 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
这是重载函数。
Sets an array of 4D vertex 值 on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The array will become active when enableAttributeArray () is called on name . Otherwise the value specified with setAttributeValue () 对于 name 会被使用。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (),和 disableAttributeArray ().
这是重载函数。
Sets an array of vertex 值 on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in 值 .
The
type
indicates the type of elements in the
值
array, usually
GL_FLOAT
,
GL_UNSIGNED_BYTE
, etc. The
tupleSize
indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray () is called on the name . Otherwise the value specified with setAttributeValue () 对于 name 会被使用。
The setAttributeBuffer () function can be used to set the attribute array to an offset within a vertex buffer.
该函数在 Qt 4.7 引入。
另请参阅 setAttributeValue (), setUniformValue (), enableAttributeArray (), disableAttributeArray (),和 setAttributeBuffer ().
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. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in the value array.
The
type
indicates the type of elements in the vertex value array, usually
GL_FLOAT
,
GL_UNSIGNED_BYTE
, etc. The
tupleSize
indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray () is called on the location . Otherwise the value specified with setAttributeValue () 对于 location 会被使用。
注意: Normalization will be enabled. If this is not desired, call glVertexAttribPointer directly though QGLFunctions.
该函数在 Qt 4.7 引入。
另请参阅 setAttributeArray ().
这是重载函数。
Sets an array of vertex values on the attribute called name in this shader program, starting at a specific offset in the currently bound vertex buffer. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in the value array.
The
type
indicates the type of elements in the vertex value array, usually
GL_FLOAT
,
GL_UNSIGNED_BYTE
, etc. The
tupleSize
indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray () is called on the name . Otherwise the value specified with setAttributeValue () 对于 name 会被使用。
该函数在 Qt 4.7 引入。
另请参阅 setAttributeArray ().
Sets the attribute at location in the current context to value .
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to the 2D vector ( x , y ).
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to the 3D vector ( x , y , z ).
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to the 4D vector ( x , y , z , w ).
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to value .
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to value .
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to value .
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to value .
另请参阅 setUniformValue ().
Sets the attribute at location in the current context to the contents of 值 , which contains columns elements, each consisting of rows 元素。 rows value should be 1, 2, 3, or 4. This function is typically used to set matrix values and column vectors.
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to value .
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to the 2D vector ( x , y ).
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to the 3D vector ( x , y , z ).
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to the 4D vector ( x , y , z , w ).
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to value .
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to value .
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to value .
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to value .
另请参阅 setUniformValue ().
这是重载函数。
Sets the attribute called name in the current context to the contents of 值 , which contains columns elements, each consisting of rows 元素。 rows value should be 1, 2, 3, or 4. This function is typically used to set matrix values and column vectors.
另请参阅 setUniformValue ().
Sets the input type from inputType .
This parameter takes effect the next time the program is linked.
另请参阅 geometryInputType ().
Sets the output type from the geometry shader, if active, to outputType .
This parameter takes effect the next time the program is linked.
该函数在 Qt 4.7 引入。
另请参阅 geometryOutputType ().
Sets the maximum number of vertices the current geometry shader program will produce, if active, to count .
This parameter takes effect the next time the program is linked.
该函数在 Qt 4.7 引入。
另请参阅 geometryOutputVertexCount ().
Sets the uniform variable at location in the current context to value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to the red, green, blue, and alpha components of color .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable associated with name in the current context to the x and y coordinates of point .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable associated with name in the current context to the x and y coordinates of point .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable associated with name in the current context to the width and height of the given size .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable associated with name in the current context to the width and height of the given size .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 2x2 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 2x3 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 2x4 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 3x2 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 3x3 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 3x4 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 4x2 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 4x3 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 4x4 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 2x2 matrix value . The matrix elements must be specified in column-major order.
该函数在 Qt 4.7 引入。
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 3x3 matrix value . The matrix elements must be specified in column-major order.
该函数在 Qt 4.7 引入。
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 4x4 matrix value . The matrix elements must be specified in column-major order.
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to a 3x3 transformation matrix value that is specified as a QTransform 值。
To set a
QTransform
value as a 4x4 matrix in a shader, use
setUniformValue(name, QMatrix4x4(value))
.
Sets the uniform variable at location in the current context to value . This function should be used when setting sampler values.
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the 2D vector ( x , y ).
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the 3D vector ( x , y , z ).
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the 4D vector ( x , y , z , w ).
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the red, green, blue, and alpha components of color .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the x and y coordinates of point .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the x and y coordinates of point .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the width and height of the given size .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to the width and height of the given size .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 2x2 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 2x3 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 2x4 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 3x2 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 3x3 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 3x4 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 4x2 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 4x3 matrix value .
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 4x4 matrix value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable at location in the current context to a 2x2 matrix value . The matrix elements must be specified in column-major order.
该函数在 Qt 4.7 引入。
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable at location in the current context to a 3x3 matrix value . The matrix elements must be specified in column-major order.
该函数在 Qt 4.7 引入。
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable at location in the current context to a 4x4 matrix value . The matrix elements must be specified in column-major order.
另请参阅 setAttributeValue ().
Sets the uniform variable at location in the current context to a 3x3 transformation matrix value that is specified as a QTransform 值。
To set a
QTransform
value as a 4x4 matrix in a shader, use
setUniformValue(location, QMatrix4x4(value))
.
这是重载函数。
Sets the uniform variable called name in the current context to value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to value . This function should be used when setting sampler values.
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to the 2D vector ( x , y ).
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to the 3D vector ( x , y , z ).
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to the 4D vector ( x , y , z , w ).
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to value .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable called name in the current context to value .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count elements of 值 . Each element has tupleSize components. The tupleSize must be 1, 2, 3, or 4.
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count elements of 值 . This overload should be used when setting an array of sampler values.
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 2D vector elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 3D vector elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 4D vector elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 2x2 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 2x3 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 2x4 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 3x2 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 3x3 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 3x4 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 4x2 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 4x3 matrix elements of 值 .
另请参阅 setAttributeValue ().
Sets the uniform variable array at location in the current context to the count 4x4 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count elements of 值 . Each element has tupleSize components. The tupleSize must be 1, 2, 3, or 4.
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count elements of 值 . This overload should be used when setting an array of sampler values.
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 2D vector elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 3D vector elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 4D vector elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 2x2 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 2x3 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 2x4 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 3x2 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 3x3 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 3x4 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 4x2 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 4x3 matrix elements of 值 .
另请参阅 setAttributeValue ().
这是重载函数。
Sets the uniform variable array called name in the current context to the count 4x4 matrix elements of 值 .
另请参阅 setAttributeValue ().
Returns a list of all shaders that have been added to this shader program using addShader ().
另请参阅 addShader () 和 removeShader ().
Returns the location of the uniform variable name within this shader program's parameter list. Returns -1 if name is not a valid uniform variable for this shader program.
另请参阅 attributeLocation ().
这是重载函数。
Returns the location of the uniform variable name within this shader program's parameter list. Returns -1 if name is not a valid uniform variable for this shader program.
另请参阅 attributeLocation ().
这是重载函数。
Returns the location of the uniform variable name within this shader program's parameter list. Returns -1 if name is not a valid uniform variable for this shader program.
另请参阅 attributeLocation ().