summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp1
-rw-r--r--src/opengl/qgl.cpp51
-rw-r--r--src/opengl/qgl_p.h1
3 files changed, 10 insertions, 43 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index c1e39a7..e654f25 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -246,6 +246,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height)
#ifdef QT_OPENGL_ES_2
QDataBuffer<uchar> buffer(4*oldWidth*oldHeight);
+ buffer.resize(4*oldWidth*oldHeight);
glReadPixels(0, 0, oldWidth, oldHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer.data());
// do an in-place conversion from GL_RGBA to GL_ALPHA
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index e031fb5..d3c0bf1 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1302,7 +1302,6 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format)
#if defined(QT_OPENGL_ES)
eglContext = 0;
#endif
- pbo = 0;
fbo = 0;
crWin = false;
initDone = false;
@@ -1646,12 +1645,6 @@ QGLContext::~QGLContext()
void QGLContextPrivate::cleanup()
{
- Q_Q(QGLContext);
- if (pbo) {
- QGLContext *ctx = q;
- glDeleteBuffers(1, &pbo);
- pbo = 0;
- }
}
typedef QHash<QString, GLuint> QGLDDSCache;
@@ -1915,14 +1908,6 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
QGLContext *ctx = q;
- bool use_pbo = false;
- if (QGLExtensions::glExtensions & QGLExtensions::PixelBufferObject) {
-
- use_pbo = qt_resolve_buffer_extensions(ctx);
- if (use_pbo && pbo == 0)
- glGenBuffers(1, &pbo);
- }
-
// the GL_BGRA format is only present in GL version >= 1.2
GLenum texture_format = (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2)
? GL_BGRA : GL_RGBA;
@@ -1957,20 +1942,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
glTexParameterf(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
#endif
glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
-
- // Mipmap generation causes huge slowdown with PBO's for some reason
- use_pbo = false;
} else {
glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
- uchar *ptr = 0;
- if (use_pbo) {
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
- glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, img.width() * img.height() * 4, 0, GL_STREAM_DRAW_ARB);
- ptr = reinterpret_cast<uchar *>(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB));
- }
-
QImage::Format target_format = img.format();
// Note: the clean param is only true when a texture is bound
// from the QOpenGLPaintEngine - in that case we have to force
@@ -1980,21 +1955,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
if (img.format() != target_format)
img = img.convertToFormat(target_format);
- if (ptr) {
- QImage buffer(ptr, img.width(), img.height(), target_format);
- convertToGLFormatHelper(buffer, img, texture_format);
- glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);
- glTexImage2D(target, 0, format, img.width(), img.height(), 0, texture_format,
- GL_UNSIGNED_BYTE, 0);
- } else {
- QImage tx(scale ? QSize(tx_w, tx_h) : img.size(), target_format);
- convertToGLFormatHelper(tx, img, texture_format);
- glTexImage2D(target, 0, format, tx.width(), tx.height(), 0, texture_format,
- GL_UNSIGNED_BYTE, tx.bits());
- }
-
- if (use_pbo)
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
+ QImage tx(scale ? QSize(tx_w, tx_h) : img.size(), target_format);
+ convertToGLFormatHelper(tx, img, texture_format);
+ glTexImage2D(target, 0, format, tx.width(), tx.height(), 0, texture_format,
+ GL_UNSIGNED_BYTE, tx.bits());
// this assumes the size of a texture is always smaller than the max cache size
int cost = img.width()*img.height()*4/1024;
@@ -3409,12 +3373,15 @@ bool QGLWidget::event(QEvent *e)
setContext(new QGLContext(d->glcx->requestedFormat(), this));
// ### recreating the overlay isn't supported atm
}
+ }
+
#if defined(QT_OPENGL_ES)
- // The window may have been re-created during re-parent - if so, the EGL
+ if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) {
+ // The window may have been re-created during re-parent or state change - if so, the EGL
// surface will need to be re-created.
d->recreateEglSurface(false);
-#endif
}
+#endif
#elif defined(Q_WS_WIN)
if (e->type() == QEvent::ParentChange) {
QGLContext *newContext = new QGLContext(d->glcx->requestedFormat(), this);
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 92aea6c..ab040ed 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -252,7 +252,6 @@ public:
#endif
QGLFormat glFormat;
QGLFormat reqFormat;
- GLuint pbo;
GLuint fbo;
uint valid : 1;