<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>NVIDIA CUDA Library: cudaGLSetGLDevice</title> <link href="customdoxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.8 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> </ul> </div> </div> <div class="contents"> <div class="navpath"><a class="el" href="group__CUDART__OPENGL.html">OpenGL Interoperability</a> </div> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="top"> <div class="navtab"> <table> <tr><td class="navtab"><a class="qindex" href="group__CUDART__OPENGL_gb16c58ea3958e29c9b15cad8e5b03969.html#gb16c58ea3958e29c9b15cad8e5b03969">cudaGLDeviceList</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__OPENGL_gcf14c650f5659b66aa7d9f3099ae5ade.html#gcf14c650f5659b66aa7d9f3099ae5ade">cudaGLGetDevices</a></td></tr> <tr><td class="navtab"><a class="qindexHL" href="group__CUDART__OPENGL_gc6502eba2a85a3f222dc960de8df8115.html#gc6502eba2a85a3f222dc960de8df8115">cudaGLSetGLDevice</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__OPENGL_g43f69a041bdfa4f8b36aff99bf0171db.html#g43f69a041bdfa4f8b36aff99bf0171db">cudaGraphicsGLRegisterBuffer</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__OPENGL_gd7be3ca8a7a739d57f0b558562c5706e.html#gd7be3ca8a7a739d57f0b558562c5706e">cudaGraphicsGLRegisterImage</a></td></tr> <tr><td class="navtab"><a class="qindex" href="group__CUDART__OPENGL_ga48bc83e2aeff82904589243a11b5e09.html#ga48bc83e2aeff82904589243a11b5e09">cudaWGLGetDevice</a></td></tr> </table> </div> </td> <td valign="top"> <a class="anchor" name="gc6502eba2a85a3f222dc960de8df8115"></a><!-- doxytag: member="cuda_gl_interop.h::cudaGLSetGLDevice" ref="gc6502eba2a85a3f222dc960de8df8115" args="(int device)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="group__CUDART__TYPES_gf599e5b8b829ce7db0f5216928f6ecb6.html#gf599e5b8b829ce7db0f5216928f6ecb6">cudaError_t</a> cudaGLSetGLDevice </td> <td>(</td> <td class="paramtype">int </td> <td class="paramname"> <em>device</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Records the calling thread's current OpenGL context as the OpenGL context to use for OpenGL interoperability with the CUDA device <code>device</code> and sets <code>device</code> as the current device for the calling host thread.<p> If <code>device</code> has already been initialized then this call will fail with the error <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038a906ddf08d574274bf7334adb1497550">cudaErrorSetOnActiveProcess</a>. In this case it is necessary to reset <code>device</code> using <a class="el" href="group__CUDART__DEVICE_gdcc2c6f914eb9461565b12648faa5e28.html#gdcc2c6f914eb9461565b12648faa5e28" title="Destroy all allocations and reset all state on the current device in the current...">cudaDeviceReset()</a> before OpenGL interoperability on <code>device</code> may be enabled.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>device</em> </td><td>- Device to use for OpenGL interoperability</td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd><a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038e355f04607d824883b4a50662830d591">cudaSuccess</a>, <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038938c6e8b96ecde62e3ab5137156f739a">cudaErrorInvalidDevice</a>, <a class="el" href="group__CUDART__TYPES_g3f51e3575c2178246db0a94a430e0038.html#gg3f51e3575c2178246db0a94a430e0038a906ddf08d574274bf7334adb1497550">cudaErrorSetOnActiveProcess</a> </dd></dl> <dl class="note" compact><dt><b>Note:</b></dt><dd>Note that this function may also return error codes from previous, asynchronous launches.</dd></dl> <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__CUDART__OPENGL__DEPRECATED_g007799061a53c40d49696b94908fac05.html#g007799061a53c40d49696b94908fac05" title="Registers a buffer object for access by CUDA.">cudaGLRegisterBufferObject</a>, <a class="el" href="group__CUDART__OPENGL__DEPRECATED_g9af8ea709470748d17bed128627f4a2e.html#g9af8ea709470748d17bed128627f4a2e" title="Maps a buffer object for access by CUDA.">cudaGLMapBufferObject</a>, <a class="el" href="group__CUDART__OPENGL__DEPRECATED_ge0b087bcfe521b66fe21d5845f46e59f.html#ge0b087bcfe521b66fe21d5845f46e59f" title="Unmaps a buffer object for access by CUDA.">cudaGLUnmapBufferObject</a>, <a class="el" href="group__CUDART__OPENGL__DEPRECATED_g2edd5be9aadf75d30dadc0faf07c7189.html#g2edd5be9aadf75d30dadc0faf07c7189" title="Unregisters a buffer object for access by CUDA.">cudaGLUnregisterBufferObject</a>, <a class="el" href="group__CUDART__OPENGL__DEPRECATED_gd62e033470cd4721f698e24d023f0ca7.html#gd62e033470cd4721f698e24d023f0ca7" title="Maps a buffer object for access by CUDA.">cudaGLMapBufferObjectAsync</a>, <a class="el" href="group__CUDART__OPENGL__DEPRECATED_g3ffebe5981aceb33ac9b3e96331719f5.html#g3ffebe5981aceb33ac9b3e96331719f5" title="Unmaps a buffer object for access by CUDA.">cudaGLUnmapBufferObjectAsync</a>, <a class="el" href="group__CUDART__DEVICE_gdcc2c6f914eb9461565b12648faa5e28.html#gdcc2c6f914eb9461565b12648faa5e28" title="Destroy all allocations and reset all state on the current device in the current...">cudaDeviceReset</a> </dd></dl> </div> </div><p> </td> </tr> </table> </div> <hr size="1"><address style="text-align: right;"><small> Generated by Doxygen for NVIDIA CUDA Library <a href="http://www.nvidia.com/cuda"><img src="nvidia_logo.jpg" alt="NVIDIA" align="middle" border="0" height="80"></a></small></address> </body> </html>