Get declarative running on new gui/opengl stack.
authorSamuel Rødal <samuel.rodal@nokia.com>
Thu, 25 Aug 2011 11:40:12 +0000 (13:40 +0200)
committerSamuel Rødal <samuel.rodal@nokia.com>
Mon, 29 Aug 2011 08:25:51 +0000 (10:25 +0200)
Rename QGuiGLContext -> QOpenGLContext, QGL* -> QOpenGL*, etc.

Change-Id: I08379029d756e28b20ae141ca30ed801626b513d
Reviewed-on: http://codereview.qt.nokia.com/3711
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
44 files changed:
src/declarative/declarative.pro
src/declarative/items/context2d/qsgcontext2d.cpp
src/declarative/items/qsgcanvas.cpp
src/declarative/items/qsgcanvas.h
src/declarative/items/qsgcanvas_p.h
src/declarative/items/qsgpainteditem.cpp
src/declarative/items/qsgshadereffect.cpp
src/declarative/items/qsgshadereffectmesh_p.h
src/declarative/items/qsgshadereffectnode.cpp
src/declarative/items/qsgshadereffectsource.cpp
src/declarative/items/qsgshadereffectsource_p.h
src/declarative/items/qsgspriteengine.cpp
src/declarative/items/qsgtextnode_p.h
src/declarative/particles/qsgimageparticle.cpp
src/declarative/scenegraph/coreapi/qsggeometry.h
src/declarative/scenegraph/coreapi/qsgmaterial.cpp
src/declarative/scenegraph/coreapi/qsgmaterial.h
src/declarative/scenegraph/coreapi/qsgrenderer.cpp
src/declarative/scenegraph/coreapi/qsgrenderer_p.h
src/declarative/scenegraph/qsgadaptationlayer_p.h
src/declarative/scenegraph/qsgcontext.cpp
src/declarative/scenegraph/qsgcontext_p.h
src/declarative/scenegraph/qsgdefaultglyphnode.cpp
src/declarative/scenegraph/qsgdefaultglyphnode_p.cpp
src/declarative/scenegraph/qsgdefaultglyphnode_p_p.h
src/declarative/scenegraph/qsgdefaultimagenode.cpp
src/declarative/scenegraph/qsgdistancefieldglyphcache.cpp
src/declarative/scenegraph/qsgdistancefieldglyphcache_p.h
src/declarative/scenegraph/qsgdistancefieldglyphnode_p.cpp
src/declarative/scenegraph/qsgpathsimplifier.cpp
src/declarative/scenegraph/scenegraph.pri
src/declarative/scenegraph/util/qsgflatcolormaterial.cpp
src/declarative/scenegraph/util/qsgflatcolormaterial.h
src/declarative/scenegraph/util/qsgpainternode.cpp
src/declarative/scenegraph/util/qsgpainternode_p.h
src/declarative/scenegraph/util/qsgtexture.cpp
src/declarative/scenegraph/util/qsgtexture_p.h
src/declarative/scenegraph/util/qsgtexturematerial.cpp
src/declarative/scenegraph/util/qsgvertexcolormaterial.cpp
src/declarative/util/qdeclarativepixmapcache.cpp
src/imports/etcprovider/qetcprovider.cpp
src/imports/etcprovider/qetcprovider.h
src/qmltest/quicktest.cpp
src/qmltest/quicktest.h

index 336766b..89b9452 100644 (file)
@@ -6,7 +6,7 @@ QPRO_PWD   = $$PWD
 CONFIG += module
 MODULE_PRI += ../../modules/qt_declarative.pri
 
-QT         = core-private gui-private network opengl opengl-private widgets-private sql
+QT = core-private gui gui-private network widgets-private sql
 
 contains(QT_CONFIG, svg): QT += svg
 DEFINES   += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
index 4d45541..71bc7df 100644 (file)
@@ -43,7 +43,7 @@
 #include "qsgcontext2d_p_p.h"
 #include "private/qsgadaptationlayer_p.h"
 #include "qsgcanvasitem_p.h"
-#include <QtOpenGL/qglframebufferobject.h>
+#include <QtGui/qopenglframebufferobject.h>
 #include <QtCore/qdebug.h>
 #include "private/qsgcontext_p.h"
 
index e6cda60..8ff7d17 100644 (file)
@@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
 DEFINE_BOOL_CONFIG_OPTION(qmlFixedAnimationStep, QML_FIXED_ANIMATION_STEP)
 DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP)
 
