src/opengl/qwindowsurface_gl.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
--- a/src/opengl/qwindowsurface_gl.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/opengl/qwindowsurface_gl.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -82,12 +82,8 @@
 #define GLX_SAMPLES_ARB         100001
 #endif
 
-#ifdef QT_OPENGL_ES_1_CL
-#include "qgl_cl_p.h"
-#endif
-
-#ifdef QT_OPENGL_ES
-#include <private/qegl_p.h>
+#ifndef QT_NO_EGL
+#include <private/qeglcontext_p.h>
 #endif
 
 QT_BEGIN_NAMESPACE
@@ -98,8 +94,8 @@
 #ifdef Q_WS_WIN
 extern Q_GUI_EXPORT bool qt_win_owndc_required;
 #endif
-QGLGraphicsSystem::QGLGraphicsSystem()
-    : QGraphicsSystem()
+QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL)
+    : QGraphicsSystem(), m_useX11GL(useX11GL)
 {
 #if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
     // only override the system defaults if the user hasn't already
@@ -357,16 +353,9 @@
     QGLContext *ctx = new QGLContext(surfaceFormat, widget);
     ctx->create(qt_gl_share_widget()->context());
 
-#if defined(Q_WS_X11) && defined(QT_OPENGL_ES)
-    // Create the EGL surface to draw into.  QGLContext::chooseContext()
-    // does not do this for X11/EGL, but does do it for other platforms.
-    // This probably belongs in qgl_x11egl.cpp.
-    QGLContextPrivate *ctxpriv = ctx->d_func();
-    ctxpriv->eglSurface = ctxpriv->eglContext->createSurface(widget);
-    if (ctxpriv->eglSurface == EGL_NO_SURFACE) {
-        qWarning() << "hijackWindow() could not create EGL surface";
-    }
-    qDebug("QGLWindowSurface - using EGLConfig %d", reinterpret_cast<int>(ctxpriv->eglContext->config()));
+#ifndef QT_NO_EGL
+    if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED)
+        setPartialUpdateSupport(false); // Force full-screen updates
 #endif
 
     widgetPrivate->extraData()->glContext = ctx;
@@ -838,22 +827,22 @@
         src.setBottom(src.bottom() / height);
     }
 
-    const q_vertexType tx1 = f2vt(src.left());
-    const q_vertexType tx2 = f2vt(src.right());
-    const q_vertexType ty1 = f2vt(src.top());
-    const q_vertexType ty2 = f2vt(src.bottom());
+    const GLfloat tx1 = src.left();
+    const GLfloat tx2 = src.right();
+    const GLfloat ty1 = src.top();
+    const GLfloat ty2 = src.bottom();
 
-    q_vertexType texCoordArray[4*2] = {
+    GLfloat texCoordArray[4*2] = {
         tx1, ty2, tx2, ty2, tx2, ty1, tx1, ty1
     };
 
-    q_vertexType vertexArray[4*2];
-    extern void qt_add_rect_to_array(const QRectF &r, q_vertexType *array); // qpaintengine_opengl.cpp
+    GLfloat vertexArray[4*2];
+    extern void qt_add_rect_to_array(const QRectF &r, GLfloat *array); // qpaintengine_opengl.cpp
     qt_add_rect_to_array(rect, vertexArray);
 
 #if !defined(QT_OPENGL_ES_2)
-    glVertexPointer(2, q_vertexTypeEnum, 0, vertexArray);
-    glTexCoordPointer(2, q_vertexTypeEnum, 0, texCoordArray);
+    glVertexPointer(2, GL_FLOAT, 0, vertexArray);
+    glTexCoordPointer(2, GL_FLOAT, 0, texCoordArray);
 
     glBindTexture(target, tex_id);
     glEnable(target);