Jump to content
  • Advertisement
Sign in to follow this  

OpenGL CUDA and OpenGL interop

This topic is 1511 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I could use some advice..


I'm working on a somewhat experimental graphics engine which combines polygon rendering (OpenGL) with ray-casting (implemented in CUDA).

The polygons are always in front of the ray-cast content, so what I want to do is render the polygons first, then ray-cast only the pixels that haven't been drawn.


My original plan was to create a framebuffer containing colour and depth buffers, render the polygon content into it, then pass them to the CUDA kernel (using CUDA/OpenGL interop). The kernel could then use the depth buffer to determine which pixels still need to be rendered.

The problem is that CUDA doesn't appear to support accessing depth buffers.


Plan B was to use a stencil buffer, but a bit of Googling suggests they aren't supported by CUDA/OpenGL interop either (and also that you should always create a depth+stencil buffer, which sounds even less likely to be supported).


So plan C is to initialise the colour buffer to a special "un-drawn" value (possibly using the alpha channel). This would mean the kernel has to read from and write to the colour buffer though, which feels a bit dirty, and may have a performance impact.



Is there a simpler/cleaner solution to this? Or should I just go with C?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!