-extern Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
+extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
 
 class QSGCanvasPlainRenderLoop : public QObject, public QSGCanvasRenderLoop
 {
@@ -359,7 +359,7 @@ void QSGCanvasPrivate::initializeSceneGraph()
     if (context->isReady())
         return;
 
-    QGLContext *glctx = const_cast<QGLContext *>(QGLContext::currentContext());
+    QOpenGLContext *glctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
     context->initialize(glctx);
 
     Q_Q(QSGCanvas);
@@ -1894,7 +1894,7 @@ QSGEngine *QSGCanvas::sceneGraphEngine() const
     the rendering.
  */
 
-void QSGCanvas::setRenderTarget(QGLFramebufferObject *fbo)
+void QSGCanvas::setRenderTarget(QOpenGLFramebufferObject *fbo)
 {
     Q_D(QSGCanvas);
     if (d->context && d->context && QThread::currentThread() != d->context->thread()) {
@@ -1913,7 +1913,7 @@ void QSGCanvas::setRenderTarget(QGLFramebufferObject *fbo)
     The default is to render to the surface of the canvas, in which
     case the render target is 0.
  */
-QGLFramebufferObject *QSGCanvas::renderTarget() const
+QOpenGLFramebufferObject *QSGCanvas::renderTarget() const
 {
     Q_D(const QSGCanvas);
     return d->renderTarget;
@@ -1939,7 +1939,7 @@ QImage QSGCanvas::grabFrameBuffer()
 
 void QSGCanvasRenderLoop::createGLContext()
 {
-    gl = new QGuiGLContext();
+    gl = new QOpenGLContext();
     gl->create();
 }
 
index be6b173..e364ee8 100644 (file)
@@ -43,7 +43,7 @@
 #define QSGCANVAS_H
 
 #include <QtCore/qmetatype.h>
-#include <QtOpenGL/qgl.h>
+#include <QtGui/qopengl.h>
 #include <QtWidgets/qwidget.h>
 
 QT_BEGIN_HEADER
@@ -55,7 +55,7 @@ QT_MODULE(Declarative)
 class QSGItem;
 class QSGEngine;
 class QSGCanvasPrivate;
-class QGLFramebufferObject;
+class QOpenGLFramebufferObject;
 
 class Q_DECLARATIVE_EXPORT QSGCanvas : public QWindow
 {
@@ -82,8 +82,8 @@ public:
 
     QImage grabFrameBuffer();
 
-    void setRenderTarget(QGLFramebufferObject *fbo);
-    QGLFramebufferObject *renderTarget() const;
+    void setRenderTarget(QOpenGLFramebufferObject *fbo);
+    QOpenGLFramebufferObject *renderTarget() const;
 
 signals:
     void frameSwapped();
index 592e66b..e5347f5 100644 (file)
@@ -65,9 +65,9 @@
 #include <QtCore/qwaitcondition.h>
 #include <private/qwidget_p.h>
 #include <private/qwindow_p.h>
-#include <private/qgl_p.h>
-#include <qguiglcontext_qpa.h>
-#include <QtOpenGL/qglframebufferobject.h>
+#include <private/qopengl_p.h>
+#include <qopenglcontext.h>
+#include <QtGui/qopenglframebufferobject.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -169,7 +169,7 @@ public:
 
     QAnimationDriver *animationDriver;
 
-    QGLFramebufferObject *renderTarget;
+    QOpenGLFramebufferObject *renderTarget;
 
     QHash<int, QSGItem *> itemForTouchPointId;
 };
@@ -209,7 +209,7 @@ protected:
     void polishItems() { d->polishItems(); }
     QAnimationDriver *animationDriver() const { return d->animationDriver; }
 
-    inline QGuiGLContext *glContext() const { return gl; }
+    inline QOpenGLContext *glContext() const { return gl; }
     void createGLContext();
     void makeCurrent() { gl->makeCurrent(renderer); }
     void doneCurrent() { gl->doneCurrent(); }
@@ -222,7 +222,7 @@ private:
     QSGCanvasPrivate *d;
     QSGCanvas *renderer;
 
-    QGuiGLContext *gl;
+    QOpenGLContext *gl;
 };
 
 class QSGCanvasRenderThread : public QThread, public QSGCanvasRenderLoop
index 95aa2b4..76d5a00 100644 (file)
@@ -56,10 +56,10 @@ QT_BEGIN_NAMESPACE
 
     The QSGPaintedItem makes it possible to use the QPainter API with the QML Scene Graph.
     It sets up a textured rectangle in the Scene Graph and uses a QPainter to paint
-    onto the texture. The render target can be either a QImage or a QGLFramebufferObject.
+    onto the texture. The render target can be either a QImage or a QOpenGLFramebufferObject.
     When the render target is a QImage, QPainter first renders into the image then
     the content is uploaded to the texture.
-    When a QGLFramebufferObject is used, QPainter paints directly onto the texture.
+    When a QOpenGLFramebufferObject is used, QPainter paints directly onto the texture.
     Call update() to trigger a repaint.
 
     To enable QPainter to do anti-aliased rendering, use setAntialiasing().
@@ -84,7 +84,7 @@ QT_BEGIN_NAMESPACE
     can potentially be slow if the item is large. This render target allows high quality
     anti-aliasing and fast item resizing.
 
-    \value FramebufferObject QPainter paints into a QGLFramebufferObject using the GL
+    \value FramebufferObject QPainter paints into a QOpenGLFramebufferObject using the GL
     paint engine. Painting can be faster as no texture upload is required, but anti-aliasing
     quality is not as good as if using an image. This render target allows faster rendering
     in some cases, but you should avoid using it if the item is resized often.
index 6649dc9..b66f9c1 100644 (file)
@@ -53,7 +53,7 @@
 #include <qsgshadereffectsource_p.h>
 
 #include <QtCore/qsignalmapper.h>
-#include <QtOpenGL/qglframebufferobject.h>
+#include <QtGui/qopenglframebufferobject.h>
 
 QT_BEGIN_NAMESPACE
 
index 463c3d9..4a1a8ae 100644 (file)
 
 #include "qdeclarativeparserstatus.h"
 
+#include <QtGui/qcolor.h>
 #include <QtCore/qobject.h>
 #include <QtCore/qsize.h>
 #include <QtCore/qvariant.h>
-#include <QtOpenGL/qglfunctions.h>
+#include <QtGui/qopenglfunctions.h>
 
 #ifndef SHADEREFFECTMESH_H
 #define SHADEREFFECTMESH_H
index d51317a..c5d2083 100644 (file)
@@ -108,7 +108,7 @@ void QSGCustomMaterialShader::updateState(const RenderState &state, QSGMaterial
         }
     }
 
-    QGLFunctions *functions = state.context()->functions();
+    QOpenGLFunctions *functions = state.context()->functions();
     for (int i = material->m_textures.size() - 1; i >= 0; --i) {
         functions->glActiveTexture(GL_TEXTURE0 + i);
         if (QSGTextureProvider *provider = material->m_textures.at(i).second) {
index ef6dd64..4035608 100644 (file)
@@ -46,7 +46,7 @@
 #include <private/qsgadaptationlayer_p.h>
 #include <private/qsgrenderer_p.h>
 
-#include "qglframebufferobject.h"
+#include "qopenglframebufferobject.h"
 #include "qmath.h"
 #include <private/qsgtexture_p.h>
 
@@ -289,27 +289,27 @@ void QSGShaderEffectTexture::grab()
             // Don't delete the FBO right away in case it is used recursively.
             deleteFboLater = true;
             delete m_secondaryFbo;
-            QGLFramebufferObjectFormat format;
+            QOpenGLFramebufferObjectFormat format;
 
-            format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+            format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
             format.setInternalTextureFormat(m_format);
             format.setSamples(8);
-            m_secondaryFbo = new QGLFramebufferObject(m_size, format);
+            m_secondaryFbo = new QOpenGLFramebufferObject(m_size, format);
         } else {
-            QGLFramebufferObjectFormat format;
-            format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+            QOpenGLFramebufferObjectFormat format;
+            format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
             format.setInternalTextureFormat(m_format);
             format.setMipmap(m_mipmap);
             if (m_recursive) {
                 deleteFboLater = true;
                 delete m_secondaryFbo;
-                m_secondaryFbo = new QGLFramebufferObject(m_size, format);
+                m_secondaryFbo = new QOpenGLFramebufferObject(m_size, format);
                 glBindTexture(GL_TEXTURE_2D, m_secondaryFbo->texture());
                 updateBindOptions(true);
             } else {
                 delete m_fbo;
                 delete m_secondaryFbo;
-                m_fbo = new QGLFramebufferObject(m_size, format);
+                m_fbo = new QOpenGLFramebufferObject(m_size, format);
                 m_secondaryFbo = 0;
                 glBindTexture(GL_TEXTURE_2D, m_fbo->texture());
                 updateBindOptions(true);
@@ -322,7 +322,7 @@ void QSGShaderEffectTexture::grab()
         Q_ASSERT(m_fbo);
         Q_ASSERT(!m_multisampling);
 
-        m_secondaryFbo = new QGLFramebufferObject(m_size, m_fbo->format());
+        m_secondaryFbo = new QOpenGLFramebufferObject(m_size, m_fbo->format());
         glBindTexture(GL_TEXTURE_2D, m_secondaryFbo->texture());
         updateBindOptions(true);
     }
@@ -347,7 +347,7 @@ void QSGShaderEffectTexture::grab()
 
     m_dirtyTexture = false;
 
-    const QGLContext *ctx = m_context->glContext();
+    QOpenGLContext *ctx = m_context->glContext();
     m_renderer->setDeviceRect(m_size);
     m_renderer->setViewportRect(m_size);
     QRectF mirrored(m_rect.left(), m_rect.bottom(), m_rect.width(), -m_rect.height());
@@ -359,29 +359,29 @@ void QSGShaderEffectTexture::grab()
 
         if (deleteFboLater) {
             delete m_fbo;
-            QGLFramebufferObjectFormat format;
+            QOpenGLFramebufferObjectFormat format;
             format.setInternalTextureFormat(m_format);
-            format.setAttachment(QGLFramebufferObject::NoAttachment);
+            format.setAttachment(QOpenGLFramebufferObject::NoAttachment);
             format.setMipmap(m_mipmap);
             format.setSamples(0);
-            m_fbo = new QGLFramebufferObject(m_size, format);
+            m_fbo = new QOpenGLFramebufferObject(m_size, format);
             glBindTexture(GL_TEXTURE_2D, m_fbo->texture());
             updateBindOptions(true);
         }
 
         QRect r(QPoint(), m_size);
-        QGLFramebufferObject::blitFramebuffer(m_fbo, r, m_secondaryFbo, r);
+        QOpenGLFramebufferObject::blitFramebuffer(m_fbo, r, m_secondaryFbo, r);
     } else {
         if (m_recursive) {
             m_renderer->renderScene(QSGBindableFbo(m_secondaryFbo));
 
             if (deleteFboLater) {
                 delete m_fbo;
-                QGLFramebufferObjectFormat format;
-                format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+                QOpenGLFramebufferObjectFormat format;
+                format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
                 format.setInternalTextureFormat(m_format);
                 format.setMipmap(m_mipmap);
-                m_fbo = new QGLFramebufferObject(m_size, format);
+                m_fbo = new QOpenGLFramebufferObject(m_size, format);
                 glBindTexture(GL_TEXTURE_2D, m_fbo->texture());
                 updateBindOptions(true);
             }
index 92a4ce8..6cb76dd 100644 (file)
@@ -62,7 +62,7 @@ QT_MODULE(Declarative)
 
 class QSGNode;
 class UpdatePaintNodeData;
-class QGLFramebufferObject;
+class QOpenGLFramebufferObject;
 
 class QSGShaderEffectSourceTextureProvider;
 
@@ -134,8 +134,8 @@ private:
 
     QSGItem *m_shaderSource;
     QSGRenderer *m_renderer;
-    QGLFramebufferObject *m_fbo;
-    QGLFramebufferObject *m_secondaryFbo;
+    QOpenGLFramebufferObject *m_fbo;
+    QOpenGLFramebufferObject *m_secondaryFbo;
 
 #ifdef QSG_DEBUG_FBO_OVERLAY
     QSGRectangleNode *m_debugOverlay;
index 1915db6..7e6492e 100644 (file)
@@ -44,7 +44,7 @@
 #include <QDebug>
 #include <QPainter>
 #include <QSet>
-#include <QtOpenGL>
+#include <QtGui>
 
 QT_BEGIN_NAMESPACE
 
index 4c5199a..e9b9b98 100644 (file)
@@ -44,6 +44,7 @@
 
 #include <qsgnode.h>
 #include <qsgtext_p.h>
+#include <qglyphrun.h>
 
 QT_BEGIN_NAMESPACE
 
index 57461a4..737b393 100644 (file)
@@ -49,7 +49,7 @@
 #include "qsgparticleemitter_p.h"
 #include "qsgsprite_p.h"
 #include "qsgspriteengine_p.h"
-#include <QGLFunctions>
+#include <QOpenGLFunctions>
 #include <qsgengine.h>
 
 QT_BEGIN_NAMESPACE
@@ -128,7 +128,7 @@ public:
         program()->bind();
         program()->setUniformValue("texture", 0);
         program()->setUniformValue("colortable", 1);
-        glFuncs = QGLContext::currentContext()->functions();
+        glFuncs = QOpenGLContext::currentContext()->functions();
         m_timestamp_id = program()->uniformLocation("timestamp");
         m_entry_id = program()->uniformLocation("entry");
         m_sizetable_id = program()->uniformLocation("sizetable");
@@ -156,7 +156,7 @@ public:
     int m_opacitytable_id;
     QByteArray m_vertex_code;
     QByteArray m_fragment_code;
-    QGLFunctions* glFuncs;
+    QOpenGLFunctions* glFuncs;
 };
 
 class DeformableMaterialData : public ImageMaterialData {};
@@ -195,7 +195,7 @@ public:
         QSGSimpleMaterialShader<DeformableMaterialData>::initialize();
         program()->bind();
         program()->setUniformValue("texture", 0);
-        glFuncs = QGLContext::currentContext()->functions();
+        glFuncs = QOpenGLContext::currentContext()->functions();
         m_timestamp_id = program()->uniformLocation("timestamp");
         m_entry_id = program()->uniformLocation("entry");
     }
@@ -212,7 +212,7 @@ public:
     int m_timestamp_id;
     QByteArray m_vertex_code;
     QByteArray m_fragment_code;
-    QGLFunctions* glFuncs;
+    QOpenGLFunctions* glFuncs;
 };
 
 class SpriteMaterialData : public ImageMaterialData {};
@@ -252,7 +252,7 @@ public:
         program()->bind();
         program()->setUniformValue("texture", 0);
         program()->setUniformValue("colortable", 1);
-        glFuncs = QGLContext::currentContext()->functions();
+        glFuncs = QOpenGLContext::currentContext()->functions();
         m_timestamp_id = program()->uniformLocation("timestamp");
         m_framecount_id = program()->uniformLocation("framecount");
         m_animcount_id = program()->uniformLocation("animcount");
@@ -285,7 +285,7 @@ public:
     int m_opacitytable_id;
     QByteArray m_vertex_code;
     QByteArray m_fragment_code;
-    QGLFunctions* glFuncs;
+    QOpenGLFunctions* glFuncs;
 };
 
 class ColoredMaterialData : public ImageMaterialData {};
@@ -339,7 +339,7 @@ public:
         QSGSimpleMaterialShader<ColoredMaterialData>::initialize();
         program()->bind();
         program()->setUniformValue("texture", 0);
-        glFuncs = QGLContext::currentContext()->functions();
+        glFuncs = QOpenGLContext::currentContext()->functions();
         m_timestamp_id = program()->uniformLocation("timestamp");
         m_entry_id = program()->uniformLocation("entry");
     }
