diff options
Diffstat (limited to 'src/opengl/qglpixelbuffer.cpp')
-rw-r--r-- | src/opengl/qglpixelbuffer.cpp | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 12b26e5381..4a32a99912 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -89,8 +89,6 @@ Pbuffers are provided by the OpenGL \c pbuffer extension; call hasOpenGLPbuffer() to find out if the system provides pbuffers. - - \sa {Pixel Buffers Example} */ #include <private/qopenglextensions_p.h> @@ -124,7 +122,7 @@ void QGLPBufferGLPaintDevice::beginPaint() void QGLPBufferGLPaintDevice::endPaint() { - glFlush(); + QOpenGLContext::currentContext()->functions()->glFlush(); QGLPaintDevice::endPaint(); } @@ -235,7 +233,7 @@ bool QGLPixelBuffer::makeCurrent() 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()); + QOpenGLContext::currentContext()->functions()->glViewport(0, 0, d->req_size.width(), d->req_size.height()); } return true; } @@ -338,7 +336,7 @@ void QGLPixelBuffer::updateDynamicTexture(GLuint texture_id) const if (d->invalid || !d->fbo) return; - QOpenGLContext *ctx = QOpenGLContext::currentContext(); + const QGLContext *ctx = QGLContext::currentContext(); if (!ctx) return; @@ -352,19 +350,19 @@ void QGLPixelBuffer::updateDynamicTexture(GLuint texture_id) const #define GL_DRAW_FRAMEBUFFER 0x8CA9 #endif - QOpenGLExtensions extensions(ctx); + QOpenGLExtensions extensions(ctx->contextHandle()); if (d->blit_fbo) { QOpenGLFramebufferObject::blitFramebuffer(d->blit_fbo, d->fbo); extensions.glBindFramebuffer(GL_READ_FRAMEBUFFER, d->blit_fbo->handle()); } - glBindTexture(GL_TEXTURE_2D, texture_id); + extensions.glBindTexture(GL_TEXTURE_2D, texture_id); #ifndef QT_OPENGL_ES - GLenum format = ctx->isOpenGLES() ? GL_RGBA : GL_RGBA8; - glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, d->req_size.width(), d->req_size.height(), 0); + GLenum format = ctx->contextHandle()->isOpenGLES() ? GL_RGBA : GL_RGBA8; + extensions.glCopyTexImage2D(GL_TEXTURE_2D, 0, format, 0, 0, d->req_size.width(), d->req_size.height(), 0); #else - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, d->req_size.width(), d->req_size.height(), 0); + extensions.glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, d->req_size.width(), d->req_size.height(), 0); #endif if (d->blit_fbo) @@ -629,17 +627,18 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const } GLuint texture; + QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); - glGenTextures(1, &texture); - glBindTexture(GL_TEXTURE_2D, texture); + funcs->glGenTextures(1, &texture); + funcs->glBindTexture(GL_TEXTURE_2D, texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, d->req_size.width(), d->req_size.height(), 0, - GL_RGBA, GL_UNSIGNED_BYTE, 0); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, d->req_size.width(), d->req_size.height(), 0, + GL_RGBA, GL_UNSIGNED_BYTE, 0); return texture; } |