summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglframebufferobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qglframebufferobject.cpp')
-rw-r--r--src/opengl/qglframebufferobject.cpp116
1 files changed, 7 insertions, 109 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 682c26255d..f35f6e513d 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -45,13 +45,7 @@
#include <qdebug.h>
#include <private/qgl_p.h>
#include <private/qfont_p.h>
-#if !defined(QT_OPENGL_ES_1)
#include <private/qpaintengineex_opengl2_p.h>
-#endif
-
-#ifndef QT_OPENGL_ES_2
-#include <private/qpaintengine_opengl_p.h>
-#endif
#include <qglframebufferobject.h>
#include <qlibrary.h>
@@ -306,22 +300,6 @@ GLenum QGLFramebufferObjectFormat::internalTextureFormat() const
return d->internal_format;
}
-#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
-/*! \internal */
-void QGLFramebufferObjectFormat::setTextureTarget(QMacCompatGLenum target)
-{
- detach();
- d->target = target;
-}
-
-/*! \internal */
-void QGLFramebufferObjectFormat::setInternalTextureFormat(QMacCompatGLenum internalTextureFormat)
-{
- detach();
- d->internal_format = internalTextureFormat;
-}
-#endif
-
/*!
Returns true if all the options of this framebuffer object format
are the same as \a other; otherwise returns false.
@@ -720,8 +698,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
As of Qt 4.8, it's possible to draw into a QGLFramebufferObject
using a QPainter in a separate thread. Note that OpenGL 2.0 or
- OpenGL ES 2.0 is required for this to work. Also, under X11, it's
- necessary to set the Qt::AA_X11InitThreads application attribute.
+ OpenGL ES 2.0 is required for this to work.
\sa {Framebuffer Object Example}
*/
@@ -780,16 +757,6 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, GLenum target)
d->init(this, size, NoAttachment, target, DEFAULT_FORMAT);
}
-#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
-/*! \internal */
-QGLFramebufferObject::QGLFramebufferObject(const QSize &size, QMacCompatGLenum target)
- : d_ptr(new QGLFramebufferObjectPrivate)
-{
- Q_D(QGLFramebufferObject);
- d->init(this, size, NoAttachment, target, DEFAULT_FORMAT);
-}
-#endif
-
/*! \overload
Constructs an OpenGL framebuffer object and binds a 2D GL texture
@@ -832,16 +799,6 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, const QGLFrame
format.internalTextureFormat(), format.samples(), format.mipmap());
}
-#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
-/*! \internal */
-QGLFramebufferObject::QGLFramebufferObject(int width, int height, QMacCompatGLenum target)
- : d_ptr(new QGLFramebufferObjectPrivate)
-{
- Q_D(QGLFramebufferObject);
- d->init(this, QSize(width, height), NoAttachment, target, DEFAULT_FORMAT);
-}
-#endif
-
/*! \overload
Constructs an OpenGL framebuffer object and binds a texture to the
@@ -863,17 +820,6 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment att
d->init(this, QSize(width, height), attachment, target, internal_format);
}
-#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
-/*! \internal */
-QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment attachment,
- QMacCompatGLenum target, QMacCompatGLenum internal_format)
- : d_ptr(new QGLFramebufferObjectPrivate)
-{
- Q_D(QGLFramebufferObject);
- d->init(this, QSize(width, height), attachment, target, internal_format);
-}
-#endif
-
/*! \overload
Constructs an OpenGL framebuffer object and binds a texture to the
@@ -895,17 +841,6 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachm
d->init(this, size, attachment, target, internal_format);
}
-#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
-/*! \internal */
-QGLFramebufferObject::QGLFramebufferObject(const QSize &size, Attachment attachment,
- QMacCompatGLenum target, QMacCompatGLenum internal_format)
- : d_ptr(new QGLFramebufferObjectPrivate)
-{
- Q_D(QGLFramebufferObject);
- d->init(this, size, attachment, target, internal_format);
-}
-#endif
-
/*!
\fn QGLFramebufferObject::~QGLFramebufferObject()
@@ -1092,13 +1027,7 @@ QImage QGLFramebufferObject::toImage() const
return image;
}
-#if !defined(QT_OPENGL_ES_1)
Q_GLOBAL_STATIC(QGLEngineThreadStorage<QGL2PaintEngineEx>, qt_buffer_2_engine)
-#endif
-
-#ifndef QT_OPENGL_ES_2
-Q_GLOBAL_STATIC(QGLEngineThreadStorage<QOpenGLPaintEngine>, qt_buffer_engine)
-#endif
/*! \reimp */
QPaintEngine *QGLFramebufferObject::paintEngine() const
@@ -1107,29 +1036,12 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const
if (d->engine)
return d->engine;
-#if !defined(QT_OPENGL_ES_1)
-#if !defined (QT_OPENGL_ES_2)
- if (qt_gl_preferGL2Engine()) {
-#endif
- QPaintEngine *engine = qt_buffer_2_engine()->engine();
- if (engine->isActive() && engine->paintDevice() != this) {
- d->engine = new QGL2PaintEngineEx;
- return d->engine;
- }
- return engine;
-#if !defined (QT_OPENGL_ES_2)
- }
-#endif
-#endif
-
-#if !defined(QT_OPENGL_ES_2)
- QPaintEngine *engine = qt_buffer_engine()->engine();
+ QPaintEngine *engine = qt_buffer_2_engine()->engine();
if (engine->isActive() && engine->paintDevice() != this) {
- d->engine = new QOpenGLPaintEngine;
+ d->engine = new QGL2PaintEngineEx;
return d->engine;
}
return engine;
-#endif
}
/*!
@@ -1189,14 +1101,6 @@ void QGLFramebufferObject::drawTexture(const QRectF &target, GLuint textureId, G
const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget);
}
-#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
-/*! \internal */
-void QGLFramebufferObject::drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget)
-{
- const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(target, textureId, textureTarget);
-}
-#endif
-
/*!
\since 4.4
@@ -1212,14 +1116,6 @@ void QGLFramebufferObject::drawTexture(const QPointF &point, GLuint textureId, G
const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget);
}
-#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
-/*! \internal */
-void QGLFramebufferObject::drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget)
-{
- const_cast<QGLContext *>(QGLContext::currentContext())->drawTexture(point, textureId, textureTarget);
-}
-#endif
-
/*! \reimp */
int QGLFramebufferObject::metric(PaintDeviceMetric metric) const
{
@@ -1370,10 +1266,12 @@ void QGLFramebufferObject::blitFramebuffer(QGLFramebufferObject *target, const Q
return;
const QGLContext *ctx = QGLContext::currentContext();
- if (!ctx)
+ if (!ctx || !ctx->contextHandle())
return;
- const int height = ctx->device()->height();
+ QSurface *surface = ctx->contextHandle()->surface();
+
+ const int height = static_cast<QWindow *>(surface)->height();
const int sh = source ? source->height() : height;
const int th = target ? target->height() : height;