@@ -356,7 +356,7 @@ public:
     int m_entry_id;
     QByteArray m_vertex_code;
     QByteArray m_fragment_code;
-    QGLFunctions* glFuncs;
+    QOpenGLFunctions* glFuncs;
 };
 
 class SimpleMaterialData : public ImageMaterialData {};
@@ -408,7 +408,7 @@ public:
         QSGSimpleMaterialShader<SimpleMaterialData>::initialize();
         program()->bind();
         program()->setUniformValue("texture", 0);
-        glFuncs = QGLContext::currentContext()->functions();
+        glFuncs = QOpenGLContext::currentContext()->functions();
         m_timestamp_id = program()->uniformLocation("timestamp");
         m_entry_id = program()->uniformLocation("entry");
     }
@@ -425,7 +425,7 @@ public:
     int m_entry_id;
     QByteArray m_vertex_code;
     QByteArray m_fragment_code;
-    QGLFunctions* glFuncs;
+    QOpenGLFunctions* glFuncs;
 };
 
 void fillUniformArrayFromImage(float* array, const QImage& img, int size)
index f99eee3..107cabc 100644 (file)
@@ -42,7 +42,8 @@
 #ifndef QSGGEOMETRY_H
 #define QSGGEOMETRY_H
 
-#include <QtOpenGL/qgl.h>
+#include <QtGui/qopengl.h>
+#include <QRectF>
 
 QT_BEGIN_HEADER
 
index ca172d6..65ce9ee 100644 (file)
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
 
     The QSGMaterial and QSGMaterialShader form a tight relationship. For one
     scene graph (including nested graphs), there is one unique QSGMaterialShader
-    instance which encapsulates the QGLShaderProgram the scene graph uses
+    instance which encapsulates the QOpenGLShaderProgram the scene graph uses
     to render that material, such as a shader to flat coloring of geometry.
     Each QSGGeometryNode can have a unique QSGMaterial containing the
     how the shader should be configured when drawing that node, such as
@@ -152,7 +152,7 @@ QSGMaterialShader::QSGMaterialShader()
 
 
 /*!
-    \fn QGLShaderProgram *QSGMaterialShader::program() const
+    \fn QOpenGLShaderProgram *QSGMaterialShader::program() const
 
     Returns the shader program used by this QSGMaterialShader.
  */
