<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qglbuffer.cpp --> <title>QGLBuffer 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 >QGLBuffer</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="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QGLBuffer Class</h1> <!-- $$$QGLBuffer-brief --> <p>The <a href="qglbuffer.html">QGLBuffer</a> class provides functions for creating and managing GL buffer objects. <a href="#details">More...</a></p> <!-- @@@QGLBuffer --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QGLBuffer></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.7</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="qglbuffer-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="qglbuffer.html#Access-enum">Access</a></b> { ReadOnly, WriteOnly, ReadWrite }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#Type-enum">Type</a></b> { VertexBuffer, IndexBuffer, PixelPackBuffer, PixelUnpackBuffer }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#UsagePattern-enum">UsagePattern</a></b> { StreamDraw, StreamRead, StreamCopy, StaticDraw, ..., DynamicCopy }</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="qglbuffer.html#QGLBuffer">QGLBuffer</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#QGLBuffer-1">QGLBuffer</a></b>(QGLBuffer::Type <i>type</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#QGLBuffer-2">QGLBuffer</a></b>(const QGLBuffer &<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#dtor.QGLBuffer">~QGLBuffer</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#allocate">allocate</a></b>(const void *<i>data</i>, int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#allocate-1">allocate</a></b>(int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#bind">bind</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> GLuint </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#bufferId">bufferId</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#create">create</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#destroy">destroy</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#isCreated">isCreated</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void *</td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#map">map</a></b>(QGLBuffer::Access <i>access</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#read">read</a></b>(int <i>offset</i>, void *<i>data</i>, int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#release">release</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#setUsagePattern">setUsagePattern</a></b>(QGLBuffer::UsagePattern <i>value</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#size">size</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QGLBuffer::Type </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#type">type</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#unmap">unmap</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QGLBuffer::UsagePattern </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#usagePattern">usagePattern</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#write">write</a></b>(int <i>offset</i>, const void *<i>data</i>, int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QGLBuffer &</td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#operator-eq">operator=</a></b>(const QGLBuffer &<i>other</i>)</td></tr> </table></div> <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"> void </td><td class="memItemRight bottomAlign"><b><a href="qglbuffer.html#release-1">release</a></b>(QGLBuffer::Type <i>type</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QGLBuffer-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qglbuffer.html">QGLBuffer</a> class provides functions for creating and managing GL buffer objects.</p> <p>Buffer objects are created in the GL server so that the client application can avoid uploading vertices, indices, texture image data, etc every time they are needed.</p> <p><a href="qglbuffer.html">QGLBuffer</a> objects can be copied around as a reference to the underlying GL buffer object:</p> <pre class="cpp"> <span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span> buffer1(<span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span><span class="operator">::</span>IndexBuffer); buffer1<span class="operator">.</span>create(); <span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span> buffer2 <span class="operator">=</span> buffer1; </pre> <p><a href="qglbuffer.html">QGLBuffer</a> performs a shallow copy when objects are copied in this manner, but does not implement copy-on-write semantics. The original object will be affected whenever the copy is modified.</p> <p><b>Note: </b>This class has been deprecated in favor of <a href="../qtgui/qopenglbuffer.html">QOpenGLBuffer</a>.</p></div> <!-- @@@QGLBuffer --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$Access$$$ReadOnly$$$WriteOnly$$$ReadWrite --> <h3 class="fn" id="Access-enum"><a name="Access-enum"></a>enum QGLBuffer::<span class="name">Access</span></h3> <p>This enum defines the access mode for <a href="qglbuffer.html#map">QGLBuffer::map</a>().</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>QGLBuffer::ReadOnly</code></td><td class="topAlign tblval"><code>0x88B8</code></td><td class="topAlign">The buffer will be mapped for reading only.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::WriteOnly</code></td><td class="topAlign tblval"><code>0x88B9</code></td><td class="topAlign">The buffer will be mapped for writing only.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::ReadWrite</code></td><td class="topAlign tblval"><code>0x88BA</code></td><td class="topAlign">The buffer will be mapped for reading and writing.</td></tr> </table></div> <!-- @@@Access --> <!-- $$$Type$$$VertexBuffer$$$IndexBuffer$$$PixelPackBuffer$$$PixelUnpackBuffer --> <h3 class="fn" id="Type-enum"><a name="Type-enum"></a>enum QGLBuffer::<span class="name">Type</span></h3> <p>This enum defines the type of GL buffer object to create with <a href="qglbuffer.html" class="obsolete">QGLBuffer</a>.</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>QGLBuffer::VertexBuffer</code></td><td class="topAlign tblval"><code>0x8892</code></td><td class="topAlign">Vertex buffer object for use when specifying vertex arrays.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::IndexBuffer</code></td><td class="topAlign tblval"><code>0x8893</code></td><td class="topAlign">Index buffer object for use with <code>glDrawElements()</code>.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::PixelPackBuffer</code></td><td class="topAlign tblval"><code>0x88EB</code></td><td class="topAlign">Pixel pack buffer object for reading pixel data from the GL server (for example, with <code>glReadPixels()</code>). Not supported under OpenGL/ES.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::PixelUnpackBuffer</code></td><td class="topAlign tblval"><code>0x88EC</code></td><td class="topAlign">Pixel unpack buffer object for writing pixel data to the GL server (for example, with <code>glTexImage2D()</code>). Not supported under OpenGL/ES.</td></tr> </table></div> <!-- @@@Type --> <!-- $$$UsagePattern$$$StreamDraw$$$StreamRead$$$StreamCopy$$$StaticDraw$$$StaticRead$$$StaticCopy$$$DynamicDraw$$$DynamicRead$$$DynamicCopy --> <h3 class="fn" id="UsagePattern-enum"><a name="UsagePattern-enum"></a>enum QGLBuffer::<span class="name">UsagePattern</span></h3> <p>This enum defines the usage pattern of a <a href="qglbuffer.html" class="obsolete">QGLBuffer</a> object.</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>QGLBuffer::StreamDraw</code></td><td class="topAlign tblval"><code>0x88E0</code></td><td class="topAlign">The data will be set once and used a few times for drawing operations. Under OpenGL/ES 1.1 this is identical to StaticDraw.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::StreamRead</code></td><td class="topAlign tblval"><code>0x88E1</code></td><td class="topAlign">The data will be set once and used a few times for reading data back from the GL server. Not supported under OpenGL/ES.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::StreamCopy</code></td><td class="topAlign tblval"><code>0x88E2</code></td><td class="topAlign">The data will be set once and used a few times for reading data back from the GL server for use in further drawing operations. Not supported under OpenGL/ES.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::StaticDraw</code></td><td class="topAlign tblval"><code>0x88E4</code></td><td class="topAlign">The data will be set once and used many times for drawing operations.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::StaticRead</code></td><td class="topAlign tblval"><code>0x88E5</code></td><td class="topAlign">The data will be set once and used many times for reading data back from the GL server. Not supported under OpenGL/ES.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::StaticCopy</code></td><td class="topAlign tblval"><code>0x88E6</code></td><td class="topAlign">The data will be set once and used many times for reading data back from the GL server for use in further drawing operations. Not supported under OpenGL/ES.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::DynamicDraw</code></td><td class="topAlign tblval"><code>0x88E8</code></td><td class="topAlign">The data will be modified repeatedly and used many times for drawing operations.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::DynamicRead</code></td><td class="topAlign tblval"><code>0x88E9</code></td><td class="topAlign">The data will be modified repeatedly and used many times for reading data back from the GL server. Not supported under OpenGL/ES.</td></tr> <tr><td class="topAlign"><code>QGLBuffer::DynamicCopy</code></td><td class="topAlign tblval"><code>0x88EA</code></td><td class="topAlign">The data will be modified repeatedly and used many times for reading data back from the GL server for use in further drawing operations. Not supported under OpenGL/ES.</td></tr> </table></div> <!-- @@@UsagePattern --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QGLBuffer[overload1]$$$QGLBuffer --> <h3 class="fn" id="QGLBuffer"><a name="QGLBuffer"></a>QGLBuffer::<span class="name">QGLBuffer</span>()</h3> <p>Constructs a new buffer object of type <a href="qglbuffer.html#Type-enum">QGLBuffer::VertexBuffer</a>.</p> <p>Note: this constructor just creates the <a href="qglbuffer.html" class="obsolete">QGLBuffer</a> instance. The actual buffer object in the GL server is not created until <a href="qglbuffer.html#create">create</a>() is called.</p> <p><b>See also </b><a href="qglbuffer.html#create">create</a>().</p> <!-- @@@QGLBuffer --> <!-- $$$QGLBuffer$$$QGLBufferQGLBuffer::Type --> <h3 class="fn" id="QGLBuffer-1"><a name="QGLBuffer-1"></a>QGLBuffer::<span class="name">QGLBuffer</span>(<span class="type"><a href="qglbuffer.html#Type-enum">QGLBuffer::Type</a></span> <i>type</i>)</h3> <p>Constructs a new buffer object of <i>type</i>.</p> <p>Note: this constructor just creates the <a href="qglbuffer.html" class="obsolete">QGLBuffer</a> instance. The actual buffer object in the GL server is not created until <a href="qglbuffer.html#create">create</a>() is called.</p> <p><b>See also </b><a href="qglbuffer.html#create">create</a>().</p> <!-- @@@QGLBuffer --> <!-- $$$QGLBuffer$$$QGLBufferconstQGLBuffer& --> <h3 class="fn" id="QGLBuffer-2"><a name="QGLBuffer-2"></a>QGLBuffer::<span class="name">QGLBuffer</span>(const <span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span> &<i>other</i>)</h3> <p>Constructs a shallow copy of <i>other</i>.</p> <p>Note: <a href="qglbuffer.html" class="obsolete">QGLBuffer</a> does not implement copy-on-write semantics, so <i>other</i> will be affected whenever the copy is modified.</p> <!-- @@@QGLBuffer --> <!-- $$$~QGLBuffer[overload1]$$$~QGLBuffer --> <h3 class="fn" id="dtor.QGLBuffer"><a name="dtor.QGLBuffer"></a>QGLBuffer::<span class="name">~QGLBuffer</span>()</h3> <p>Destroys this buffer object, including the storage being used in the GL server.</p> <!-- @@@~QGLBuffer --> <!-- $$$allocate[overload1]$$$allocateconstvoid*int --> <h3 class="fn" id="allocate"><a name="allocate"></a><span class="type">void</span> QGLBuffer::<span class="name">allocate</span>(const <span class="type">void</span> *<i>data</i>, <span class="type">int</span> <i>count</i>)</h3> <p>Allocates <i>count</i> bytes of space to the buffer, initialized to the contents of <i>data</i>. Any previous contents will be removed.</p> <p>It is assumed that <a href="qglbuffer.html#create">create</a>() has been called on this buffer and that it has been bound to the current context.</p> <p><b>See also </b><a href="qglbuffer.html#create">create</a>(), <a href="qglbuffer.html#read">read</a>(), and <a href="qglbuffer.html#write">write</a>().</p> <!-- @@@allocate --> <!-- $$$allocate$$$allocateint --> <h3 class="fn" id="allocate-1"><a name="allocate-1"></a><span class="type">void</span> QGLBuffer::<span class="name">allocate</span>(<span class="type">int</span> <i>count</i>)</h3> <p>This is an overloaded function.</p> <p>Allocates <i>count</i> bytes of space to the buffer. Any previous contents will be removed.</p> <p>It is assumed that <a href="qglbuffer.html#create">create</a>() has been called on this buffer and that it has been bound to the current context.</p> <p><b>See also </b><a href="qglbuffer.html#create">create</a>() and <a href="qglbuffer.html#write">write</a>().</p> <!-- @@@allocate --> <!-- $$$bind[overload1]$$$bind --> <h3 class="fn" id="bind"><a name="bind"></a><span class="type">bool</span> QGLBuffer::<span class="name">bind</span>()</h3> <p>Binds the buffer associated with this object to the current GL context. Returns <code>false</code> if binding was not possible, usually because <a href="qglbuffer.html#type">type</a>() is not supported on this GL implementation.</p> <p>The buffer must be bound to the same QGLContext current when <a href="qglbuffer.html#create">create</a>() was called, or to another QGLContext that is sharing with it. Otherwise, false will be returned from this function.</p> <p><b>See also </b><a href="qglbuffer.html#release">release</a>() and <a href="qglbuffer.html#create">create</a>().</p> <!-- @@@bind --> <!-- $$$bufferId[overload1]$$$bufferId --> <h3 class="fn" id="bufferId"><a name="bufferId"></a><span class="type">GLuint</span> QGLBuffer::<span class="name">bufferId</span>() const</h3> <p>Returns the GL identifier associated with this buffer; zero if the buffer has not been created.</p> <p><b>See also </b><a href="qglbuffer.html#isCreated">isCreated</a>().</p> <!-- @@@bufferId --> <!-- $$$create[overload1]$$$create --> <h3 class="fn" id="create"><a name="create"></a><span class="type">bool</span> QGLBuffer::<span class="name">create</span>()</h3> <p>Creates the buffer object in the GL server. Returns <code>true</code> if the object was created; false otherwise.</p> <p>This function must be called with a current QGLContext. The buffer will be bound to and can only be used in that context (or any other context that is shared with it).</p> <p>This function will return false if the GL implementation does not support buffers, or there is no current QGLContext.</p> <p><b>See also </b><a href="qglbuffer.html#isCreated">isCreated</a>(), <a href="qglbuffer.html#allocate">allocate</a>(), <a href="qglbuffer.html#write">write</a>(), and <a href="qglbuffer.html#destroy">destroy</a>().</p> <!-- @@@create --> <!-- $$$destroy[overload1]$$$destroy --> <h3 class="fn" id="destroy"><a name="destroy"></a><span class="type">void</span> QGLBuffer::<span class="name">destroy</span>()</h3> <p>Destroys this buffer object, including the storage being used in the GL server. All references to the buffer will become invalid.</p> <!-- @@@destroy --> <!-- $$$isCreated[overload1]$$$isCreated --> <h3 class="fn" id="isCreated"><a name="isCreated"></a><span class="type">bool</span> QGLBuffer::<span class="name">isCreated</span>() const</h3> <p>Returns <code>true</code> if this buffer has been created; false otherwise.</p> <p><b>See also </b><a href="qglbuffer.html#create">create</a>() and <a href="qglbuffer.html#destroy">destroy</a>().</p> <!-- @@@isCreated --> <!-- $$$map[overload1]$$$mapQGLBuffer::Access --> <h3 class="fn" id="map"><a name="map"></a><span class="type">void</span> *QGLBuffer::<span class="name">map</span>(<span class="type"><a href="qglbuffer.html#Access-enum">QGLBuffer::Access</a></span> <i>access</i>)</h3> <p>Maps the contents of this buffer into the application's memory space and returns a pointer to it. Returns null if memory mapping is not possible. The <i>access</i> parameter indicates the type of access to be performed.</p> <p>It is assumed that <a href="qglbuffer.html#create">create</a>() has been called on this buffer and that it has been bound to the current context.</p> <p>This function is only supported under OpenGL/ES if the <code>GL_OES_mapbuffer</code> extension is present.</p> <p><b>See also </b><a href="qglbuffer.html#unmap">unmap</a>(), <a href="qglbuffer.html#create">create</a>(), and <a href="qglbuffer.html#bind">bind</a>().</p> <!-- @@@map --> <!-- $$$read[overload1]$$$readintvoid*int --> <h3 class="fn" id="read"><a name="read"></a><span class="type">bool</span> QGLBuffer::<span class="name">read</span>(<span class="type">int</span> <i>offset</i>, <span class="type">void</span> *<i>data</i>, <span class="type">int</span> <i>count</i>)</h3> <p>Reads the <i>count</i> bytes in this buffer starting at <i>offset</i> into <i>data</i>. Returns <code>true</code> on success; false if reading from the buffer is not supported. Buffer reading is not supported under OpenGL/ES.</p> <p>It is assumed that this buffer has been bound to the current context.</p> <p><b>See also </b><a href="qglbuffer.html#write">write</a>() and <a href="qglbuffer.html#bind">bind</a>().</p> <!-- @@@read --> <!-- $$$release[overload1]$$$release --> <h3 class="fn" id="release"><a name="release"></a><span class="type">void</span> QGLBuffer::<span class="name">release</span>()</h3> <p>Releases the buffer associated with this object from the current GL context.</p> <p>This function must be called with the same QGLContext current as when <a href="qglbuffer.html#bind">bind</a>() was called on the buffer.</p> <p><b>See also </b><a href="qglbuffer.html#bind">bind</a>().</p> <!-- @@@release --> <!-- $$$release$$$releaseQGLBuffer::Type --> <h3 class="fn" id="release-1"><a name="release-1"></a><code>[static] </code><span class="type">void</span> QGLBuffer::<span class="name">release</span>(<span class="type"><a href="qglbuffer.html#Type-enum">QGLBuffer::Type</a></span> <i>type</i>)</h3> <p>Releases the buffer associated with <i>type</i> in the current QGLContext.</p> <p>This function is a direct call to <code>glBindBuffer(type, 0)</code> for use when the caller does not know which <a href="qglbuffer.html" class="obsolete">QGLBuffer</a> has been bound to the context but wants to make sure that it is released.</p> <pre class="cpp"> <span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span><span class="operator">::</span>release(<span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span><span class="operator">::</span>VertexBuffer); </pre> <!-- @@@release --> <!-- $$$setUsagePattern[overload1]$$$setUsagePatternQGLBuffer::UsagePattern --> <h3 class="fn" id="setUsagePattern"><a name="setUsagePattern"></a><span class="type">void</span> QGLBuffer::<span class="name">setUsagePattern</span>(<span class="type"><a href="qglbuffer.html#UsagePattern-enum">QGLBuffer::UsagePattern</a></span> <i>value</i>)</h3> <p>Sets the usage pattern for this buffer object to <i>value</i>. This function must be called before <a href="qglbuffer.html#allocate">allocate</a>() or <a href="qglbuffer.html#write">write</a>().</p> <p><b>See also </b><a href="qglbuffer.html#usagePattern">usagePattern</a>(), <a href="qglbuffer.html#allocate">allocate</a>(), and <a href="qglbuffer.html#write">write</a>().</p> <!-- @@@setUsagePattern --> <!-- $$$size[overload1]$$$size --> <h3 class="fn" id="size"><a name="size"></a><span class="type">int</span> QGLBuffer::<span class="name">size</span>() const</h3> <p>Returns the size of the data in this buffer, for reading operations. Returns -1 if fetching the buffer size is not supported, or the buffer has not been created.</p> <p>It is assumed that this buffer has been bound to the current context.</p> <p><b>See also </b><a href="qglbuffer.html#isCreated">isCreated</a>() and <a href="qglbuffer.html#bind">bind</a>().</p> <!-- @@@size --> <!-- $$$type[overload1]$$$type --> <h3 class="fn" id="type"><a name="type"></a><span class="type"><a href="qglbuffer.html#Type-enum">QGLBuffer::Type</a></span> QGLBuffer::<span class="name">type</span>() const</h3> <p>Returns the type of buffer represented by this object.</p> <!-- @@@type --> <!-- $$$unmap[overload1]$$$unmap --> <h3 class="fn" id="unmap"><a name="unmap"></a><span class="type">bool</span> QGLBuffer::<span class="name">unmap</span>()</h3> <p>Unmaps the buffer after it was mapped into the application's memory space with a previous call to <a href="qglbuffer.html#map">map</a>(). Returns <code>true</code> if the unmap succeeded; false otherwise.</p> <p>It is assumed that this buffer has been bound to the current context, and that it was previously mapped with <a href="qglbuffer.html#map">map</a>().</p> <p>This function is only supported under OpenGL/ES if the <code>GL_OES_mapbuffer</code> extension is present.</p> <p><b>See also </b><a href="qglbuffer.html#map">map</a>().</p> <!-- @@@unmap --> <!-- $$$usagePattern[overload1]$$$usagePattern --> <h3 class="fn" id="usagePattern"><a name="usagePattern"></a><span class="type"><a href="qglbuffer.html#UsagePattern-enum">QGLBuffer::UsagePattern</a></span> QGLBuffer::<span class="name">usagePattern</span>() const</h3> <p>Returns the usage pattern for this buffer object. The default value is <a href="qglbuffer.html#UsagePattern-enum">StaticDraw</a>.</p> <p><b>See also </b><a href="qglbuffer.html#setUsagePattern">setUsagePattern</a>().</p> <!-- @@@usagePattern --> <!-- $$$write[overload1]$$$writeintconstvoid*int --> <h3 class="fn" id="write"><a name="write"></a><span class="type">void</span> QGLBuffer::<span class="name">write</span>(<span class="type">int</span> <i>offset</i>, const <span class="type">void</span> *<i>data</i>, <span class="type">int</span> <i>count</i>)</h3> <p>Replaces the <i>count</i> bytes of this buffer starting at <i>offset</i> with the contents of <i>data</i>. Any other bytes in the buffer will be left unmodified.</p> <p>It is assumed that <a href="qglbuffer.html#create">create</a>() has been called on this buffer and that it has been bound to the current context.</p> <p><b>See also </b><a href="qglbuffer.html#create">create</a>(), <a href="qglbuffer.html#read">read</a>(), and <a href="qglbuffer.html#allocate">allocate</a>().</p> <!-- @@@write --> <!-- $$$operator=[overload1]$$$operator=constQGLBuffer& --> <h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span> &QGLBuffer::<span class="name">operator=</span>(const <span class="type"><a href="qglbuffer.html#QGLBuffer">QGLBuffer</a></span> &<i>other</i>)</h3> <p>Assigns a shallow copy of <i>other</i> to this object.</p> <p>Note: <a href="qglbuffer.html" class="obsolete">QGLBuffer</a> does not implement copy-on-write semantics, so <i>other</i> will be affected whenever the copy is modified.</p> <!-- @@@operator= --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</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>