summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-21 12:39:29 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-21 12:39:29 (GMT)
commite59ee48a8656d04339967ad99334bd0ddca0c956 (patch)
tree4fe72429115ae4a4171cd3f1f06d9a3a425973d0 /src/opengl/qgl.cpp
parent4aa6869877d4906fcfaac5388294748512cace25 (diff)
parent508b447075fb852e61ddf88c92c9099dad292747 (diff)
downloadQt-e59ee48a8656d04339967ad99334bd0ddca0c956.zip
Qt-e59ee48a8656d04339967ad99334bd0ddca0c956.tar.gz
Qt-e59ee48a8656d04339967ad99334bd0ddca0c956.tar.bz2
Merge commit 'qt/master'
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp51
1 files changed, 9 insertions, 42 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index f2a14d6..70a35b2 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;
@@ -1645,12 +1644,6 @@ QGLContext::~QGLContext()
void QGLContextPrivate::cleanup()
{
- Q_Q(QGLContext);
- if (pbo) {
- QGLContext *ctx = q;
- glDeleteBuffers(1, &pbo);
- pbo = 0;
- }
}
typedef QHash<QString, GLuint> QGLDDSCache;
@@ -1914,14 +1907,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;
@@ -1956,20 +1941,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
@@ -1979,21 +1954,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;
@@ -3408,12 +3372,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);