@@ -228,7 +228,7 @@ void QSGMaterialShader::updateState(const RenderState &state, QSGMaterial *newMa
 
 /*!
     This function is called when the shader is initialized to compile the
-    actual QGLShaderProgram. Do not call it explicitely.
+    actual QOpenGLShaderProgram. Do not call it explicitely.
 
     The default implementation will extract the vertexShader() and
     fragmentShader() and bind the names returned from attributeNames()
@@ -239,8 +239,8 @@ void QSGMaterialShader::compile()
 {
     Q_ASSERT_X(!m_program.isLinked(), "QSGSMaterialShader::compile()", "Compile called multiple times!");
 
-    program()->addShaderFromSourceCode(QGLShader::Vertex, vertexShader());
-    program()->addShaderFromSourceCode(QGLShader::Fragment, fragmentShader());
+    program()->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShader());
+    program()->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShader());
 
     char const *const *attr = attributeNames();
 #ifndef QT_NO_DEBUG
@@ -385,10 +385,10 @@ QRect QSGMaterialShader::RenderState::deviceRect() const
 
 
 /*!
-    Returns the QGLContext that is being used for rendering
+    Returns the QOpenGLContext that is being used for rendering
  */
 
-const QGLContext *QSGMaterialShader::RenderState::context() const
+QOpenGLContext *QSGMaterialShader::RenderState::context() const
 {
     return static_cast<const QSGRenderer *>(m_data)->glContext();
 }
@@ -417,7 +417,7 @@ static void qt_print_material_count()
 
     The QSGMaterial and QSGMaterialShader subclasses form a tight relationship. For
     one scene graph (including nested graphs), there is one unique QSGMaterialShader
-    instance which encapsulates the QGLShaderProgram the scene graph uses
+    instance which encapsulates the QOpenGLShaderProgram the scene graph uses
     to render that material, such as a shader to flat coloring of geometry.
     Each QSGGeometryNode can have a unique QSGMaterial containing the
     how the shader should be configured when drawing that node, such as
index 7c69358..084219b 100644 (file)
@@ -42,7 +42,7 @@
 #ifndef MATERIAL_H
 #define MATERIAL_H
 
-#include <qglshaderprogram.h>
+#include <qopenglshaderprogram.h>
 
 QT_BEGIN_HEADER
 
@@ -75,7 +75,7 @@ public:
         QRect viewportRect() const;
         QRect deviceRect() const;
 
-        const QGLContext *context() const;
+        QOpenGLContext *context() const;
 
     private:
         friend class QSGRenderer;
@@ -91,7 +91,7 @@ public:
     virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
     virtual char const *const *attributeNames() const = 0; // Array must end with null.
 
-    inline QGLShaderProgram *program() { return &m_program; }
+    inline QOpenGLShaderProgram *program() { return &m_program; }
 
 protected:
 
@@ -104,7 +104,7 @@ protected:
     virtual const char *fragmentShader() const = 0;
 
 private:
-    QGLShaderProgram m_program;
+    QOpenGLShaderProgram m_program;
     void *m_reserved;
 };
 
index c92d943..607c5b5 100644 (file)
@@ -47,8 +47,8 @@
 
 #include "private/qsgadaptationlayer_p.h"
 
-#include <QGLShaderProgram>
-#include <qglframebufferobject.h>
+#include <QOpenGLShaderProgram>
+#include <qopenglframebufferobject.h>
 #include <QtWidgets/qapplication.h>
 
 #include <qdatetime.h>
@@ -81,7 +81,7 @@ void QSGBindable::reactivate() const
     glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
 }
 
-QSGBindableFbo::QSGBindableFbo(QGLFramebufferObject *fbo) : m_fbo(fbo)
+QSGBindableFbo::QSGBindableFbo(QOpenGLFramebufferObject *fbo) : m_fbo(fbo)
 {
 }
 
@@ -209,7 +209,7 @@ void QSGRenderer::renderScene()
     class B : public QSGBindable
     {
     public:
-        void bind() const { QGLFramebufferObject::bindDefault(); }
+        void bind() const { QOpenGLFramebufferObject::bindDefault(); }
     } b;
     renderScene(b);
 }
