Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 0a1223a3e4bb8a61fd0c6bd9fadbd0af > files > 164

qtcanvas3d5-doc-5.12.2-2.mga7.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" />
<!-- canvastextureprovider.cpp -->
  <title>Canvas3DTextureProvider QML Type | Qt Canvas 3D (deprecated) 5.12.2</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.12</td><td ><a href="qtcanvas3d-index.html">Qt Canvas 3D (deprecated)</a></td><td ><a href="qtcanvas3d-qmlmodule-obsolete.html">Qt Canvas 3D QML Types (deprecated)</a></td><td >Canvas3DTextureProvider QML Type</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtcanvas3d-index.html">Qt 5.12.2 Reference Documentation</a></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="#signals">Signals</a></li>
<li class="level1"><a href="#methods">Methods</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">Canvas3DTextureProvider QML Type</h1>
<span class="subtitle"></span>
<!-- $$$Canvas3DTextureProvider-brief -->
<p>Provides means to get QQuickItem as <a href="qml-qtcanvas3d-canvas3dtexture.html">Canvas3DTexture</a>. <a href="#details">More...</a></p>
<!-- @@@Canvas3DTextureProvider -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtCanvas3D 1.1</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  QtCanvas3D 1.1</td></tr></table></div><ul>
<li><a href="qml-qtcanvas3d-canvas3dtextureprovider-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtcanvas3d-canvas3dtextureprovider.html#textureReady-signal">textureReady</a></b></b>(Item *<i>source</i>)</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">QJSValue <b><b><a href="qml-qtcanvas3d-canvas3dtextureprovider.html#createTextureFromSource-method">createTextureFromSource</a></b></b>(Item *<i>source</i>)</li>
</ul>
<!-- $$$Canvas3DTextureProvider-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
<p><b>Deprecated in Qt 5.12.</b> An uncreatable QML type that provides an extension API that can be used to get QQuickItem as <a href="qml-qtcanvas3d-canvas3dtexture.html">Canvas3DTexture</a>. Only QQuickItems that implement QQuickItem::textureProvider() method can be used as a texture source, which in most cases means the <code>layer.enabled</code> property of the item must be set to <code>true</code>.</p>
<p>Typical usage would be something like this:</p>
<pre class="cpp">

  <span class="comment">// In QML code, declare a layered item you wish to show as texture</span>
  Rectangle {
      id: textureSource
      layer<span class="operator">.</span>enabled: <span class="keyword">true</span>
      <span class="comment">// ...</span>
  }
  <span class="operator">.</span>
  <span class="operator">.</span>
  <span class="comment">// In JavaScript code, declare the variables for the extension and the texture</span>
  var textureProvider;
  var myTexture;
  <span class="operator">.</span>
  <span class="operator">.</span>
  <span class="comment">// Get the extension after the context has been created in onInitializeGL().</span>
  textureProvider <span class="operator">=</span> gl<span class="operator">.</span>getExtension(<span class="string">&quot;QTCANVAS3D_texture_provider&quot;</span>);
  <span class="operator">.</span>
  <span class="operator">.</span>
  <span class="comment">// Get the Canvas3DTexture object representing our source item</span>
  <span class="keyword">if</span> (textureProvider)
      myTexture <span class="operator">=</span> textureProvider<span class="operator">.</span>createTextureFromSource(textureSource);
  <span class="operator">.</span>
  <span class="operator">.</span>
  <span class="comment">// If you just need to access the texture in onPaingGL(), the above is usually enough.</span>
  <span class="comment">// However, in cases where you utilize synchronous OpenGL commands or dynamically enable</span>
  <span class="comment">// the source item layer after canvas initialization, it is not guaranteed that the texture</span>
  <span class="comment">// is valid immediately after calling createTextureFromSource().</span>
  <span class="comment">// To ensure you don't use the texture before it is ready, connect the textureReady() signal</span>
  <span class="comment">// to a handler function that will use the texture.</span>
  textureProvider<span class="operator">.</span>textureReady<span class="operator">.</span>connect(function(sourceItem) {
      <span class="keyword">if</span> (sourceItem <span class="operator">=</span><span class="operator">=</span><span class="operator">=</span> textureSource) {
          gl<span class="operator">.</span>bindTexture(gl<span class="operator">.</span>TEXTURE_2D<span class="operator">,</span> myTexture);
          <span class="comment">// ...</span>
      }
  });

</pre>
<p><b>See also </b><a href="qml-qtcanvas3d-context3d.html">Context3D</a>.</p>
<!-- @@@Canvas3DTextureProvider -->
<h2>Signal Documentation</h2>
<!-- $$$textureReady -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="textureReady-signal">
<td class="tblQmlFuncNode"><p>
<a name="textureReady-signal"></a><span class="type">void</span> <span class="name">textureReady</span>(<span class="type">Item</span> *<i>source</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Indicates that the texture created with <a href="qml-qtcanvas3d-canvas3dtextureprovider.html#createTextureFromSource-method">createTextureFromSource()</a> method for the <i>source</i> item is ready to be used.</p>
</div></div><!-- @@@textureReady -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$createTextureFromSource -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="createTextureFromSource-method">
<td class="tblQmlFuncNode"><p>
<a name="createTextureFromSource-method"></a><span class="type">QJSValue</span> <span class="name">createTextureFromSource</span>(<span class="type">Item</span> *<i>source</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p><b>Deprecated in Qt 5.12.</b> Creates and returns a Canvas3DTexture object for the supplied <i>source</i> item.</p>
<p>The <i>source</i> item must be of a type that implements a texture provider, which in most cases means the <code>layer.enabled</code> property of the item must be set to <code>true</code>. ShaderEffectSource items can also be used as texture sources. The texture provider of the <i>source</i> item owns the OpenGL texture. If the <i>source</i> item is deleted or the <code>layer.enabled</code> property is set to <code>false</code> while the texture is still in use in Canvas3D, the rendered texture contents become undefined.</p>
<p>Trying to bind the returned Canvas3DTexture object is not guaranteed to work until a <a href="qml-qtcanvas3d-canvas3dtextureprovider.html#textureReady-signal">textureReady()</a> signal corresponding to the <i>source</i> item has been emitted. However, if you don't have any synchronous OpenGL calls between the first use of the texture and the end of your paingGL() handler, and if you can guarantee that the source item has been fully rendered at least once after its layer was enabled, you can immediately use the returned texture without waiting for the <a href="qml-qtcanvas3d-canvas3dtextureprovider.html#textureReady-signal">textureReady()</a> signal.</p>
<p>Disabling the <i>source</i> item's layer will destroy the underlying texture provider, so it is necessary to call this method again for the <i>source</i> item if you re-enable its layer.</p>
<p>If this function is called twice for same <i>source</i>, it doesn't create a new Canvas3DTexture instance, but instead returns a reference to a previously created one, as long as the previous instance is still alive.</p>
<p>The generated texture is owned and managed by Qt Quick's scene graph, so attempting to modify its parameters is not guaranteed to work.</p>
<p><b>Note: </b>Qt Quick uses texture coordinates where the origin is at top left corner, which is different from OpenGL default coordinate system, where the origin is at bottom left corner. You need to account for this when specifying the UV mapping for the texture. Alternatively, you can specify a suitable textureMirroring value for your layer or ShaderEffectSource item.</p></div></div><!-- @@@createTextureFromSource -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 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>