summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-03-19 09:07:26 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-04-16 08:50:48 (GMT)
commit1e1371e19ae62a5bf57dcad8d53ac70dcd2ad0cb (patch)
tree2cc243dd3c4ed1589411baf9931a618b3cd45b20 /src/opengl
parentb1c0c0bf169d4ab83ce6e9b1b333e99610aa6f6d (diff)
downloadQt-1e1371e19ae62a5bf57dcad8d53ac70dcd2ad0cb.zip
Qt-1e1371e19ae62a5bf57dcad8d53ac70dcd2ad0cb.tar.gz
Qt-1e1371e19ae62a5bf57dcad8d53ac70dcd2ad0cb.tar.bz2
Make FBO the default instead of pixel buffers in GL window surface.
Fall back to using pbuffers only if the FBO fails.
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qwindowsurface_gl.cpp57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index bed08cf..c9d23d1 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -493,6 +493,35 @@ void QGLWindowSurface::updateGeometry()
return;
}
+ if ((QGLExtensions::glExtensions & QGLExtensions::FramebufferObject) && (d_ptr->fbo || !d_ptr->tried_fbo)) {
+ d_ptr->tried_fbo = true;
+ hijackWindow(window());
+ QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext);
+ ctx->d_ptr->internal_context = true;
+ ctx->makeCurrent();
+ delete d_ptr->fbo;
+
+ QGLFramebufferObjectFormat format;
+ format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+ format.setInternalFormat(GL_RGBA);
+ format.setTextureTarget(target);
+
+ if (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit)
+ format.setSamples(8);
+
+ d_ptr->fbo = new QGLFramebufferObject(rect.size(), format);
+ d_ptr->fbo->bind();
+ if (d_ptr->fbo->isValid()) {
+ qDebug() << "Created Window Surface FBO" << rect.size()
+ << "with samples" << d_ptr->fbo->format().samples();
+ return;
+ } else {
+ qDebug() << "QGLWindowSurface: Failed to create valid FBO, falling back";
+ delete d_ptr->fbo;
+ d_ptr->fbo = 0;
+ }
+ }
+
if (d_ptr->pb || !d_ptr->tried_pb) {
d_ptr->tried_pb = true;
@@ -536,34 +565,6 @@ void QGLWindowSurface::updateGeometry()
}
}
- if ((QGLExtensions::glExtensions & QGLExtensions::FramebufferObject) && (d_ptr->fbo || !d_ptr->tried_fbo)) {
- d_ptr->tried_fbo = true;
- hijackWindow(window());
- QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext);
- ctx->d_ptr->internal_context = true;
- ctx->makeCurrent();
- delete d_ptr->fbo;
-
- QGLFramebufferObjectFormat format;
- format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
- format.setInternalFormat(GL_RGBA);
- format.setTextureTarget(target);
-
- if (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit)
- format.setSamples(8);
-
- d_ptr->fbo = new QGLFramebufferObject(rect.size(), format);
- d_ptr->fbo->bind();
- if (d_ptr->fbo->isValid()) {
- qDebug() << "Created Window Surface FBO" << rect.size()
- << "with samples" << d_ptr->fbo->format().samples();
- return;
- } else {
- qDebug() << "QGLWindowSurface: Failed to create valid FBO, falling back";
- delete d_ptr->fbo;
- d_ptr->fbo = 0;
- }
- }
hijackWindow(window());
QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext);