Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 2054

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qglframebufferobject.cpp -->
  <title>QGLFramebufferObject Class | Qt OpenGL</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtopengl-index.html">Qt OpenGL</a></td><td ><a href="qtopengl-module.html">C++ Classes</a></td><td >QGLFramebufferObject</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#threading">Threading</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QGLFramebufferObject Class</h1>
<!-- $$$QGLFramebufferObject-brief -->
<p>The <a href="qglframebufferobject.html">QGLFramebufferObject</a> class encapsulates an OpenGL framebuffer object. <a href="#details">More...</a></p>
<!-- @@@QGLFramebufferObject -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QGLFramebufferObject&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += opengl</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.2</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtgui/qpaintdevice.html">QPaintDevice</a></td></tr></table></div><p><b>This class is obsolete.</b> It is provided to keep old source code working. We strongly advise against using it in new code.</p>
<ul>
<li><a href="qglframebufferobject-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#Attachment-enum">Attachment</a></b> { NoAttachment, CombinedDepthStencil, Depth }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#QGLFramebufferObject">QGLFramebufferObject</a></b>(const QSize &amp;<i>size</i>, GLenum <i>target</i> = GL_TEXTURE_2D)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#QGLFramebufferObject-1">QGLFramebufferObject</a></b>(int <i>width</i>, int <i>height</i>, GLenum <i>target</i> = GL_TEXTURE_2D)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#QGLFramebufferObject-2">QGLFramebufferObject</a></b>(const QSize &amp;<i>size</i>, Attachment <i>attachment</i>, GLenum <i>target</i> = GL_TEXTURE_2D, GLenum <i>internal_format</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#QGLFramebufferObject-3">QGLFramebufferObject</a></b>(int <i>width</i>, int <i>height</i>, Attachment <i>attachment</i>, GLenum <i>target</i> = GL_TEXTURE_2D, GLenum <i>internal_format</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#QGLFramebufferObject-4">QGLFramebufferObject</a></b>(const QSize &amp;<i>size</i>, const QGLFramebufferObjectFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#QGLFramebufferObject-5">QGLFramebufferObject</a></b>(int <i>width</i>, int <i>height</i>, const QGLFramebufferObjectFormat &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#dtor.QGLFramebufferObject">~QGLFramebufferObject</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Attachment </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#attachment">attachment</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#bind">bind</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#drawTexture">drawTexture</a></b>(const QRectF &amp;<i>target</i>, GLuint <i>textureId</i>, GLenum <i>textureTarget</i> = GL_TEXTURE_2D)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#drawTexture-1">drawTexture</a></b>(const QPointF &amp;<i>point</i>, GLuint <i>textureId</i>, GLenum <i>textureTarget</i> = GL_TEXTURE_2D)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QGLFramebufferObjectFormat </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#format">format</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> GLuint </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#handle">handle</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#isBound">isBound</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#release">release</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#size">size</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> GLuint </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#texture">texture</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QImage </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#toImage">toImage</a></b>() const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QPaintEngine *</td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#paintEngine">paintEngine</a></b>() const</td></tr>
</table></div>
<ul>
<li class="fn">14 public functions inherited from <a href="../qtgui/qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#bindDefault">bindDefault</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#blitFramebuffer">blitFramebuffer</a></b>(QGLFramebufferObject *<i>target</i>, const QRect &amp;<i>targetRect</i>, QGLFramebufferObject *<i>source</i>, const QRect &amp;<i>sourceRect</i>, GLbitfield <i>buffers</i> = GL_COLOR_BUFFER_BIT, GLenum <i>filter</i> = GL_NEAREST)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#hasOpenGLFramebufferBlit">hasOpenGLFramebufferBlit</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#hasOpenGLFramebufferObjects">hasOpenGLFramebufferObjects</a></b>()</td></tr>
</table></div>
<a name="reimplemented-protected-functions"></a>
<h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qglframebufferobject.html#metric">metric</a></b>(PaintDeviceMetric <i>metric</i>) const</td></tr>
</table></div>
<ul>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">1 protected function inherited from <a href="../qtgui/qpaintdevice.html#protected-functions">QPaintDevice</a></li>
<li class="fn">1 protected type inherited from <a href="../qtgui/qpaintdevice.html#protected-variables">QPaintDevice</a></li>
</ul>
<a name="details"></a>
<!-- $$$QGLFramebufferObject-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qglframebufferobject.html">QGLFramebufferObject</a> class encapsulates an OpenGL framebuffer object.</p>
<p>The <a href="qglframebufferobject.html">QGLFramebufferObject</a> class encapsulates an OpenGL framebuffer object, defined by the <code>GL_EXT_framebuffer_object</code> extension. In addition it provides a rendering surface that can be painted on with a <a href="../qtgui/qpainter.html">QPainter</a>, rendered to using native GL calls, or both. This surface can be bound and used as a regular texture in your own GL drawing code. By default, the <a href="qglframebufferobject.html">QGLFramebufferObject</a> class generates a 2D GL texture (using the <code>GL_TEXTURE_2D</code> target), which is used as the internal rendering target.</p>
<p><b>It is important to have a current GL context when creating a <a href="qglframebufferobject.html">QGLFramebufferObject</a>, otherwise initialization will fail.</b></p>
<p>OpenGL framebuffer objects and pbuffers (see <a href="qglpixelbuffer.html">QGLPixelBuffer</a>) can both be used to render to offscreen surfaces, but there are a number of advantages with using framebuffer objects instead of pbuffers:</p>
<ol class="1" type="1"><li>A framebuffer object does not require a separate rendering context, so no context switching will occur when switching rendering targets. There is an overhead involved in switching targets, but in general it is cheaper than a context switch to a pbuffer.</li>
<li>Rendering to dynamic textures (i.e&#x2e; render-to-texture functionality) works on all platforms. No need to do explicit copy calls from a render buffer into a texture, as was necessary on systems that did not support the <code>render_texture</code> extension.</li>
<li>It is possible to attach several rendering buffers (or texture objects) to the same framebuffer object, and render to all of them without doing a context switch.</li>
<li>The OpenGL framebuffer extension is a pure GL extension with no system dependant WGL, CGL, or GLX parts. This makes using framebuffer objects more portable.</li>
</ol>
<p>When using a <a href="../qtgui/qpainter.html">QPainter</a> to paint to a <a href="qglframebufferobject.html">QGLFramebufferObject</a> you should take care that the <a href="qglframebufferobject.html">QGLFramebufferObject</a> is created with the <a href="qglframebufferobject.html#Attachment-enum">CombinedDepthStencil</a> attachment for <a href="../qtgui/qpainter.html">QPainter</a> to be able to render correctly. Note that you need to create a <a href="qglframebufferobject.html">QGLFramebufferObject</a> with more than one sample per pixel for primitives to be antialiased when drawing using a <a href="../qtgui/qpainter.html">QPainter</a>. To create a multisample framebuffer object you should use one of the constructors that take a <a href="qglframebufferobjectformat.html">QGLFramebufferObjectFormat</a> parameter, and set the <a href="qglframebufferobjectformat.html#samples">QGLFramebufferObjectFormat::samples</a>() property to a non-zero value.</p>
<p>When painting to a <a href="qglframebufferobject.html">QGLFramebufferObject</a> using <a href="../qtgui/qpainter.html">QPainter</a>, the state of the current GL context will be altered by the paint engine to reflect its needs. Applications should not rely upon the GL state being reset to its original conditions, particularly the current shader program, GL viewport, texture units, and drawing modes.</p>
<p>For multisample framebuffer objects a color render buffer is created, otherwise a texture with the specified texture target is created. The color render buffer or texture will have the specified internal format, and will be bound to the <code>GL_COLOR_ATTACHMENT0</code> attachment in the framebuffer object.</p>
<p>If you want to use a framebuffer object with multisampling enabled as a texture, you first need to copy from it to a regular framebuffer object using QGLContext::blitFramebuffer().</p>
<a name="threading"></a>
<h3 >Threading</h3>
<p>As of Qt 4.8, it's possible to draw into a <a href="qglframebufferobject.html">QGLFramebufferObject</a> using a <a href="../qtgui/qpainter.html">QPainter</a> in a separate thread. Note that OpenGL 2.0 or OpenGL ES 2.0 is required for this to work.</p>
<p><b>Note: </b>This class has been deprecated in favor of <a href="../qtgui/qopenglframebufferobject.html">QOpenGLFramebufferObject</a>.</p></div>
<!-- @@@QGLFramebufferObject -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Attachment$$$NoAttachment$$$CombinedDepthStencil$$$Depth -->
<h3 class="fn" id="Attachment-enum"><a name="Attachment-enum"></a>enum QGLFramebufferObject::<span class="name">Attachment</span></h3>
<p>This enum type is used to configure the depth and stencil buffers attached to the framebuffer object when it is created.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QGLFramebufferObject::NoAttachment</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No attachment is added to the framebuffer object. Note that the OpenGL depth and stencil tests won't work when rendering to a framebuffer object without any depth or stencil buffers. This is the default value.</td></tr>
<tr><td class="topAlign"><code>QGLFramebufferObject::CombinedDepthStencil</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">If the <code>GL_EXT_packed_depth_stencil</code> extension is present, a combined depth and stencil buffer is attached. If the extension is not present, only a depth buffer is attached.</td></tr>
<tr><td class="topAlign"><code>QGLFramebufferObject::Depth</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">A depth buffer is attached to the framebuffer object.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 4.3.</p>
<p><b>See also </b><a href="qglframebufferobject.html#attachment">attachment</a>().</p>
<!-- @@@Attachment -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QGLFramebufferObject[overload1]$$$QGLFramebufferObjectconstQSize&GLenum -->
<h3 class="fn" id="QGLFramebufferObject"><a name="QGLFramebufferObject"></a>QGLFramebufferObject::<span class="name">QGLFramebufferObject</span>(const <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> &amp;<i>size</i>, <span class="type">GLenum</span> <i>target</i> = GL_TEXTURE_2D)</h3>
<p>Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size <i>size</i>. The texture is bound to the <code>GL_COLOR_ATTACHMENT0</code> target in the framebuffer object.</p>
<p>The <i>target</i> parameter is used to specify the GL texture target. The default target is <code>GL_TEXTURE_2D</code>. Keep in mind that <code>GL_TEXTURE_2D</code> textures must have a power of 2 width and height (e.g&#x2e; 256x512), unless you are using OpenGL 2.0 or higher.</p>
<p>By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.</p>
<p>The default internal texture format is <code>GL_RGBA8</code> for desktop OpenGL, and <code>GL_RGBA</code> for OpenGL/ES.</p>
<p>It is important that you have a current GL context set when creating the <a href="qglframebufferobject.html" class="obsolete">QGLFramebufferObject</a>, otherwise the initialization will fail.</p>
<p><b>See also </b><a href="qglframebufferobject.html#size">size</a>(), <a href="qglframebufferobject.html#texture">texture</a>(), and <a href="qglframebufferobject.html#attachment">attachment</a>().</p>
<!-- @@@QGLFramebufferObject -->
<!-- $$$QGLFramebufferObject$$$QGLFramebufferObjectintintGLenum -->
<h3 class="fn" id="QGLFramebufferObject-1"><a name="QGLFramebufferObject-1"></a>QGLFramebufferObject::<span class="name">QGLFramebufferObject</span>(<span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type">GLenum</span> <i>target</i> = GL_TEXTURE_2D)</h3>
<p>This is an overloaded function.</p>
<p>Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the given <i>width</i> and <i>height</i>.</p>
<p><b>See also </b><a href="qglframebufferobject.html#size">size</a>() and <a href="qglframebufferobject.html#texture">texture</a>().</p>
<!-- @@@QGLFramebufferObject -->
<!-- $$$QGLFramebufferObject$$$QGLFramebufferObjectconstQSize&AttachmentGLenumGLenum -->
<h3 class="fn" id="QGLFramebufferObject-2"><a name="QGLFramebufferObject-2"></a>QGLFramebufferObject::<span class="name">QGLFramebufferObject</span>(const <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> &amp;<i>size</i>, <span class="type"><a href="qglframebufferobject.html#Attachment-enum">Attachment</a></span> <i>attachment</i>, <span class="type">GLenum</span> <i>target</i> = GL_TEXTURE_2D, <span class="type">GLenum</span> <i>internal_format</i> = 0)</h3>
<p>This is an overloaded function.</p>
<p>Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given <i>size</i>.</p>
<p>The <i>attachment</i> parameter describes the depth/stencil buffer configuration, <i>target</i> the texture target and <i>internal_format</i> the internal texture format. The default texture target is <code>GL_TEXTURE_2D</code>, while the default internal format is <code>GL_RGBA8</code> for desktop OpenGL and <code>GL_RGBA</code> for OpenGL/ES.</p>
<p><b>See also </b><a href="qglframebufferobject.html#size">size</a>(), <a href="qglframebufferobject.html#texture">texture</a>(), and <a href="qglframebufferobject.html#attachment">attachment</a>().</p>
<!-- @@@QGLFramebufferObject -->
<!-- $$$QGLFramebufferObject$$$QGLFramebufferObjectintintAttachmentGLenumGLenum -->
<h3 class="fn" id="QGLFramebufferObject-3"><a name="QGLFramebufferObject-3"></a>QGLFramebufferObject::<span class="name">QGLFramebufferObject</span>(<span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, <span class="type"><a href="qglframebufferobject.html#Attachment-enum">Attachment</a></span> <i>attachment</i>, <span class="type">GLenum</span> <i>target</i> = GL_TEXTURE_2D, <span class="type">GLenum</span> <i>internal_format</i> = 0)</h3>
<p>This is an overloaded function.</p>
<p>Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given <i>width</i> and <i>height</i>.</p>
<p>The <i>attachment</i> parameter describes the depth/stencil buffer configuration, <i>target</i> the texture target and <i>internal_format</i> the internal texture format. The default texture target is <code>GL_TEXTURE_2D</code>, while the default internal format is <code>GL_RGBA8</code> for desktop OpenGL and <code>GL_RGBA</code> for OpenGL/ES.</p>
<p><b>See also </b><a href="qglframebufferobject.html#size">size</a>(), <a href="qglframebufferobject.html#texture">texture</a>(), and <a href="qglframebufferobject.html#attachment">attachment</a>().</p>
<!-- @@@QGLFramebufferObject -->
<!-- $$$QGLFramebufferObject$$$QGLFramebufferObjectconstQSize&constQGLFramebufferObjectFormat& -->
<h3 class="fn" id="QGLFramebufferObject-4"><a name="QGLFramebufferObject-4"></a>QGLFramebufferObject::<span class="name">QGLFramebufferObject</span>(const <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> &amp;<i>size</i>, const <span class="type"><a href="qglframebufferobjectformat.html">QGLFramebufferObjectFormat</a></span> &amp;<i>format</i>)</h3>
<p>This is an overloaded function.</p>
<p>Constructs an OpenGL framebuffer object of the given <i>size</i> based on the supplied <i>format</i>.</p>
<!-- @@@QGLFramebufferObject -->
<!-- $$$QGLFramebufferObject$$$QGLFramebufferObjectintintconstQGLFramebufferObjectFormat& -->
<h3 class="fn" id="QGLFramebufferObject-5"><a name="QGLFramebufferObject-5"></a>QGLFramebufferObject::<span class="name">QGLFramebufferObject</span>(<span class="type">int</span> <i>width</i>, <span class="type">int</span> <i>height</i>, const <span class="type"><a href="qglframebufferobjectformat.html">QGLFramebufferObjectFormat</a></span> &amp;<i>format</i>)</h3>
<p>This is an overloaded function.</p>
<p>Constructs an OpenGL framebuffer object of the given <i>width</i> and <i>height</i> based on the supplied <i>format</i>.</p>
<!-- @@@QGLFramebufferObject -->
<!-- $$$~QGLFramebufferObject[overload1]$$$~QGLFramebufferObject -->
<h3 class="fn" id="dtor.QGLFramebufferObject"><a name="dtor.QGLFramebufferObject"></a><code>[virtual] </code>QGLFramebufferObject::<span class="name">~QGLFramebufferObject</span>()</h3>
<p>Destroys the framebuffer object and frees any allocated resources.</p>
<!-- @@@~QGLFramebufferObject -->
<!-- $$$attachment[overload1]$$$attachment -->
<h3 class="fn" id="attachment"><a name="attachment"></a><span class="type"><a href="qglframebufferobject.html#Attachment-enum">Attachment</a></span> QGLFramebufferObject::<span class="name">attachment</span>() const</h3>
<p>Returns the status of the depth and stencil buffers attached to this framebuffer object.</p>
<!-- @@@attachment -->
<!-- $$$bind[overload1]$$$bind -->
<h3 class="fn" id="bind"><a name="bind"></a><span class="type">bool</span> QGLFramebufferObject::<span class="name">bind</span>()</h3>
<p>Switches rendering from the default, windowing system provided framebuffer to this framebuffer object. Returns <code>true</code> upon success, false otherwise.</p>
<p><b>See also </b><a href="qglframebufferobject.html#release">release</a>().</p>
<!-- @@@bind -->
<!-- $$$bindDefault[overload1]$$$bindDefault -->
<h3 class="fn" id="bindDefault"><a name="bindDefault"></a><code>[static] </code><span class="type">bool</span> QGLFramebufferObject::<span class="name">bindDefault</span>()</h3>
<p>Switches rendering back to the default, windowing system provided framebuffer. Returns <code>true</code> upon success, false otherwise.</p>
<p><b>See also </b><a href="qglframebufferobject.html#bind">bind</a>() and <a href="qglframebufferobject.html#release">release</a>().</p>
<!-- @@@bindDefault -->
<!-- $$$blitFramebuffer[overload1]$$$blitFramebufferQGLFramebufferObject*constQRect&QGLFramebufferObject*constQRect&GLbitfieldGLenum -->
<h3 class="fn" id="blitFramebuffer"><a name="blitFramebuffer"></a><code>[static] </code><span class="type">void</span> QGLFramebufferObject::<span class="name">blitFramebuffer</span>(<span class="type"><a href="qglframebufferobject.html#QGLFramebufferObject">QGLFramebufferObject</a></span> *<i>target</i>, const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>targetRect</i>, <span class="type"><a href="qglframebufferobject.html#QGLFramebufferObject">QGLFramebufferObject</a></span> *<i>source</i>, const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>sourceRect</i>, <span class="type">GLbitfield</span> <i>buffers</i> = GL_COLOR_BUFFER_BIT, <span class="type">GLenum</span> <i>filter</i> = GL_NEAREST)</h3>
<p>Blits from the <i>sourceRect</i> rectangle in the <i>source</i> framebuffer object to the <i>targetRect</i> rectangle in the <i>target</i> framebuffer object.</p>
<p>If <i>source</i> or <i>target</i> is 0, the default framebuffer will be used instead of a framebuffer object as source or target respectively.</p>
<p>The <i>buffers</i> parameter should be a mask consisting of any combination of <code>GL_COLOR_BUFFER_BIT</code>, <code>GL_DEPTH_BUFFER_BIT</code>, and <code>GL_STENCIL_BUFFER_BIT</code>. Any buffer type that is not present both in the source and target buffers is ignored.</p>
<p>The <i>sourceRect</i> and <i>targetRect</i> rectangles may have different sizes; in this case <i>buffers</i> should not contain <code>GL_DEPTH_BUFFER_BIT</code> or <code>GL_STENCIL_BUFFER_BIT</code>. The <i>filter</i> parameter should be set to <code>GL_LINEAR</code> or <code>GL_NEAREST</code>, and specifies whether linear or nearest interpolation should be used when scaling is performed.</p>
<p>If <i>source</i> equals <i>target</i> a copy is performed within the same buffer. Results are undefined if the source and target rectangles overlap and have different sizes. The sizes must also be the same if any of the framebuffer objects are multisample framebuffers.</p>
<p>Note that the scissor test will restrict the blit area if enabled.</p>
<p>This function will have no effect unless <a href="qglframebufferobject.html#hasOpenGLFramebufferBlit">hasOpenGLFramebufferBlit</a>() returns true.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qglframebufferobject.html#hasOpenGLFramebufferBlit">hasOpenGLFramebufferBlit</a>().</p>
<!-- @@@blitFramebuffer -->
<!-- $$$drawTexture[overload1]$$$drawTextureconstQRectF&GLuintGLenum -->
<h3 class="fn" id="drawTexture"><a name="drawTexture"></a><span class="type">void</span> QGLFramebufferObject::<span class="name">drawTexture</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>target</i>, <span class="type">GLuint</span> <i>textureId</i>, <span class="type">GLenum</span> <i>textureTarget</i> = GL_TEXTURE_2D)</h3>
<p>Draws the given texture, <i>textureId</i>, to the given target rectangle, <i>target</i>, in OpenGL model space. The <i>textureTarget</i> should be a 2D texture target.</p>
<p>The framebuffer object should be bound when calling this function.</p>
<p>Equivalent to the corresponding <a href="qglcontext.html#drawTexture">QGLContext::drawTexture</a>().</p>
<p>This function was introduced in  Qt 4.4.</p>
<!-- @@@drawTexture -->
<!-- $$$drawTexture$$$drawTextureconstQPointF&GLuintGLenum -->
<h3 class="fn" id="drawTexture-1"><a name="drawTexture-1"></a><span class="type">void</span> QGLFramebufferObject::<span class="name">drawTexture</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>, <span class="type">GLuint</span> <i>textureId</i>, <span class="type">GLenum</span> <i>textureTarget</i> = GL_TEXTURE_2D)</h3>
<p>Draws the given texture, <i>textureId</i>, at the given <i>point</i> in OpenGL model space. The <i>textureTarget</i> should be a 2D texture target.</p>
<p>The framebuffer object should be bound when calling this function.</p>
<p>Equivalent to the corresponding <a href="qglcontext.html#drawTexture">QGLContext::drawTexture</a>().</p>
<p>This function was introduced in  Qt 4.4.</p>
<!-- @@@drawTexture -->
<!-- $$$format[overload1]$$$format -->
<h3 class="fn" id="format"><a name="format"></a><span class="type"><a href="qglframebufferobjectformat.html">QGLFramebufferObjectFormat</a></span> QGLFramebufferObject::<span class="name">format</span>() const</h3>
<p>Returns the format of this framebuffer object.</p>
<!-- @@@format -->
<!-- $$$handle[overload1]$$$handle -->
<h3 class="fn" id="handle"><a name="handle"></a><span class="type">GLuint</span> QGLFramebufferObject::<span class="name">handle</span>() const</h3>
<p>Returns the GL framebuffer object handle for this framebuffer object (returned by the <code>glGenFrameBuffersEXT()</code> function). This handle can be used to attach new images or buffers to the framebuffer. The user is responsible for cleaning up and destroying these objects.</p>
<!-- @@@handle -->
<!-- $$$hasOpenGLFramebufferBlit[overload1]$$$hasOpenGLFramebufferBlit -->
<h3 class="fn" id="hasOpenGLFramebufferBlit"><a name="hasOpenGLFramebufferBlit"></a><code>[static] </code><span class="type">bool</span> QGLFramebufferObject::<span class="name">hasOpenGLFramebufferBlit</span>()</h3>
<p>Returns <code>true</code> if the OpenGL <code>GL_EXT_framebuffer_blit</code> extension is present on this system; otherwise returns <code>false</code>.</p>
<p>This function was introduced in  Qt 4.6.</p>
<p><b>See also </b><a href="qglframebufferobject.html#blitFramebuffer">blitFramebuffer</a>().</p>
<!-- @@@hasOpenGLFramebufferBlit -->
<!-- $$$hasOpenGLFramebufferObjects[overload1]$$$hasOpenGLFramebufferObjects -->
<h3 class="fn" id="hasOpenGLFramebufferObjects"><a name="hasOpenGLFramebufferObjects"></a><code>[static] </code><span class="type">bool</span> QGLFramebufferObject::<span class="name">hasOpenGLFramebufferObjects</span>()</h3>
<p>Returns <code>true</code> if the OpenGL <code>GL_EXT_framebuffer_object</code> extension is present on this system; otherwise returns <code>false</code>.</p>
<!-- @@@hasOpenGLFramebufferObjects -->
<!-- $$$isBound[overload1]$$$isBound -->
<h3 class="fn" id="isBound"><a name="isBound"></a><span class="type">bool</span> QGLFramebufferObject::<span class="name">isBound</span>() const</h3>
<p>Returns <code>true</code> if the framebuffer object is currently bound to a context, otherwise false is returned.</p>
<p>This function was introduced in  Qt 4.5.</p>
<!-- @@@isBound -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QGLFramebufferObject::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if the framebuffer object is valid.</p>
<p>The framebuffer can become invalid if the initialization process fails, the user attaches an invalid buffer to the framebuffer object, or a non-power of two width/height is specified as the texture size if the texture target is <code>GL_TEXTURE_2D</code>. The non-power of two limitation does not apply if the OpenGL version is 2.0 or higher, or if the GL_ARB_texture_non_power_of_two extension is present.</p>
<p>The framebuffer can also become invalid if the QGLContext that the framebuffer was created within is destroyed and there are no other shared contexts that can take over ownership of the framebuffer.</p>
<!-- @@@isValid -->
<!-- $$$metric[overload1]$$$metricPaintDeviceMetric -->
<h3 class="fn" id="metric"><a name="metric"></a><code>[virtual protected] </code><span class="type">int</span> QGLFramebufferObject::<span class="name">metric</span>(<span class="type"><a href="../qtgui/qpaintdevice.html#PaintDeviceMetric-enum">PaintDeviceMetric</a></span> <i>metric</i>) const</h3>
<p>Reimplemented from <a href="../qtgui/qpaintdevice.html#metric">QPaintDevice::metric</a>().</p>
<!-- @@@metric -->
<!-- $$$paintEngine[overload1]$$$paintEngine -->
<h3 class="fn" id="paintEngine"><a name="paintEngine"></a><code>[virtual] </code><span class="type"><a href="../qtgui/qpaintengine.html">QPaintEngine</a></span> *QGLFramebufferObject::<span class="name">paintEngine</span>() const</h3>
<p>Reimplemented from <a href="../qtgui/qpaintdevice.html#paintEngine">QPaintDevice::paintEngine</a>().</p>
<!-- @@@paintEngine -->
<!-- $$$release[overload1]$$$release -->
<h3 class="fn" id="release"><a name="release"></a><span class="type">bool</span> QGLFramebufferObject::<span class="name">release</span>()</h3>
<p>Switches rendering back to the default, windowing system provided framebuffer. Returns <code>true</code> upon success, false otherwise.</p>
<p><b>See also </b><a href="qglframebufferobject.html#bind">bind</a>().</p>
<!-- @@@release -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn" id="size"><a name="size"></a><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QGLFramebufferObject::<span class="name">size</span>() const</h3>
<p>Returns the size of the texture attached to this framebuffer object.</p>
<!-- @@@size -->
<!-- $$$texture[overload1]$$$texture -->
<h3 class="fn" id="texture"><a name="texture"></a><span class="type">GLuint</span> QGLFramebufferObject::<span class="name">texture</span>() const</h3>
<p>Returns the texture id for the texture attached as the default rendering target in this framebuffer object. This texture id can be bound as a normal texture in your own GL code.</p>
<p>If a multisample framebuffer object is used then the value returned from this function will be invalid.</p>
<!-- @@@texture -->
<!-- $$$toImage[overload1]$$$toImage -->
<h3 class="fn" id="toImage"><a name="toImage"></a><span class="type"><a href="../qtgui/qimage.html">QImage</a></span> QGLFramebufferObject::<span class="name">toImage</span>() const</h3>
<p>Returns the contents of this framebuffer object as a <a href="../qtgui/qimage.html">QImage</a>.</p>
<p>The returned image has a format of premultiplied ARGB32 or RGB32. The latter is used only when internalTextureFormat() is set to <code>GL_RGB</code>.</p>
<p>If the rendering in the framebuffer was not done with premultiplied alpha in mind, create a wrapper <a href="../qtgui/qimage.html">QImage</a> with a non-premultiplied format. This is necessary before performing operations like <a href="../qtgui/qimage.html#save-1">QImage::save</a>() because otherwise the image data would get unpremultiplied, even though it was not premultiplied in the first place. To create such a wrapper without performing a copy of the pixel data, do the following:</p>
<pre class="cpp">

  <span class="type"><a href="../qtgui/qimage.html">QImage</a></span> fboImage(fbo<span class="operator">.</span>toImage());
  <span class="type"><a href="../qtgui/qimage.html">QImage</a></span> image(fboImage<span class="operator">.</span>constBits()<span class="operator">,</span> fboImage<span class="operator">.</span>width()<span class="operator">,</span> fboImage<span class="operator">.</span>height()<span class="operator">,</span> <span class="type"><a href="../qtgui/qimage.html">QImage</a></span><span class="operator">::</span>Format_ARGB32);

</pre>
<p>On QNX the back buffer is not preserved when a buffer swap occures. So this function might return old content.</p>
<!-- @@@toImage -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>