From eae8fb85997d82ecec0743ba3e470681129bff41 Mon Sep 17 00:00:00 2001 From: Qt by Nokia Date: Wed, 27 Apr 2011 14:13:26 +0200 Subject: Initial import from qtquick2. Branched from the monolithic repo, Qt qtquick2 branch, at commit a4a585d2ee907746682846ae6e8a48e19deef469 --- src/opengl/qgl.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/opengl/qgl.cpp') diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 057fb55e2c..7ce35f8d1c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -43,6 +43,7 @@ #include "qplatformdefs.h" #include "qgl.h" #include +#include #if defined(Q_WS_X11) #include "private/qt_x11_p.h" @@ -1663,6 +1664,7 @@ const QGLContext *qt_gl_transfer_context(const QGLContext *ctx) QGLContextPrivate::QGLContextPrivate(QGLContext *context) : internal_context(false) , q_ptr(context) + , functions(0) { group = new QGLContextGroup(context); texture_destroyer = new QGLTextureDestroyer; @@ -1671,6 +1673,8 @@ QGLContextPrivate::QGLContextPrivate(QGLContext *context) QGLContextPrivate::~QGLContextPrivate() { + delete functions; + if (!group->m_refs.deref()) { Q_ASSERT(group->context() == q_ptr); delete group; @@ -2710,6 +2714,19 @@ int QGLContextPrivate::maxTextureSize() #endif } +/*! + Returns a QGLFunctions object that is initialized for this context. + */ +QGLFunctions *QGLContext::functions() const +{ + QGLContextPrivate *d = const_cast(d_func()); + if (!d->functions) { + d->functions = new QGLFunctions(this); + d->functions->initializeGLFunctions(this); + } + return d->functions; +} + /*! Generates and binds a 2D GL texture to the current context, based on \a image. The generated texture id is returned and can be used in @@ -3792,6 +3809,20 @@ QGLWidget::QGLWidget(QWidget *parent, const QGLWidget* shareWidget, Qt::WindowFl d->init(new QGLContext(QGLFormat::defaultFormat(), this), shareWidget); } +/*! + \internal + */ +QGLWidget::QGLWidget(QGLWidgetPrivate &dd, const QGLFormat &format, QWidget *parent, const QGLWidget *shareWidget, Qt::WindowFlags f) + : QWidget(dd, parent, f | Qt::MSWindowsOwnDC) +{ + Q_D(QGLWidget); + setAttribute(Qt::WA_PaintOnScreen); + setAttribute(Qt::WA_NoSystemBackground); + setAutoFillBackground(true); // for compatibility + d->init(new QGLContext(format, this), shareWidget); + +} + /*! Constructs an OpenGL widget with parent \a parent. -- cgit v1.2.3