OpenGL razterization with CUDA

Hello everyone

I’m completely new to CUDA programming, and I’m thinking about doing graphics in CUDA, using OpenGL to handle the rasterization.

So what I have outlined currently is doing the following steps:

Have a stream of verticies, and pass them to a vertex shader (Written in CUDA), the output of the vertex shader should be send to the OpenGL rasterizer (Maybe i need to do some primitive assembly before this is possible). The output of the rasterizer will be passed to a fragment shader, and finally stored in a Frame buffer.

The step I’m having huge trouble finding any information about, is how to get data from CUDA to the OpenGL rasterizer (Is it even possible?).

So my question is, how do I pass data to the rasterizer (OpenGL), and get that data back?

I hope this is possible, and if anyone could point me to some material I can read.

Yes, it’s possible to transfer data directly between CUDA and OpenGL, and display that data using OpenGL. This is a general category of CUDA/OpenGL interop, and there are:

  1. Sample codes:

http://docs.nvidia.com/cuda/cuda-samples/index.html#key-concepts

look for the key concepts of “3D Graphics” and “Graphics Interop” to find lists of relevant sample codes.

  1. API documentation:

http://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__OPENGL.html#group__CUDART__OPENGL

http://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__INTEROP.html#group__CUDART__INTEROP

  1. Various presentations and resources to help you get started, here is one example:

http://www.nvidia.com/content/gtc/documents/1055_gtc09.pdf