OpenGL in OptiX 7


I’m looking into OptiX-OpenGL interop. and I’m wondering about the state of it in OptiX 7.
There’s no explicit functionality for this as in previous releases, OptiX though can now work directly with CUDA device pointers, so is it functional to use CUDA-OpenGL interop. to import OpenGL buffers/textures and then use the imported device pointers in OptiX? If it is, are there any benefits or drawbacks to this approach compared to using the interop. functionality in OptiX 6.5?

(As you’ve probably guessed already the reason I want to do this is in order to utilize the RT cores through OptiX for scene data that originally reside in OpenGL objects.)

Hi founar,

OptiX 6.5 and earlier needs explicit interop since the handles you get from OptiX are not native device pointers. Since OptiX 7 uses raw device pointers and explicit CUDA streams, like you pointed out, OptiX doesn’t need any interop functionality beyond the interop you can find with CUDA. This goes for OpenGL as well as DirectX and Vulkan too. So the way to think about it is with OptiX 6.5 and earlier you need OpenGL-OptiX interop, and with OptiX 7+ you need OpenGL-CUDA interop. There is still an explicit API for interop, but the API is CUDA functions rather than OptiX functions.

All three of those APIs have some limitations in their interop with CUDA since they all deal in opaque buffer objects like OptiX used to. So you just need to draw from the knowledge base of OpenGL-CUDA interop in order to use OpenGL with OptiX 7. This set of slides is a bit dated, but I think still relevant to OpenGL-CUDA interop


I see, thanks a lot David.