summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-05-04 12:04:43 +0200
committerLars Knoll <lars.knoll@nokia.com>2011-05-04 12:04:43 +0200
commit1077edd108129a628195708c787c3922d2270c37 (patch)
tree1346bb4e46562b6d6fba22c7e81efa30470044bb /src/opengl/qgl.cpp
parent0e3823d30c2294eb11c205ca11fca55508478151 (diff)
parentc41153e69336701488385d9194d72e72164b28b8 (diff)
Merge remote branch 'origin/master' into refactor
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 64e711fe00..f64c24b503 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -43,6 +43,7 @@
#include "qplatformdefs.h"
#include "qgl.h"
#include <qdebug.h>
+#include <qglfunctions.h>
#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;
@@ -2711,6 +2715,19 @@ int QGLContextPrivate::maxTextureSize()
}
/*!
+ Returns a QGLFunctions object that is initialized for this context.
+ */
+QGLFunctions *QGLContext::functions() const
+{
+ QGLContextPrivate *d = const_cast<QGLContextPrivate *>(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
later \c glBindTexture() calls.
@@ -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.
@@ -5490,6 +5521,13 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions()
if (extensions.match("GL_EXT_bgra"))
glExtensions |= BGRATextureFormat;
+ {
+ GLboolean srgbCapableFramebuffers;
+ glGetBooleanv(FRAMEBUFFER_SRGB_CAPABLE_EXT, &srgbCapableFramebuffers);
+ if (srgbCapableFramebuffers)
+ glExtensions |= SRGBFrameBuffer;
+ }
+
return glExtensions;
}