diff options
author | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-11-06 13:41:07 (GMT) |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2009-11-06 13:41:07 (GMT) |
commit | aa0dfd5befb7c00ceb23a67d7f1d49e165756d28 (patch) | |
tree | 520b6c2a2f3724bce25fb5f88bad19e244ffb5a4 /examples/opengl/textures/glwidget.cpp | |
parent | 654cbdb901386b2a8e168cd52446abdddec1aa28 (diff) | |
parent | 5491ab9c921c8e7b89e335c7d09219153ae1d21a (diff) | |
download | Qt-aa0dfd5befb7c00ceb23a67d7f1d49e165756d28.zip Qt-aa0dfd5befb7c00ceb23a67d7f1d49e165756d28.tar.gz Qt-aa0dfd5befb7c00ceb23a67d7f1d49e165756d28.tar.bz2 |
Merge remote branch 'qt-official/4.6' into 4.6
Diffstat (limited to 'examples/opengl/textures/glwidget.cpp')
-rw-r--r-- | examples/opengl/textures/glwidget.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/opengl/textures/glwidget.cpp b/examples/opengl/textures/glwidget.cpp index 6efd31a..0f50e2d 100644 --- a/examples/opengl/textures/glwidget.cpp +++ b/examples/opengl/textures/glwidget.cpp @@ -99,7 +99,7 @@ void GLWidget::initializeGL() #define PROGRAM_VERTEX_ATTRIBUTE 0 #define PROGRAM_TEXCOORD_ATTRIBUTE 1 - QGLShader *vshader = new QGLShader(QGLShader::VertexShader, this); + QGLShader *vshader = new QGLShader(QGLShader::Vertex, this); const char *vsrc = "attribute highp vec4 vertex;\n" "attribute mediump vec4 texCoord;\n" @@ -110,9 +110,9 @@ void GLWidget::initializeGL() " gl_Position = matrix * vertex;\n" " texc = texCoord;\n" "}\n"; - vshader->compile(vsrc); + vshader->compileSourceCode(vsrc); - QGLShader *fshader = new QGLShader(QGLShader::FragmentShader, this); + QGLShader *fshader = new QGLShader(QGLShader::Fragment, this); const char *fsrc = "uniform sampler2D texture;\n" "varying mediump vec4 texc;\n" @@ -120,7 +120,7 @@ void GLWidget::initializeGL() "{\n" " gl_FragColor = texture2D(texture, texc.st);\n" "}\n"; - fshader->compile(fsrc); + fshader->compileSourceCode(fsrc); program = new QGLShaderProgram(this); program->addShader(vshader); @@ -129,7 +129,7 @@ void GLWidget::initializeGL() program->bindAttributeLocation("texCoord", PROGRAM_TEXCOORD_ATTRIBUTE); program->link(); - program->enable(); + program->bind(); program->setUniformValue("texture", 0); #endif @@ -163,6 +163,8 @@ void GLWidget::paintGL() m.rotate(zRot / 16.0f, 0.0f, 0.0f, 1.0f); program->setUniformValue("matrix", m); + program->enableAttributeArray(PROGRAM_VERTEX_ATTRIBUTE); + program->enableAttributeArray(PROGRAM_TEXCOORD_ATTRIBUTE); program->setAttributeArray (PROGRAM_VERTEX_ATTRIBUTE, vertices.constData()); program->setAttributeArray |