From 939623b2bc8e441618ee1a1886cc656880bee62b Mon Sep 17 00:00:00 2001
From: Rhys Weatherley <rhys.weatherley@nokia.com>
Date: Tue, 7 Apr 2009 12:32:04 +1000
Subject: Make OpenGL/ES 1.1 CommonLite and OpenGL/ES 1.0 builds work

Reviewed-by: trustme
---
 src/opengl/qgl_cl_p.h               |  2 +-
 src/opengl/qglframebufferobject.cpp |  4 ++++
 src/opengl/qglpixelbuffer_egl.cpp   |  8 +++++--
 src/opengl/qpaintengine_opengl.cpp  | 44 ++++++++++++++++++-------------------
 src/opengl/qwindowsurface_gl.cpp    |  4 ++++
 5 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/src/opengl/qgl_cl_p.h b/src/opengl/qgl_cl_p.h
index e514ff5..c05a7d7 100644
--- a/src/opengl/qgl_cl_p.h
+++ b/src/opengl/qgl_cl_p.h
@@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE
 
 inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param)
 {
-    glTexParameterx(target, pname, param);
+    glTexParameterx(target, pname, FLOAT2X(param));
 }
 inline void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
 {
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 8524dfa..4ba9213 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -48,6 +48,10 @@
 #include <qlibrary.h>
 #include <qimage.h>
 
+#ifdef QT_OPENGL_ES_1_CL
+#include "qgl_cl_p.h"
+#endif
+
 QT_BEGIN_NAMESPACE
 
 extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool);
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index 964efa2..5390fd1 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -47,6 +47,10 @@
 #include <qimage.h>
 #include <private/qgl_p.h>
 
+#ifdef QT_OPENGL_ES_1_CL
+#include "qgl_cl_p.h"
+#endif
+
 QT_BEGIN_NAMESPACE
 
 #ifdef EGL_BIND_TO_TEXTURE_RGBA
@@ -188,8 +192,8 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const
         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, d->req_size.width(), d->req_size.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
     else
         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, d->req_size.width(), d->req_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     return texture;
 #else
     return 0;
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 976a021..88fd379 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -1983,7 +1983,7 @@ public:
 void QOpenGLTrapezoidToArrayTessellator::addTrap(const Trapezoid &trap)
 {
     // On OpenGL ES we convert the trap to 2 triangles
-#ifndef QT_OPENGL_ES_1
+#ifndef QT_OPENGL_ES
     if (size > allocated - 8) {
 #else
     if (size > allocated - 12) {
@@ -1994,31 +1994,31 @@ void QOpenGLTrapezoidToArrayTessellator::addTrap(const Trapezoid &trap)
 
     QGLTrapezoid t = toGLTrapezoid(trap);
 
-#ifndef QT_OPENGL_ES_1
-    vertices[size++] = t.topLeftX;
-    vertices[size++] = t.top;
-    vertices[size++] = t.topRightX;
-    vertices[size++] = t.top;
-    vertices[size++] = t.bottomRightX;
-    vertices[size++] = t.bottom;
-    vertices[size++] = t.bottomLeftX;
-    vertices[size++] = t.bottom;
+#ifndef QT_OPENGL_ES
+    vertices[size++] = f2vt(t.topLeftX);
+    vertices[size++] = f2vt(t.top);
+    vertices[size++] = f2vt(t.topRightX);
+    vertices[size++] = f2vt(t.top);
+    vertices[size++] = f2vt(t.bottomRightX);
+    vertices[size++] = f2vt(t.bottom);
+    vertices[size++] = f2vt(t.bottomLeftX);
+    vertices[size++] = f2vt(t.bottom);
 #else
     // First triangle
-    vertices[size++] = t.topLeftX;
-    vertices[size++] = t.top;
-    vertices[size++] = t.topRightX;
-    vertices[size++] = t.top;
-    vertices[size++] = t.bottomRightX;
-    vertices[size++] = t.bottom;
+    vertices[size++] = f2vt(t.topLeftX);
+    vertices[size++] = f2vt(t.top);
+    vertices[size++] = f2vt(t.topRightX);
+    vertices[size++] = f2vt(t.top);
+    vertices[size++] = f2vt(t.bottomRightX);
+    vertices[size++] = f2vt(t.bottom);
 
     // Second triangle
-    vertices[size++] = t.bottomLeftX;
-    vertices[size++] = t.bottom;
-    vertices[size++] = t.topLeftX;
-    vertices[size++] = t.top;
-    vertices[size++] = t.bottomRightX;
-    vertices[size++] = t.bottom;
+    vertices[size++] = f2vt(t.bottomLeftX);
+    vertices[size++] = f2vt(t.bottom);
+    vertices[size++] = f2vt(t.topLeftX);
+    vertices[size++] = f2vt(t.top);
+    vertices[size++] = f2vt(t.bottomRightX);
+    vertices[size++] = f2vt(t.bottom);
 #endif
 }
 
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 3dd3064..837ccf2 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -76,6 +76,10 @@
 #define GLX_SAMPLES_ARB         100001
 #endif
 
+#ifdef QT_OPENGL_ES_1_CL
+#include "qgl_cl_p.h"
+#endif
+
 QT_BEGIN_NAMESPACE
 
 //
-- 
cgit v0.12