<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>OpenGL — PyCUDA 2014.1 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', VERSION: '2014.1', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="PyCUDA 2014.1 documentation" href="index.html" /> <link rel="next" title="GPU Arrays" href="array.html" /> <link rel="prev" title="Built-in Utilities" href="util.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="array.html" title="GPU Arrays" accesskey="N">next</a> |</li> <li class="right" > <a href="util.html" title="Built-in Utilities" accesskey="P">previous</a> |</li> <li><a href="index.html">PyCUDA 2014.1 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-pycuda.gl"> <span id="opengl"></span><span id="gl-interop"></span><h1>OpenGL<a class="headerlink" href="#module-pycuda.gl" title="Permalink to this headline">¶</a></h1> <dl class="function"> <dt id="pycuda.gl.make_context"> <tt class="descclassname">pycuda.gl.</tt><tt class="descname">make_context</tt><big>(</big><em>dev</em>, <em>flags=0</em><big>)</big><a class="headerlink" href="#pycuda.gl.make_context" title="Permalink to this definition">¶</a></dt> <dd><p>Create and return a <a class="reference internal" href="driver.html#pycuda.driver.Context" title="pycuda.driver.Context"><tt class="xref py py-class docutils literal"><span class="pre">pycuda.driver.Context</span></tt></a> that has GL interoperability enabled.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">This will fail with a rather unhelpful error message if you don’t already have a GL context created and active.</p> </div> </dd></dl> <dl class="class"> <dt id="pycuda.gl.graphics_map_flags"> <em class="property">class </em><tt class="descclassname">pycuda.gl.</tt><tt class="descname">graphics_map_flags</tt><a class="headerlink" href="#pycuda.gl.graphics_map_flags" title="Permalink to this definition">¶</a></dt> <dd><p>Usage of OpenGL object from CUDA.</p> <dl class="attribute"> <dt id="pycuda.gl.graphics_map_flags.NONE"> <tt class="descname">NONE</tt><a class="headerlink" href="#pycuda.gl.graphics_map_flags.NONE" title="Permalink to this definition">¶</a></dt> <dd><p>Read and write access to mapped OpenGL object from CUDA code.</p> </dd></dl> <dl class="attribute"> <dt id="pycuda.gl.graphics_map_flags.READ_ONLY"> <tt class="descname">READ_ONLY</tt><a class="headerlink" href="#pycuda.gl.graphics_map_flags.READ_ONLY" title="Permalink to this definition">¶</a></dt> <dd><p>Read only access to mapped OpenGL object from CUDA code.</p> </dd></dl> <dl class="attribute"> <dt id="pycuda.gl.graphics_map_flags.WRITE_DISCARD"> <tt class="descname">WRITE_DISCARD</tt><a class="headerlink" href="#pycuda.gl.graphics_map_flags.WRITE_DISCARD" title="Permalink to this definition">¶</a></dt> <dd><p>Write only access to mapped OpenGL object from CUDA code. Reading is prohibited.</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="pycuda.gl.RegisteredBuffer"> <em class="property">class </em><tt class="descclassname">pycuda.gl.</tt><tt class="descname">RegisteredBuffer</tt><big>(</big><em>bufobj</em>, <em>flags = CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE</em><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredBuffer" title="Permalink to this definition">¶</a></dt> <dd><p>Object managing mapping of OpenGL buffers to CUDA. Cannot be used to map images.</p> <dl class="method"> <dt id="pycuda.gl.RegisteredBuffer.gl_handle"> <tt class="descname">gl_handle</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredBuffer.gl_handle" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="pycuda.gl.RegisteredBuffer.unregister"> <tt class="descname">unregister</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredBuffer.unregister" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="pycuda.gl.RegisteredBuffer.map"> <tt class="descname">map</tt><big>(</big><em>stream=None</em><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredBuffer.map" title="Permalink to this definition">¶</a></dt> <dd><p>Return a <a class="reference internal" href="#pycuda.gl.RegisteredMapping" title="pycuda.gl.RegisteredMapping"><tt class="xref py py-class docutils literal"><span class="pre">RegisteredMapping</span></tt></a>.</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="pycuda.gl.RegisteredImage"> <em class="property">class </em><tt class="descclassname">pycuda.gl.</tt><tt class="descname">RegisteredImage</tt><big>(</big><em>bufobj</em>, <em>target</em>, <em>flags = CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE</em><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredImage" title="Permalink to this definition">¶</a></dt> <dd><p>Object managing mapping of OpenGL textures and render buffers to CUDA.</p> <p><em>target</em> must be be one of:</p> <blockquote> <div><ul class="simple"> <li><cite>GL_TEXTURE_2D</cite></li> <li><cite>GL_TEXTURE_RECTANGLE</cite></li> <li><cite>GL_TEXTURE_CUBE_MAP</cite></li> <li><cite>GL_TEXTURE_3D</cite></li> <li><cite>GL_TEXTURE_2D_ARRAY</cite></li> <li><cite>GL_RENDERBUFFER</cite></li> </ul> </div></blockquote> <p>(see PyOpenGL docs)</p> <dl class="method"> <dt id="pycuda.gl.RegisteredImage.gl_handle"> <tt class="descname">gl_handle</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredImage.gl_handle" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="pycuda.gl.RegisteredImage.unregister"> <tt class="descname">unregister</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredImage.unregister" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="pycuda.gl.RegisteredImage.map"> <tt class="descname">map</tt><big>(</big><em>stream=None</em><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredImage.map" title="Permalink to this definition">¶</a></dt> <dd><p>Return a <a class="reference internal" href="#pycuda.gl.RegisteredMapping" title="pycuda.gl.RegisteredMapping"><tt class="xref py py-class docutils literal"><span class="pre">RegisteredMapping</span></tt></a>.</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="pycuda.gl.RegisteredMapping"> <em class="property">class </em><tt class="descclassname">pycuda.gl.</tt><tt class="descname">RegisteredMapping</tt><a class="headerlink" href="#pycuda.gl.RegisteredMapping" title="Permalink to this definition">¶</a></dt> <dd><dl class="method"> <dt id="pycuda.gl.RegisteredMapping.unmap"> <tt class="descname">unmap</tt><big>(</big><em>stream=None</em><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredMapping.unmap" title="Permalink to this definition">¶</a></dt> <dd><p>If no stream is specified, the unmap will use the same stream as the original mapping.</p> </dd></dl> <dl class="method"> <dt id="pycuda.gl.RegisteredMapping.device_ptr_and_size"> <tt class="descname">device_ptr_and_size</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredMapping.device_ptr_and_size" title="Permalink to this definition">¶</a></dt> <dd><p>Return a tuple <em>(dev_pointer, size)</em>.</p> </dd></dl> <dl class="method"> <dt id="pycuda.gl.RegisteredMapping.array"> <tt class="descname">array</tt><big>(</big><em>index</em>, <em>level</em><big>)</big><a class="headerlink" href="#pycuda.gl.RegisteredMapping.array" title="Permalink to this definition">¶</a></dt> <dd><p>Return an array for mapped image object for given array index and MIP level.</p> </dd></dl> </dd></dl> <div class="section" id="module-pycuda.gl.autoinit"> <span id="automatic-initialization"></span><h2>Automatic Initialization<a class="headerlink" href="#module-pycuda.gl.autoinit" title="Permalink to this headline">¶</a></h2> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Importing <a class="reference internal" href="#module-pycuda.gl.autoinit" title="pycuda.gl.autoinit"><tt class="xref py py-mod docutils literal"><span class="pre">pycuda.gl.autoinit</span></tt></a> will fail with a rather unhelpful error message if you don’t already have a GL context created and active.</p> </div> <dl class="data"> <dt id="pycuda.gl.autoinit.device"> <tt class="descclassname">pycuda.gl.autoinit.</tt><tt class="descname">device</tt><a class="headerlink" href="#pycuda.gl.autoinit.device" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="data"> <dt id="pycuda.gl.autoinit.context"> <tt class="descclassname">pycuda.gl.autoinit.</tt><tt class="descname">context</tt><a class="headerlink" href="#pycuda.gl.autoinit.context" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </div> <div class="section" id="old-style-pre-cuda-3-0-api"> <h2>Old-style (pre-CUDA 3.0) API<a class="headerlink" href="#old-style-pre-cuda-3-0-api" title="Permalink to this headline">¶</a></h2> <dl class="function"> <dt id="pycuda.gl.autoinit.init"> <tt class="descclassname">pycuda.gl.autoinit.</tt><tt class="descname">init</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.autoinit.init" title="Permalink to this definition">¶</a></dt> <dd><p>Enable GL interoperability for the already-created (so far non-GL) and currently active <a class="reference internal" href="driver.html#pycuda.driver.Context" title="pycuda.driver.Context"><tt class="xref py py-class docutils literal"><span class="pre">pycuda.driver.Context</span></tt></a>.</p> <p>According to the forum post referenced in the note below, this will succeed on Windows XP and Linux, but it will not work on Windows Vista. There you <em>have</em> to create the GL-enabled context using <tt class="xref py py-func docutils literal"><span class="pre">make_context()</span></tt>.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">This function is deprecated since CUDA 3.0 and PyCUDA 2011.1.</p> </div> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">This will fail with a rather unhelpful error message if you don’t already have a GL context created and active.</p> </div> </dd></dl> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">See this <a class="reference external" href="http://forums.nvidia.com/index.php?showtopic=88152">post</a> on the Nvidia forums for a discussion of problems and solutions with the GL interop interface.</p> </div> <dl class="class"> <dt id="pycuda.gl.autoinit.BufferObject"> <em class="property">class </em><tt class="descclassname">pycuda.gl.autoinit.</tt><tt class="descname">BufferObject</tt><big>(</big><em>bufobj</em><big>)</big><a class="headerlink" href="#pycuda.gl.autoinit.BufferObject" title="Permalink to this definition">¶</a></dt> <dd><div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">This class is deprecated since CUDA 3.0 and PyCUDA 2011.1.</p> </div> <dl class="method"> <dt id="pycuda.gl.autoinit.BufferObject.unregister"> <tt class="descname">unregister</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.autoinit.BufferObject.unregister" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="pycuda.gl.autoinit.BufferObject.handle"> <tt class="descname">handle</tt><a class="headerlink" href="#pycuda.gl.autoinit.BufferObject.handle" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="pycuda.gl.autoinit.BufferObject.map"> <tt class="descname">map</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.autoinit.BufferObject.map" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="pycuda.gl.autoinit.BufferObjectMapping"> <em class="property">class </em><tt class="descclassname">pycuda.gl.autoinit.</tt><tt class="descname">BufferObjectMapping</tt><a class="headerlink" href="#pycuda.gl.autoinit.BufferObjectMapping" title="Permalink to this definition">¶</a></dt> <dd><div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">This class is deprecated since CUDA 3.0 and PyCUDA 2011.1. It will be removed in PyCUDA 0.96.</p> </div> <dl class="method"> <dt id="pycuda.gl.autoinit.BufferObjectMapping.unmap"> <tt class="descname">unmap</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.autoinit.BufferObjectMapping.unmap" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="pycuda.gl.autoinit.BufferObjectMapping.device_ptr"> <tt class="descname">device_ptr</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.autoinit.BufferObjectMapping.device_ptr" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="pycuda.gl.autoinit.BufferObjectMapping.size"> <tt class="descname">size</tt><big>(</big><big>)</big><a class="headerlink" href="#pycuda.gl.autoinit.BufferObjectMapping.size" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">OpenGL</a><ul> <li><a class="reference internal" href="#module-pycuda.gl.autoinit">Automatic Initialization</a></li> <li><a class="reference internal" href="#old-style-pre-cuda-3-0-api">Old-style (pre-CUDA 3.0) API</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="util.html" title="previous chapter">Built-in Utilities</a></p> <h4>Next topic</h4> <p class="topless"><a href="array.html" title="next chapter">GPU Arrays</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/gl.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="array.html" title="GPU Arrays" >next</a> |</li> <li class="right" > <a href="util.html" title="Built-in Utilities" >previous</a> |</li> <li><a href="index.html">PyCUDA 2014.1 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2008, Andreas Kloeckner. Last updated on Jan 22, 2015. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>