summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgl_threads
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-02-18 13:38:50 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-02-18 13:52:32 (GMT)
commite7945c14cbfe3cae93ff92509a7eac7dfd786abe (patch)
tree08d7558ae5fe765e58a5f6eeb1a59ff11460384e /tests/auto/qgl_threads
parent16f1fd886147fd12b471d8746bb85029da2be8d0 (diff)
downloadQt-e7945c14cbfe3cae93ff92509a7eac7dfd786abe.zip
Qt-e7945c14cbfe3cae93ff92509a7eac7dfd786abe.tar.gz
Qt-e7945c14cbfe3cae93ff92509a7eac7dfd786abe.tar.bz2
Fix threaded gl autotest build failure on GLES2
Reviewed-By: Gunnar
Diffstat (limited to 'tests/auto/qgl_threads')
-rw-r--r--tests/auto/qgl_threads/tst_openglthreading.cpp24
-rw-r--r--tests/auto/qgl_threads/tst_openglthreading.pro9
2 files changed, 20 insertions, 13 deletions
diff --git a/tests/auto/qgl_threads/tst_openglthreading.cpp b/tests/auto/qgl_threads/tst_openglthreading.cpp
index 408bfc8..6634869 100644
--- a/tests/auto/qgl_threads/tst_openglthreading.cpp
+++ b/tests/auto/qgl_threads/tst_openglthreading.cpp
@@ -277,22 +277,22 @@ void tst_OpenGLThreading::textureUploadInThread()
if that works, we're in good shape..
*/
-static inline float random() { return (rand() % 100) / 100.f; }
+static inline float qrandom() { return (rand() % 100) / 100.f; }
void renderAScene(int w, int h)
{
#ifdef QT_OPENGL_ES_2
QGLShaderProgram program;
- program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec2 pos; void main() { gl_Position = position; }");
+ program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec2 pos; void main() { gl_Position = vec4(pos.xy, 1.0, 1.0); }");
program.addShaderFromSourceCode(QGLShader::Fragment, "uniform lowp vec4 color; void main() { gl_FragColor = color; }");
+ program.bindAttributeLocation("pos", 0);
program.bind();
int colorId = program.uniformLocation("color");
- program.bindAttributeLocation("pos", 0);
- glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableVertexAttribArray(0);
for (int i=0; i<1000; ++i) {
- float pos[] = {
+ GLfloat pos[] = {
(rand() % 100) / 100.,
(rand() % 100) / 100.,
(rand() % 100) / 100.,
@@ -301,7 +301,7 @@ void renderAScene(int w, int h)
(rand() % 100) / 100.
};
- glVertexAttributePointer(0, 2, GL_FLOAT, false, 0, pos);
+ glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 3);
}
#else
@@ -317,12 +317,12 @@ void renderAScene(int w, int h)
for (int i=0;i<1000; ++i) {
glBegin(GL_TRIANGLES);
- glColor3f(random(), random(), random());
- glVertex2f(random() * w, random() * h);
- glColor3f(random(), random(), random());
- glVertex2f(random() * w, random() * h);
- glColor3f(random(), random(), random());
- glVertex2f(random() * w, random() * h);
+ glColor3f(qrandom(), qrandom(), qrandom());
+ glVertex2f(qrandom() * w, qrandom() * h);
+ glColor3f(qrandom(), qrandom(), qrandom());
+ glVertex2f(qrandom() * w, qrandom() * h);
+ glColor3f(qrandom(), qrandom(), qrandom());
+ glVertex2f(qrandom() * w, qrandom() * h);
glEnd();
}
#endif
diff --git a/tests/auto/qgl_threads/tst_openglthreading.pro b/tests/auto/qgl_threads/tst_openglthreading.pro
index b60bc10..9312c05 100644
--- a/tests/auto/qgl_threads/tst_openglthreading.pro
+++ b/tests/auto/qgl_threads/tst_openglthreading.pro
@@ -1,4 +1,11 @@
+############################################################
+# Project file for autotest for file qgl.h
+############################################################
+
+load(qttest_p4)
+requires(contains(QT_CONFIG,opengl))
+QT += opengl
+
HEADERS += tst_openglthreading.h
SOURCES += tst_openglthreading.cpp
-QT += testlib opengl