diff options
Diffstat (limited to 'src/opengl/qglpixelbuffer.cpp')
-rw-r--r-- | src/opengl/qglpixelbuffer.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index a5e748a1e7..dd13ef24eb 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -100,6 +100,7 @@ #include "gl2paintengineex/qpaintengineex_opengl2_p.h" +#include <qglframebufferobject.h> #include <qglpixelbuffer.h> #include <private/qglpixelbuffer_p.h> #include <private/qfont_p.h> @@ -115,11 +116,23 @@ QGLContext* QGLPBufferGLPaintDevice::context() const return pbuf->d_func()->qctx; } -void QGLPBufferGLPaintDevice::endPaint() { +void QGLPBufferGLPaintDevice::beginPaint() +{ + pbuf->makeCurrent(); + QGLPaintDevice::beginPaint(); +} + +void QGLPBufferGLPaintDevice::endPaint() +{ glFlush(); QGLPaintDevice::endPaint(); } +void QGLPBufferGLPaintDevice::setFbo(GLuint fbo) +{ + m_thisFBO = fbo; +} + void QGLPBufferGLPaintDevice::setPBuffer(QGLPixelBuffer* pb) { pbuf = pb; @@ -221,6 +234,7 @@ bool QGLPixelBuffer::makeCurrent() format.setSamples(d->req_format.samples()); d->fbo = new QOpenGLFramebufferObject(d->req_size, format); d->fbo->bind(); + d->glDevice.setFbo(d->fbo->handle()); glViewport(0, 0, d->req_size.width(), d->req_size.height()); } return true; @@ -242,6 +256,15 @@ bool QGLPixelBuffer::doneCurrent() } /*! + Returns the context of this pixelbuffer. +*/ +QGLContext *QGLPixelBuffer::context() const +{ + Q_D(const QGLPixelBuffer); + return d->qctx; +} + +/*! \fn GLuint QGLPixelBuffer::generateDynamicTexture() const Generates and binds a 2D GL texture that is the same size as the @@ -366,6 +389,8 @@ QImage QGLPixelBuffer::toImage() const return QImage(); const_cast<QGLPixelBuffer *>(this)->makeCurrent(); + if (d->fbo) + d->fbo->bind(); return qt_gl_read_framebuffer(d->req_size, d->format.alpha(), true); } @@ -615,7 +640,7 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const bool QGLPixelBuffer::hasOpenGLPbuffers() { - return QOpenGLFramebufferObject::hasOpenGLFramebufferObjects(); + return QGLFramebufferObject::hasOpenGLFramebufferObjects(); } QT_END_NAMESPACE |