@@ -454,13 +454,13 @@ QSGRenderer::ClipType QSGRenderer::updateStencilClip(const QSGClipNode *clip)
         } else {
             if (!stencilEnabled) {
                 if (!m_clip_program.isLinked()) {
-                    m_clip_program.addShaderFromSourceCode(QGLShader::Vertex,
+                    m_clip_program.addShaderFromSourceCode(QOpenGLShader::Vertex,
                         "attribute highp vec4 vCoord;       \n"
                         "uniform highp mat4 matrix;         \n"
                         "void main() {                      \n"
                         "    gl_Position = matrix * vCoord; \n"
                         "}");
-                    m_clip_program.addShaderFromSourceCode(QGLShader::Fragment,
+                    m_clip_program.addShaderFromSourceCode(QOpenGLShader::Fragment,
                         "void main() {                                   \n"
                         "    gl_FragColor = vec4(0.81, 0.83, 0.12, 1.0); \n" // Trolltech green ftw!
                         "}");
@@ -555,7 +555,7 @@ public:
 
     ~QSGRendererVBOGeometryData()
     {
-        QGLFunctions *func = QGLContext::currentContext()->functions();
+        QOpenGLFunctions *func = QOpenGLContext::currentContext()->functions();
         if (vertexBuffer)
             func->glDeleteBuffers(1, &vertexBuffer);
         if (indexBuffer)
index 842286b..eed6483 100644 (file)
@@ -45,8 +45,9 @@
 #include <qset.h>
 #include <qhash.h>
 
-#include <qglfunctions.h>
-#include <qglshaderprogram.h>
+#include <qcolor.h>
+#include <qopenglfunctions.h>
+#include <qopenglshaderprogram.h>
 
 #include "qsgnode.h"
 #include "qsgmaterial.h"
@@ -62,13 +63,12 @@ QT_MODULE(Declarative)
 
 class QSGMaterialShader;
 struct QSGMaterialType;
-class QGLFramebufferObject;
+class QOpenGLFramebufferObject;
 class TextureReference;
 class QSGBindable;
 class QSGNodeUpdater;
 
-
-class Q_DECLARATIVE_EXPORT QSGRenderer : public QObject, public QGLFunctions
+class Q_DECLARATIVE_EXPORT QSGRenderer : public QObject, public QOpenGLFunctions
 {
     Q_OBJECT
 public:
@@ -116,7 +116,7 @@ public:
     void setClearColor(const QColor &color);
     QColor clearColor() const { return m_clear_color; }
 
-    const QGLContext *glContext() const { Q_ASSERT(m_context); return m_context->glContext(); }
+    QOpenGLContext *glContext() const { Q_ASSERT(m_context); return m_context->glContext(); }
 
     QSGContext *context();
 
@@ -168,7 +168,7 @@ private:
     QSet<QSGNode *> m_nodes_to_preprocess;
 
     QMatrix4x4 m_projection_matrix;
-    QGLShaderProgram m_clip_program;
+    QOpenGLShaderProgram m_clip_program;
     int m_clip_matrix_id;
 
     const QSGBindable *m_bindable;
@@ -195,10 +195,10 @@ public:
 class QSGBindableFbo : public QSGBindable
 {
 public:
-    QSGBindableFbo(QGLFramebufferObject *fbo);
+    QSGBindableFbo(QOpenGLFramebufferObject *fbo);
     virtual void bind() const;
 private:
-    QGLFramebufferObject *m_fbo;
+    QOpenGLFramebufferObject *m_fbo;
 };
 
 
index f2c0cbe..f1e9a89 100644 (file)
@@ -47,6 +47,7 @@
 #include <private/qsgtext_p.h>
 #include <QtCore/qobject.h>
 #include <QtCore/qrect.h>
+#include <QtGui/qbrush.h>
 #include <QtGui/qcolor.h>
 #include <QtCore/qsharedpointer.h>
 #include <QtGui/qglyphrun.h>
index 2a9e007..c472ed1 100644 (file)
@@ -55,7 +55,7 @@
 #include <qsgengine.h>
 
 #include <QApplication>
-#include <QGLContext>
+#include <QOpenGLContext>
 
 #include <private/qobject_p.h>
 #include <qmutex.h>
@@ -105,7 +105,7 @@ public:
     QSGRootNode *rootNode;
     QSGRenderer *renderer;
 
-    QGLContext *gl;
+    QOpenGLContext *gl;
 
     QSGEngine engine;
 
@@ -127,7 +127,7 @@ public:
 
     \brief The QSGContext holds the scene graph entry points for one QML engine.
 
-    The context is not ready for use until it has a QGLContext. Once that happens,
+    The context is not ready for use until it has a QOpenGLContext. Once that happens,
     the scene graph population can start.
 
     \internal
@@ -214,7 +214,7 @@ QSGRootNode *QSGContext::rootNode() const
 }
 
 
-QGLContext *QSGContext::glContext() const
+QOpenGLContext *QSGContext::glContext() const
 {
     Q_D(const QSGContext);
     return d->gl;
@@ -224,7 +224,7 @@ QGLContext *QSGContext::glContext() const
     Initializes the scene graph context with the GL context \a context. This also
     emits the ready() signal so that the QML graph can start building scene graph nodes.
  */
-void QSGContext::initialize(QGLContext *context)
+void QSGContext::initialize(QOpenGLContext *context)
 {
     Q_D(QSGContext);
 
@@ -253,7 +253,7 @@ bool QSGContext::isReady() const
 }
 
 
-void QSGContext::renderNextFrame(QGLFramebufferObject *fbo)
+void QSGContext::renderNextFrame(QOpenGLFramebufferObject *fbo)
 {
     Q_D(QSGContext);
 
index 29a5aac..a05854e 100644 (file)
@@ -42,6 +42,7 @@
 #ifndef QSGCONTEXT_H
 #define QSGCONTEXT_H
 
+#include <QImage>
 #include <QObject>
 #include <qabstractanimation.h>
 
@@ -64,8 +65,8 @@ class QSGMaterial;
 class QSGMaterialShader;
 class QSGEngine;
 
-class QGLContext;
-class QGLFramebufferObject;
+class QOpenGLContext;
+class QOpenGLFramebufferObject;
 
 class Q_DECLARATIVE_EXPORT QSGContext : public QObject
 {
@@ -76,7 +77,7 @@ public:
     explicit QSGContext(QObject *parent = 0);
     ~QSGContext();
 
-    virtual void initialize(QGLContext *context);
+    virtual void initialize(QOpenGLContext *context);
 
     QSGRenderer *renderer() const;
 
@@ -84,13 +85,13 @@ public:
     QSGRootNode *rootNode() const;
 
     QSGEngine *engine() const;
-    QGLContext *glContext() const;
+    QOpenGLContext *glContext() const;
 
     bool isReady() const;
 
     QSGMaterialShader *prepareMaterial(QSGMaterial *material);
 
-    virtual void renderNextFrame(QGLFramebufferObject *fbo = 0);
+    virtual void renderNextFrame(QOpenGLFramebufferObject *fbo = 0);
 
     virtual QSGRectangleNode *createRectangleNode();
     virtual QSGImageNode *createImageNode();
index 3e8510e..b8cd247 100644 (file)
@@ -42,7 +42,7 @@
 #include "qsgdefaultglyphnode_p.h"
 #include "qsgdefaultglyphnode_p_p.h"
 
-#include <qglshaderprogram.h>
+#include <qopenglshaderprogram.h>
 #include <private/qfont_p.h>
 
 QT_BEGIN_NAMESPACE
index b00c6f0..db2b59f 100644 (file)
 
 #include "qsgdefaultglyphnode_p_p.h"
 
-#include <qglshaderprogram.h>
+#include <qopenglshaderprogram.h>
 
-#include <private/qtextureglyphcache_gl_p.h>
+#include <QtGui/private/qtextureglyphcache_gl_p.h>
 #include <private/qfontengine_p.h>
-#include <private/qglextensions_p.h>
+#include <private/qopenglextensions_p.h>
 
 #include <private/qsgtexture_p.h>
 
@@ -163,24 +163,17 @@ void QSGTextMaskMaterial::init()
     QFontEngineGlyphCache::Type type = QFontEngineGlyphCache::Raster_A8;
     setFlag(Blending, true);
 
-    QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
+    QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext());
     Q_ASSERT(ctx != 0);
 
     QRawFontPrivate *fontD = QRawFontPrivate::get(m_font);
     if (fontD->fontEngine != 0) {
         m_glyphCache = fontD->fontEngine->glyphCache(ctx, type, QTransform());
         if (!m_glyphCache || m_glyphCache->cacheType() != type) {
-            m_glyphCache = new QGLTextureGlyphCache(ctx, type, QTransform());
+            m_glyphCache = new QOpenGLTextureGlyphCache(type, QTransform());
             fontD->fontEngine->setGlyphCache(ctx, m_glyphCache.data());
         }
     }
-
-#if !defined(QT_OPENGL_ES_2)
-    bool success = qt_resolve_version_2_0_functions(ctx)
-                   && qt_resolve_buffer_extensions(ctx);
-    Q_ASSERT(success);
-    Q_UNUSED(success);
-#endif
 }
 
 void QSGTextMaskMaterial::populate(const QPointF &p,
@@ -260,9 +253,9 @@ QSGMaterialType *QSGTextMaskMaterial::type() const
     return &type;
 }
 
-QGLTextureGlyphCache *QSGTextMaskMaterial::glyphCache() const
+QOpenGLTextureGlyphCache *QSGTextMaskMaterial::glyphCache() const
 {
-    return static_cast<QGLTextureGlyphCache*>(m_glyphCache.data());
+    return static_cast<QOpenGLTextureGlyphCache*>(m_glyphCache.data());
 }
 
 QSGMaterialShader *QSGTextMaskMaterial::createShader() const
index 19d5f9e..d22bc33 100644 (file)
@@ -42,6 +42,7 @@
 #ifndef TEXTMASKMATERIAL_H
 #define TEXTMASKMATERIAL_H
 
+#include <qcolor.h>
 #include <qsgmaterial.h>
 #include <qsgtexture.h>
 #include <qsggeometry.h>
@@ -52,7 +53,7 @@
 QT_BEGIN_NAMESPACE
 
 class QFontEngineGlyphCache;
-class QGLTextureGlyphCache;
+class QOpenGLTextureGlyphCache;
 class QFontEngine;
 class Geometry;
 class QSGTextMaskMaterial: public QSGMaterial
@@ -75,7 +76,7 @@ public:
 
     bool ensureUpToDate();
 
-    QGLTextureGlyphCache *glyphCache() const;
+    QOpenGLTextureGlyphCache *glyphCache() const;
     void populate(const QPointF &position,
                   const QVector<quint32> &glyphIndexes, const QVector<QPointF> &glyphPositions,
                   QSGGeometry *geometry, QRectF *boundingRect, QPointF *baseLine);
index e60ebf2..657f8d0 100644 (file)
@@ -45,7 +45,7 @@
 
 #include <QtCore/qvarlengtharray.h>
 #include <QtCore/qmath.h>
-#include <QtOpenGL/qglfunctions.h>
+#include <QtGui/qopenglfunctions.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -194,8 +194,8 @@ void QSGDefaultImageNode::updateGeometry()
         bool isRepeating = hCells > 1 || vCells > 1;
 
 #ifdef QT_OPENGL_ES_2
-        const QGLContext *ctx = QGLContext::currentContext();
-        bool npotSupported = ctx->functions()->hasOpenGLFeature(QGLFunctions::NPOTTextures);
+        QOpenGLContext *ctx = QOpenGLContext::currentContext();
+        bool npotSupported = ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextures);
 
         QSize size = t->textureSize();
         bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height());
index ff4913a..d1973d4 100644 (file)
 #include <qmath.h>
 #include <private/qsgpathsimplifier_p.h>
 #include <private/qdeclarativeglobal_p.h>
-#include <qglshaderprogram.h>
-#include <private/qglengineshadersource_p.h>
+#include <qopenglshaderprogram.h>
+#include <QtGui/private/qopenglengineshadersource_p.h>
 #include <private/qsgcontext_p.h>
 #include <private/qrawfont_p.h>
-#include <qglfunctions.h>
+#include <qopenglfunctions.h>
 #include <qglyphrun.h>
 #include <qrawfont.h>
 #include <qdir.h>
+#include <QtGui/qguiapplication.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -797,9 +798,8 @@ static bool fontHasNarrowOutlines(const QRawFont &f)
     return minHThick == 1 || minVThick == 1;
 }
 
-QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager(const QGLContext *c)
-    : ctx(c)
-    , m_threshold_func(defaultThresholdFunc)
+QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager(QOpenGLContext *c)
+    : m_threshold_func(defaultThresholdFunc)
     , m_antialiasingSpread_func(defaultAntialiasingSpreadFunc)
     , m_maxTextureSize(0)
 {
@@ -827,23 +827,23 @@ QSGDistanceFieldGlyphCacheManager::QSGDistanceFieldGlyphCacheManager(const QGLCo
     m_textureCoordinateArray[6] = 0.0f;
     m_textureCoordinateArray[7] = 1.0f;
 
-    m_blitProgram = new QGLShaderProgram;
+    m_blitProgram = new QOpenGLShaderProgram;
     {
         QString source;
-        source.append(QLatin1String(qglslMainWithTexCoordsVertexShader));
-        source.append(QLatin1String(qglslUntransformedPositionVertexShader));
+        source.append(QLatin1String(qopenglslMainWithTexCoordsVertexShader));
+        source.append(QLatin1String(qopenglslUntransformedPositionVertexShader));
 
-        QGLShader *vertexShader = new QGLShader(QGLShader::Vertex, m_blitProgram);
+        QOpenGLShader *vertexShader = new QOpenGLShader(QOpenGLShader::Vertex, m_blitProgram);
         vertexShader->compileSourceCode(source);
 
         m_blitProgram->addShader(vertexShader);
     }
     {
         QString source;
-        source.append(QLatin1String(qglslMainFragmentShader));
-        source.append(QLatin1String(qglslImageSrcFragmentShader));
+        source.append(QLatin1String(qopenglslMainFragmentShader));
+        source.append(QLatin1String(qopenglslImageSrcFragmentShader));
 
-        QGLShader *fragmentShader = new QGLShader(QGLShader::Fragment, m_blitProgram);
+        QOpenGLShader *fragmentShader = new QOpenGLShader(QOpenGLShader::Fragment, m_blitProgram);
         fragmentShader->compileSourceCode(source);
 
         m_blitProgram->addShader(fragmentShader);
@@ -876,7 +876,7 @@ int QSGDistanceFieldGlyphCacheManager::maxTextureSize() const
 }
 
 
-QHash<QString, QGLContextGroupResource<QSGDistanceFieldGlyphCache::DistanceFieldTextureData> > QSGDistanceFieldGlyphCache::m_textures_data;
+QHash<QString, QOpenGLMultiGroupSharedResource> QSGDistanceFieldGlyphCache::m_textures_data;
 
 QSGDistanceFieldGlyphCache::DistanceFieldTextureData *QSGDistanceFieldGlyphCache::textureData()
 {
@@ -885,10 +885,10 @@ QSGDistanceFieldGlyphCache::DistanceFieldTextureData *QSGDistanceFieldGlyphCache
             .arg(m_font.styleName())
             .arg(m_font.weight())
             .arg(m_font.style());
-    return m_textures_data[key].value(ctx);
+    return m_textures_data[key].value<QSGDistanceFieldGlyphCache::DistanceFieldTextureData>(QOpenGLContext::currentContext());
 }
 
-QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, const QGLContext *c, const QRawFont &font)
+QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font)
     : m_manager(man)
     , ctx(c)
 {
@@ -1045,7 +1045,7 @@ void QSGDistanceFieldGlyphCache::derefGlyphs(int count, const glyph_t *glyphs)
 
 void QSGDistanceFieldGlyphCache::createTexture(int width, int height)
 {
-    if (ctx->d_ptr->workaround_brokenFBOReadBack && m_textureData->image.isNull())
+    if (ctx->d_func()->workaround_brokenFBOReadBack && m_textureData->image.isNull())
         m_textureData->image = QImage(width, height, QImage::Format_Indexed8);
 
     while (glGetError() != GL_NO_ERROR) { }
@@ -1083,7 +1083,7 @@ void QSGDistanceFieldGlyphCache::resizeTexture(int width, int height)
     if (!oldTexture)
         return;
 
-    if (ctx->d_ptr->workaround_brokenFBOReadBack) {
+    if (ctx->d_func()->workaround_brokenFBOReadBack) {
         m_textureData->image = m_textureData->image.copy(0, 0, width, height);
         QImage copy = m_textureData->image.copy(0, 0, oldWidth, oldHeight);
         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, GL_ALPHA, GL_UNSIGNED_BYTE, copy.constBits());
@@ -1093,7 +1093,7 @@ void QSGDistanceFieldGlyphCache::resizeTexture(int width, int height)
 
     if (!m_textureData->fbo)
         ctx->functions()->glGenFramebuffers(1, &m_textureData->fbo);
-    ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_textureData->fbo);
+    ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, m_textureData->fbo);
 
     GLuint tmp_texture;
     glGenTextures(1, &tmp_texture);
@@ -1105,7 +1105,7 @@ void QSGDistanceFieldGlyphCache::resizeTexture(int width, int height)
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
     glBindTexture(GL_TEXTURE_2D, 0);
-    ctx->functions()->glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+    ctx->functions()->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                              GL_TEXTURE_2D, tmp_texture, 0);
 
     ctx->functions()->glActiveTexture(GL_TEXTURE0);
@@ -1145,12 +1145,12 @@ void QSGDistanceFieldGlyphCache::resizeTexture(int width, int height)
 
     glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight);
 
-    ctx->functions()->glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
-                                                GL_RENDERBUFFER_EXT, 0);
+    ctx->functions()->glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+                                                GL_RENDERBUFFER, 0);
     glDeleteTextures(1, &tmp_texture);
     glDeleteTextures(1, &oldTexture);
 
-    ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+    ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, 0);
 
     // restore render states
     if (stencilTestEnabled)
