Open topic with navigation
OptiX supports the sharing of data between OpenGL applications and both
rtTextureSamplers. This way, OptiX applications can read data directly from objects such as vertex and pixel buffers, and can also write arbitrary data for direct consumption by graphics shaders. This sharing is referred to as interoperability or interop.
OptiX supports interop for OpenGL buffer objects, textures, and render buffers. OpenGL buffer objects can be read and written by OptiX program objects, whereas textures and render buffers can only be read.
Note that OpenGL interop in combination with VCA remote rendering is only available in limited form (only regular buffers are allowed, not textures). Interop use is discouraged with remote rendering for performance reasons.
OpenGL buffer objects like PBOs and VBOs can be encapsulated for use in OptiX with
rtBufferCreateFromGLBO. The resulting buffer is only a reference to the OpenGL data; the size of the OptiX buffer as well as the format have to be set via
rtBufferSetFormat. When the OptiX buffer is destroyed, the state of the OpenGL buffer object is unaltered. Once an OptiX buffer is created, the original GL buffer object is immutable, meaning the properties of the GL object like its size cannot be changed while registered with OptiX. However, it is still possible to read and write buffer data to the GL buffer object using the appropriate GL functions. If it is necessary to change properties of an object, first call
rtBufferGLUnregister before making changes. After the changes are made the object has to be registered again with rtBufferGLRegister. This is necessary to allow OptiX to access the objects data again. Registration and unregistration calls are expensive and should be avoided if possible.
OpenGL texture and render buffer objects must be encapsulated for use in OptiX with
rtTextureSamplerCreateFromGLImage. This call may return
RT_ERROR_MEMORY_ALLOCATION_FAILED for textures that have a size of 0. Once an OptiX texture sampler is created, the original GL texture is immutable, meaning the properties of the GL texture like its size cannot be changed while registered with OptiX. However, it is still possible to read and write pixel data to the GL texture using the appropriate GL functions. If it is necessary to change properties of a GL texture, first call
rtTextureSamplerGLUnregister before making changes. After the changes are made the texture has to be registered again with
rtTextureSamplerGLRegister. This is necessary to allow OptiX to access the textures data again. Registration and unregistration calls are expensive and should be avoided if possible.
Only textures with the following GL targets are supported:
Supported attachment points for render buffers are:
Not all OpenGL texture formats are supported by OptiX. A table that lists the supported texture formats can be found in Appendix A.
OptiX automatically detects the size, texture format, and number of mipmap levels of a texture.
rtTextureSampler(Set/Get)Buffer cannot be called for OptiX interop texture samplers and will return
NVIDIA® GameWorks™ Documentation Rev. 1.0.171006 ©2014-2017. NVIDIA Corporation. All Rights Reserved.