Skip to content

Commit

Permalink
gl: qt<5.3 build error. check dygl
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-bin committed Feb 4, 2015
1 parent 24b7447 commit 593908d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions widgets/QOpenGLWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
#include "QtAVWidgets/QOpenGLWidget.h"
#include <QResizeEvent>
#include <QWindow>
// for dynamicgl. qglfunctions before qt5.3 does not have portable gl functions
#ifdef QT_OPENGL_DYNAMIC
#define DYGL(glFunc) QOpenGLContext::currentContext()->functions()->glFunc
#else
#define DYGL(glFunc) glFunc
#endif

namespace QtAV {

Expand Down Expand Up @@ -52,7 +58,7 @@ QOpenGLWidget::QOpenGLWidget(QWidget *parent, Qt::WindowFlags f)
// WA_PaintOnScreen: QWidget::paintEngine: Should no longer be called. This flag is only supported on X11 and it disables double buffering
//setAttribute(Qt::WA_PaintOnScreen); // enforce native window, so windowHandle() is not null
setAttribute(Qt::WA_NoSystemBackground);
setAutoFillBackground(true); // for compatibility
//setAutoFillBackground(true); // for compatibility
// FIXME: why setSurfaceType crash?
//windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
}
Expand Down Expand Up @@ -195,9 +201,8 @@ void QOpenGLWidget::render()

void QOpenGLWidget::invokeUserPaint()
{
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glViewport(0, 0, width()*devicePixelRatio(), height()*devicePixelRatio());
DYGL(glViewport(0, 0, width()*devicePixelRatio(), height()*devicePixelRatio()));
paintGL();
f->glFlush();
DYGL(glFlush());
}
} //namespace QtAV

0 comments on commit 593908d

Please sign in to comment.