]> git.sesse.net Git - nageru/blobdiff - glwidget.cpp
Use QGLWidget instead of QOpenGLWidget, as the latter is too slow.
[nageru] / glwidget.cpp
index 17f7832378c67dd59c7e45183bd5bda1d23e2860..6e216a6700d88212a508fe457fb6e889a584c383 100644 (file)
@@ -18,7 +18,7 @@
 #include <movit/util.h>
 
 GLWidget::GLWidget(QWidget *parent)
-    : QOpenGLWidget(parent),
+    : QGLWidget(parent, global_share_widget),
       resource_pool(new movit::ResourcePool)
 {
 }
@@ -37,10 +37,11 @@ void GLWidget::initializeGL()
                QMetaObject::invokeMethod(t, "update", Qt::AutoConnection);
        });
 
-       QSurface *surface = create_surface(format());
-       QSurface *surface2 = create_surface(format());
-       QSurface *surface3 = create_surface(format());
-       QSurface *surface4 = create_surface(format());
+       QSurfaceFormat fmt = QGLFormat::toSurfaceFormat(format());
+       QSurface *surface = create_surface(fmt);
+       QSurface *surface2 = create_surface(fmt);
+       QSurface *surface3 = create_surface(fmt);
+       QSurface *surface4 = create_surface(fmt);
        start_mixer(surface, surface2, surface3, surface4);
 
        // Prepare the shaders to actually get the texture shown (ick).
@@ -89,6 +90,11 @@ void GLWidget::initializeGL()
 #endif
 }
 
+void GLWidget::resizeGL(int width, int height)
+{
+       glViewport(0, 0, width, height);
+}
+
 void GLWidget::paintGL()
 {
        DisplayFrame frame;