src/opengl/qglframebufferobject.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
child 30 5dc02b23752f
--- a/src/opengl/qglframebufferobject.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/opengl/qglframebufferobject.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -329,6 +329,13 @@
     } else if (attachment == QGLFramebufferObject::Depth) {
         fboFormat.setDepth(true);
     }
+
+    GLenum format = f->format().internalTextureFormat();
+    reqAlpha = (format != GL_RGB
+#ifndef QT_OPENGL_ES
+                && format != GL_RGB5 && format != GL_RGB8
+#endif
+    );
 }
 
 QGLContext *QGLFBOGLPaintDevice::context() const
@@ -396,7 +403,7 @@
     QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
     fbo_guard.setContext(ctx);
 
-    bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
+    bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
     if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx)))
         return;
 
@@ -466,7 +473,7 @@
     }
 
     if (attachment == QGLFramebufferObject::CombinedDepthStencil
-        && (QGLExtensions::glExtensions & QGLExtensions::PackedDepthStencil)) {
+        && (QGLExtensions::glExtensions() & QGLExtensions::PackedDepthStencil)) {
         // depth and stencil buffer needs another extension
         glGenRenderbuffers(1, &depth_stencil_buffer);
         Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer));
@@ -1028,8 +1035,7 @@
 */
 bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
 {
-    QGLExtensions::init();
-    return (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
+    return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
 }
 
 /*!
@@ -1188,8 +1194,7 @@
 */
 bool QGLFramebufferObject::hasOpenGLFramebufferBlit()
 {
-    QGLExtensions::init();
-    return (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit);
+    return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit);
 }
 
 /*!
@@ -1229,7 +1234,7 @@
                                            GLbitfield buffers,
                                            GLenum filter)
 {
-    if (!(QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit))
+    if (!(QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit))
         return;
 
     const QGLContext *ctx = QGLContext::currentContext();