src/opengl/qglframebufferobject.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
  1022     return engine;
  1022     return engine;
  1023 #endif
  1023 #endif
  1024 }
  1024 }
  1025 
  1025 
  1026 /*!
  1026 /*!
       
  1027     \fn bool QGLFramebufferObject::bindDefault()
       
  1028     \internal
       
  1029 
       
  1030     Switches rendering back to the default, windowing system provided
       
  1031     framebuffer.
       
  1032     Returns true upon success, false otherwise.
       
  1033 
       
  1034     \sa bind(), release()
       
  1035 */
       
  1036 bool QGLFramebufferObject::bindDefault()
       
  1037 {
       
  1038     QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
       
  1039 
       
  1040     if (ctx) {
       
  1041         bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
       
  1042         if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx)))
       
  1043             return false;
       
  1044 
       
  1045         ctx->d_ptr->current_fbo = ctx->d_ptr->default_fbo;
       
  1046         glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->default_fbo);
       
  1047 #ifdef QT_DEBUG
       
  1048     } else {
       
  1049         qWarning("QGLFramebufferObject::bindDefault() called without current context.");
       
  1050 #endif
       
  1051     }
       
  1052 
       
  1053     return ctx != 0;
       
  1054 }
       
  1055 
       
  1056 /*!
  1027     \fn bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
  1057     \fn bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
  1028 
  1058 
  1029     Returns true if the OpenGL \c{GL_EXT_framebuffer_object} extension
  1059     Returns true if the OpenGL \c{GL_EXT_framebuffer_object} extension
  1030     is present on this system; otherwise returns false.
  1060     is present on this system; otherwise returns false.
  1031 */
  1061 */