5#include <QtOpenGL/QOpenGLShader>
26 "attribute highp vec4 vertex;\n"
27 "uniform highp mat4 matrix;\n"
30 " gl_Position = matrix * vertex;\n"
33 "uniform mediump vec4 color;\n"
36 " gl_FragColor = color;\n"
41int vertexLocation =
program.attributeLocation(
"vertex");
42int matrixLocation =
program.uniformLocation(
"matrix");
43int colorLocation =
program.uniformLocation(
"color");
47static GLfloat const triangleVertices[] = {
58program.enableAttributeArray(vertexLocation);
59program.setAttributeArray(vertexLocation, triangleVertices, 3);
60program.setUniformValue(matrixLocation, pmvMatrix);
63glDrawArrays(GL_TRIANGLES, 0, 3);
65program.disableAttributeArray(vertexLocation);
The QColor class provides colors based on RGB, HSV or CMYK values.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
void ortho(const QRect &rect)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used.
The QOpenGLShader class allows OpenGL shaders to be compiled.
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
typedef GLfloat(GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC)(GLuint path