src/opengl/qglframebufferobject.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 7 3f74d0d4af4c
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtOpenGL module of the Qt Toolkit.
     7 ** This file is part of the QtOpenGL module of the Qt Toolkit.
     8 **
     8 **
   394                                        GLenum texture_target, GLenum internal_format, GLint samples)
   394                                        GLenum texture_target, GLenum internal_format, GLint samples)
   395 {
   395 {
   396     QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
   396     QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
   397     fbo_guard.setContext(ctx);
   397     fbo_guard.setContext(ctx);
   398 
   398 
   399     bool ext_detected = (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
   399     bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
   400     if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx)))
   400     if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx)))
   401         return;
   401         return;
   402 
   402 
   403     size = sz;
   403     size = sz;
   404     target = texture_target;
   404     target = texture_target;
   464         if (valid)
   464         if (valid)
   465             glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT, &samples);
   465             glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_SAMPLES_EXT, &samples);
   466     }
   466     }
   467 
   467 
   468     if (attachment == QGLFramebufferObject::CombinedDepthStencil
   468     if (attachment == QGLFramebufferObject::CombinedDepthStencil
   469         && (QGLExtensions::glExtensions & QGLExtensions::PackedDepthStencil)) {
   469         && (QGLExtensions::glExtensions() & QGLExtensions::PackedDepthStencil)) {
   470         // depth and stencil buffer needs another extension
   470         // depth and stencil buffer needs another extension
   471         glGenRenderbuffers(1, &depth_stencil_buffer);
   471         glGenRenderbuffers(1, &depth_stencil_buffer);
   472         Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer));
   472         Q_ASSERT(!glIsRenderbuffer(depth_stencil_buffer));
   473         glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_stencil_buffer);
   473         glBindRenderbuffer(GL_RENDERBUFFER_EXT, depth_stencil_buffer);
   474         Q_ASSERT(glIsRenderbuffer(depth_stencil_buffer));
   474         Q_ASSERT(glIsRenderbuffer(depth_stencil_buffer));
  1026     Returns true if the OpenGL \c{GL_EXT_framebuffer_object} extension
  1026     Returns true if the OpenGL \c{GL_EXT_framebuffer_object} extension
  1027     is present on this system; otherwise returns false.
  1027     is present on this system; otherwise returns false.
  1028 */
  1028 */
  1029 bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
  1029 bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
  1030 {
  1030 {
  1031     QGLExtensions::init();
  1031     return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
  1032     return (QGLExtensions::glExtensions & QGLExtensions::FramebufferObject);
       
  1033 }
  1032 }
  1034 
  1033 
  1035 /*!
  1034 /*!
  1036     \since 4.4
  1035     \since 4.4
  1037 
  1036 
  1186 
  1185 
  1187     \sa blitFramebuffer()
  1186     \sa blitFramebuffer()
  1188 */
  1187 */
  1189 bool QGLFramebufferObject::hasOpenGLFramebufferBlit()
  1188 bool QGLFramebufferObject::hasOpenGLFramebufferBlit()
  1190 {
  1189 {
  1191     QGLExtensions::init();
  1190     return (QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit);
  1192     return (QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit);
       
  1193 }
  1191 }
  1194 
  1192 
  1195 /*!
  1193 /*!
  1196     \since 4.6
  1194     \since 4.6
  1197 
  1195 
  1227 void QGLFramebufferObject::blitFramebuffer(QGLFramebufferObject *target, const QRect &targetRect,
  1225 void QGLFramebufferObject::blitFramebuffer(QGLFramebufferObject *target, const QRect &targetRect,
  1228                                            QGLFramebufferObject *source, const QRect &sourceRect,
  1226                                            QGLFramebufferObject *source, const QRect &sourceRect,
  1229                                            GLbitfield buffers,
  1227                                            GLbitfield buffers,
  1230                                            GLenum filter)
  1228                                            GLenum filter)
  1231 {
  1229 {
  1232     if (!(QGLExtensions::glExtensions & QGLExtensions::FramebufferBlit))
  1230     if (!(QGLExtensions::glExtensions() & QGLExtensions::FramebufferBlit))
  1233         return;
  1231         return;
  1234 
  1232 
  1235     const QGLContext *ctx = QGLContext::currentContext();
  1233     const QGLContext *ctx = QGLContext::currentContext();
  1236     if (!ctx)
  1234     if (!ctx)
  1237         return;
  1235         return;