@@ -1177,7 +1177,7 @@ void QSGDistanceFieldGlyphCache::updateCache()
     glBindTexture(GL_TEXTURE_2D, m_textureData->texture);
 
     // ### Remove before final release
-    static bool cacheDistanceFields = QApplication::arguments().contains("--cache-distance-fields");
+    static bool cacheDistanceFields = QGuiApplication::arguments().contains("--cache-distance-fields");
 
 // #define QSGDISTANCEFIELDS_TIME_CREATION
 #ifdef QSGDISTANCEFIELDS_TIME_CREATION
@@ -1214,7 +1214,7 @@ void QSGDistanceFieldGlyphCache::updateCache()
 
         QImage glyph = renderDistanceFieldGlyph(glyphIndex);
 
-        if (ctx->d_ptr->workaround_brokenFBOReadBack) {
+        if (ctx->d_func()->workaround_brokenFBOReadBack) {
             uchar *inBits = glyph.scanLine(0);
             uchar *outBits = m_textureData->image.scanLine(int(c.y)) + int(c.x);
             for (int y = 0; y < glyph.height(); ++y) {
@@ -1245,7 +1245,7 @@ void QSGDistanceFieldGlyphCache::updateCache()
 
 bool QSGDistanceFieldGlyphCache::useWorkaroundBrokenFBOReadback() const
 {
-    return ctx->d_ptr->workaround_brokenFBOReadBack;
+    return ctx->d_func()->workaround_brokenFBOReadBack;
 }
 
 int QSGDistanceFieldGlyphCache::glyphCount() const
index c4dd97b..aea7c59 100644 (file)
 #ifndef DISTANCEFIELDGLYPHCACHE_H
 #define DISTANCEFIELDGLYPHCACHE_H
 
-#include <qgl.h>
+#include <qopengl.h>
 #include <qrawfont.h>
-#include <private/qgl_p.h>
+#include <private/qopenglcontext_p.h>
+#include <QtGui/qopenglfunctions.h>
 #include <private/qfont_p.h>
 #include <private/qfontengine_p.h>
 #include <QtGui/private/qdatabuffer_p.h>
@@ -55,13 +56,13 @@ QT_BEGIN_NAMESPACE
 typedef float (*ThresholdFunc)(float glyphScale);
 typedef float (*AntialiasingSpreadFunc)(float glyphScale);
 
-class QGLShaderProgram;
+class QOpenGLShaderProgram;
 class QSGDistanceFieldGlyphCache;
 
 class Q_DECLARATIVE_EXPORT QSGDistanceFieldGlyphCacheManager
 {
 public:
-    QSGDistanceFieldGlyphCacheManager(const QGLContext *c);
+    QSGDistanceFieldGlyphCacheManager(QOpenGLContext *c);
     ~QSGDistanceFieldGlyphCacheManager();
 
     QSGDistanceFieldGlyphCache *cache(const QRawFont &font);
@@ -75,7 +76,7 @@ public:
     AntialiasingSpreadFunc antialiasingSpreadFunc() const { return m_antialiasingSpread_func; }
     void setAntialiasingSpreadFunc(AntialiasingSpreadFunc func) { m_antialiasingSpread_func = func; }
 
-    QGLShaderProgram *blitProgram() { return m_blitProgram; }
+    QOpenGLShaderProgram *blitProgram() { return m_blitProgram; }
     const GLfloat *blitVertexArray() const { return &m_vertexCoordinateArray[0]; }
     const GLfloat *blitTextureArray() const { return &m_textureCoordinateArray[0]; }
 
@@ -84,7 +85,7 @@ public:
 private:
     QHash<QFontEngine *, QSGDistanceFieldGlyphCache *> m_caches;
 
-    const QGLContext *ctx;
+    QOpenGLContext *ctx;
 
     QSGGlyphNode::AntialiasingMode m_defaultAntialiasingMode;
     ThresholdFunc m_threshold_func;
@@ -92,7 +93,7 @@ private:
 
     mutable int m_maxTextureSize;
 
-    QGLShaderProgram *m_blitProgram;
+    QOpenGLShaderProgram *m_blitProgram;
     GLfloat m_vertexCoordinateArray[8];
     GLfloat m_textureCoordinateArray[8];
 };
@@ -145,20 +146,22 @@ public:
     bool useWorkaroundBrokenFBOReadback() const;
 
 private:
-    QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, const QGLContext *c, const QRawFont &font);
+    QSGDistanceFieldGlyphCache(QSGDistanceFieldGlyphCacheManager *man, QOpenGLContext *c, const QRawFont &font);
 
     void createTexture(int width, int height);
     void resizeTexture(int width, int height);
 
     QSGDistanceFieldGlyphCacheManager *m_manager;
 
+    QOpenGLContext *ctx;
+
     QRawFont m_font;
     QRawFont m_referenceFont;
 
     int m_glyphCount;
     QHash<glyph_t, Metrics> m_metrics;
 
-    struct DistanceFieldTextureData {
+    struct DistanceFieldTextureData : public QOpenGLSharedResource {
         GLuint texture;
         GLuint fbo;
         QSize size;
@@ -171,20 +174,33 @@ private:
         QImage image;
         bool doubleGlyphResolution;
 
-        DistanceFieldTextureData(const QGLContext *)
-            : texture(0)
+        DistanceFieldTextureData(QOpenGLContext *ctx)
+            : QOpenGLSharedResource(ctx->shareGroup())
+            , texture(0)
             , fbo(0)
             , pendingGlyphs(64)
             , currX(0)
             , currY(0)
             , doubleGlyphResolution(false)
-        { }
+        {}
+
+        void invalidateResource()
+        {
+            texture = 0;
+            fbo = 0;
+            size = QSize();
+        }
+
+        void freeResource(QOpenGLContext *ctx)
+        {
+            glDeleteTextures(1, &texture);
+            ctx->functions()->glDeleteFramebuffers(1, &fbo);
+        }
     };
+
     DistanceFieldTextureData *textureData();
     DistanceFieldTextureData *m_textureData;
-    static QHash<QString, QGLContextGroupResource<DistanceFieldTextureData> > m_textures_data;
-
-    const QGLContext *ctx;
+    static QHash<QString, QOpenGLMultiGroupSharedResource> m_textures_data;
 
     friend class QSGDistanceFieldGlyphCacheManager;
 };
index c81113f..72c53a2 100644 (file)
@@ -42,7 +42,7 @@
 #include "qsgdistancefieldglyphnode_p_p.h"
 #include "qsgdistancefieldglyphcache_p.h"
 #include <private/qsgtexture_p.h>
-#include <QtOpenGL/qglfunctions.h>
+#include <QtGui/qopenglfunctions.h>
 #include <qmath.h>
 
 QT_BEGIN_NAMESPACE
index 5fac564..9e851bf 100644 (file)
@@ -48,7 +48,7 @@
 
 #include <math.h>
 
-#include <private/qgl_p.h>
+#include <private/qopengl_p.h>
 #include <private/qrbtree_p.h>
 
 QT_BEGIN_NAMESPACE
index 6fea47b..b628a47 100644 (file)
@@ -1,9 +1,6 @@
 INCLUDEPATH += $$PWD/coreapi $$PWD/convenience $$PWD/3d
 !contains(QT_CONFIG, egl):DEFINES += QT_NO_EGL
 
-QT += opengl
-
-
 # Core API
 HEADERS += \
     $$PWD/coreapi/qsgdefaultrenderer_p.h \
index d954f19..06ca28a 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "qsgflatcolormaterial.h"
 
-#include <qglshaderprogram.h>
+#include <qopenglshaderprogram.h>
 
 QT_BEGIN_NAMESPACE
 
index ffff794..fb04110 100644 (file)
@@ -43,6 +43,7 @@
 #define FLATCOLORMATERIAL_H
 
 #include <qsgmaterial.h>
+#include <qcolor.h>
 
 QT_BEGIN_HEADER
 
index ab96591..9a02d8b 100644 (file)
 
 #include "qsgpainteditem.h"
 #include <private/qsgcontext_p.h>
-#include <qglframebufferobject.h>
-#include <qglfunctions.h>
+#include <qopenglframebufferobject.h>
+#include <qopenglfunctions.h>
 #include <qmath.h>
+#include <qpainter.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -90,7 +91,7 @@ void QSGPainterTexture::bind()
 #endif
 
         if (m_has_mipmaps && !m_mipmaps_generated) {
-            const QGLContext *ctx = QGLContext::currentContext();
+            QOpenGLContext *ctx = QOpenGLContext::currentContext();
             ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
             m_mipmaps_generated = true;
         }
@@ -174,7 +175,7 @@ void QSGPainterNode::paint()
         m_texture->setImage(m_image);
         m_texture->setDirtyRect(dirtyRect);
     } else if (m_multisampledFbo) {
-        QGLFramebufferObject::blitFramebuffer(m_fbo, dirtyRect, m_multisampledFbo, dirtyRect);
+        QOpenGLFramebufferObject::blitFramebuffer(m_fbo, dirtyRect, m_multisampledFbo, dirtyRect);
     }
 
     m_dirtyRect = QRect();
@@ -249,8 +250,8 @@ void QSGPainterNode::updateRenderTarget()
     }
 
     if (m_actualRenderTarget == QSGPaintedItem::FramebufferObject) {
-        const QGLContext *ctx = QGLContext::currentContext();
-        if (m_fbo && !m_dirtyGeometry && (!ctx->format().sampleBuffers() || !m_multisamplingSupported))
+        QOpenGLContext *ctx = QOpenGLContext::currentContext();
+        if (m_fbo && !m_dirtyGeometry && (!ctx->format().samples() || !m_multisamplingSupported))
             return;
 
         if (m_fboSize.isEmpty())
@@ -260,22 +261,22 @@ void QSGPainterNode::updateRenderTarget()
         delete m_multisampledFbo;
         m_fbo = m_multisampledFbo = 0;
 
-        if (m_smoothPainting && ctx->format().sampleBuffers() && m_multisamplingSupported) {
+        if (m_smoothPainting && ctx->format().samples() && m_multisamplingSupported) {
             {
-                QGLFramebufferObjectFormat format;
-                format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+                QOpenGLFramebufferObjectFormat format;
+                format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
                 format.setSamples(ctx->format().samples());
-                m_multisampledFbo = new QGLFramebufferObject(m_fboSize, format);
+                m_multisampledFbo = new QOpenGLFramebufferObject(m_fboSize, format);
             }
             {
-                QGLFramebufferObjectFormat format;
-                format.setAttachment(QGLFramebufferObject::NoAttachment);
-                m_fbo = new QGLFramebufferObject(m_fboSize, format);
+                QOpenGLFramebufferObjectFormat format;
+                format.setAttachment(QOpenGLFramebufferObject::NoAttachment);
+                m_fbo = new QOpenGLFramebufferObject(m_fboSize, format);
             }
         } else {
-            QGLFramebufferObjectFormat format;
-            format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
-            m_fbo = new QGLFramebufferObject(m_fboSize, format);
+            QOpenGLFramebufferObjectFormat format;
+            format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
+            m_fbo = new QOpenGLFramebufferObject(m_fboSize, format);
         }
     } else {
         if (!m_image.isNull() && !m_dirtyGeometry)
index 5b0e9ce..50fb521 100644 (file)
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
 
 QT_MODULE(Declarative)
 
-class QGLFramebufferObject;
+class QOpenGLFramebufferObject;
 
 class Q_DECLARATIVE_EXPORT QSGPainterTexture : public QSGPlainTexture
 {
@@ -115,8 +115,8 @@ private:
 
     QSGPaintedItem *m_item;
 
-    QGLFramebufferObject *m_fbo;
-    QGLFramebufferObject *m_multisampledFbo;
+    QOpenGLFramebufferObject *m_fbo;
+    QOpenGLFramebufferObject *m_multisampledFbo;
     QImage m_image;
 
     QSGOpaqueTextureMaterial m_material;
index 536ac8d..d403bd6 100644 (file)
@@ -42,7 +42,7 @@
 #define GL_GLEXT_PROTOTYPES
 
 #include <private/qsgtexture_p.h>
-#include <qglfunctions.h>
+#include <qopenglfunctions.h>
 #include <private/qsgcontext_p.h>
 #include <qthread.h>
 
@@ -260,7 +260,7 @@ void QSGTexture::updateBindOptions(bool force)
     if (force || d->wrapChanged) {
 #if !defined(QT_NO_DEBUG) && defined(QT_OPENGL_ES_2)
         if (d->horizontalWrap == Repeat || d->verticalWrap == Repeat) {
-            bool npotSupported = QGLContext::currentContext()->functions()->hasOpenGLFeature(QGLFunctions::NPOTTextures);
+            bool npotSupported = QOpenGLFunctions(QOpenGLContext::currentContext()).hasOpenGLFeature(QOpenGLFunctions::NPOTTextures);
             QSize size = textureSize();
             bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height());
             if (!npotSupported && isNpot)
@@ -341,7 +341,7 @@ void QSGPlainTexture::bind()
     if (!m_dirty_texture) {
         glBindTexture(GL_TEXTURE_2D, m_texture_id);
         if (m_has_mipmaps && !m_mipmaps_generated) {
-            const QGLContext *ctx = QGLContext::currentContext();
+            QOpenGLContext *ctx = QOpenGLContext::currentContext();
             ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
             m_mipmaps_generated = true;
         }
@@ -377,7 +377,7 @@ void QSGPlainTexture::bind()
 #endif
 
     if (m_has_mipmaps) {
-        const QGLContext *ctx = QGLContext::currentContext();
+        QOpenGLContext *ctx = QOpenGLContext::currentContext();
         ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
         m_mipmaps_generated = true;
     }
index 971e5e6..22812f8 100644 (file)
@@ -44,7 +44,7 @@
 
 #include <private/qobject_p.h>
 
-#include <QtOpenGL/qgl.h>
+#include <QtGui/qopengl.h>
 
 #include "qsgtexture.h"
 #include <private/qsgcontext_p.h>
index 7a7050e..43bfbca 100644 (file)
@@ -41,8 +41,8 @@
 
 #include "qsgtexturematerial_p.h"
 
-#include <QtOpenGL/qglshaderprogram.h>
-#include <QtOpenGL/qglfunctions.h>
+#include <QtGui/qopenglshaderprogram.h>
+#include <QtGui/qopenglfunctions.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -103,7 +103,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa
 
     t->setFiltering(tx->filtering());
 #ifdef QT_OPENGL_ES_2
-    bool npotSupported = state.context()->functions()->hasOpenGLFeature(QGLFunctions::NPOTTextures);
+    bool npotSupported = QOpenGLFunctions(const_cast<QOpenGLContext *>(state.context())).hasOpenGLFeature(QOpenGLFunctions::NPOTTextures);
     QSize size = t->textureSize();
     bool isNpot = !isPowerOfTwo(size.width()) || !isPowerOfTwo(size.height());
     if (!npotSupported && isNpot) {
index 910d7a5..c31e9dc 100644 (file)
@@ -41,7 +41,7 @@
 
 #include "qsgvertexcolormaterial_p.h"
 
-#include <qglshaderprogram.h>
+#include <qopenglshaderprogram.h>
 
 QT_BEGIN_NAMESPACE
 
index 108d257..276219e 100644 (file)
@@ -66,6 +66,7 @@
 #include <QtCore/qdebug.h>
 #include <private/qobject_p.h>
 #include <QSslError>
+#include <QOpenGLContext>
 
 #define IMAGEREQUEST_MAX_REQUEST_COUNT       8
 #define IMAGEREQUEST_MAX_REDIRECT_RECURSION 16
@@ -724,7 +725,7 @@ QDeclarativePixmapStore::QDeclarativePixmapStore()
 void QDeclarativePixmapStore::cleanTextureForContext(QDeclarativePixmapData *data)
 {
     if (data->context) {
-        Q_ASSERT(QGLContext::currentContext());
+        Q_ASSERT(QOpenGLContext::currentContext());
         delete data->texture;
         data->context = 0;
         data->texture = 0;
index 3e76c01..053258a 100644 (file)
@@ -44,7 +44,8 @@
 #include <QtDebug>
 #include <QFile>
 
-#include <qglfunctions.h>
+#include <qopenglfunctions.h>
+#include <qopenglcontext.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -118,7 +119,7 @@ void EtcTexture::bind()
                 "paddedWidth: " << m_paddedSize.width() << "paddedHeight: " << m_paddedSize.height();
 #endif
 
-    const QGLContext *ctx = QGLContext::currentContext();
+    QOpenGLContext *ctx = QOpenGLContext::currentContext();
     Q_ASSERT(ctx != 0);
     ctx->functions()->glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_OES,
                                              m_size.width(), m_size.height(), 0,
index a34b458..46ec421 100644 (file)
@@ -42,7 +42,7 @@
 #ifndef QETCPROVIDER_H
 #define QETCPROVIDER_H
 
-#include <qgl.h>
+#include <qopengl.h>
 #include <QDeclarativeImageProvider>
 #include <QSGTexture>
 #include <QDeclarativeEngine>
index 3164d9e..7f16edd 100644 (file)
@@ -54,7 +54,7 @@
 #endif
 #include <QtDeclarative/qjsvalue.h>
 #include <QtDeclarative/qjsengine.h>
-#include <QtOpenGL/qgl.h>
+#include <QtGui/qopengl.h>
 #include <QtCore/qurl.h>
 #include <QtCore/qfileinfo.h>
 #include <QtCore/qdir.h>
index 1f8fe21..a83d176 100644 (file)
@@ -45,7 +45,7 @@
 #include <QtQuickTest/quicktestglobal.h>
 #include <QtWidgets/qwidget.h>
 #ifdef QT_OPENGL_LIB
-#include <QtOpenGL/qgl.h>
+#include <QtGui/qopengl.h>
 #endif
 
 QT_BEGIN_NAMESPACE
@@ -65,7 +65,7 @@ Q_QUICK_TEST_EXPORT int quick_test_main(int argc, char **argv, const char *name,
 #define QUICK_TEST_OPENGL_MAIN(name) \
     static QWidget *name##_create_viewport() \
     { \
-        return new QGLWidget(); \
+        return new QOpenGLWidget(); \
     } \
     int main(int argc, char **argv) \
     { \
@@ -83,7 +83,7 @@ Q_QUICK_TEST_EXPORT int quick_test_main(int argc, char **argv, const char *name,
 #define QUICK_TEST_OPENGL_MAIN(name) \
     static QWidget *name##_create_viewport() \
     { \
-        return new QGLWidget(); \
+        return new QOpenGLWidget(); \
     } \
     int main(int argc, char **argv) \
     { \