CUDA injected in OpenGL graphic pipeline Is it possible ?

Hello,

I’m new in GPGPU and i just discovered CUDA (was using GLSL).
I like the possibilites offered by CUDA in term of management of the GPU, GLSL is too high level for the kind of computations i want to do. CUDA allows me to have a lot of control over the GPU (especially shared/local memory and blocks access) and thus, implement much more optimized calculus.

But i wondered if there was a way to insert CUDA in the OpenGL graphic pipeline. I think I can simulate vertex shader with CUDA by using VBO. I can process post effects like render to texture + pixel shader by using FBO, but i can’t find a way to simulate classic pixel shaders. I mean accessing the pixel fragments created by opengl during rasterization, and having control over their texture coordinate, color, etc.

Any ideas ? Suggestions ? All i said in this post about CUDA may be wrong since i’m a real beginner.

PS: Sorry, my english is very poor

CUDA can communicate with an OpenGL app. Check the programming guide for exactly how that works.

If you mean accessing OpenGL buffer objects, that’s what I mentioned in my post. Or you are meaning something else ?

There is no way today to run a CUDA program directly on the output of the rasterizer (like a pixel shader) as you are describing. I agree this would be useful sometimes.

The only way to do this would be to render your triangles one by one and pass the image data to CUDA as pixel buffer objects, or just implement a rasterizer in CUDA!

That sounds really cool, actually.

I wonder what advantages a CUDA rasterizer might have. You could do some fancy tricks with it, with probably less headache than DX10 or OpenGL 3. I bet the performance wouldn’t be terrible either…

E.g. a CAD company company can use it for its rendering engine, and easily incorporate data-based effects and visualizations. This stuff would of course be possible with other latest-gen APIs, but something tells me it’d take less thinking to do it in CUDA.

That idea has been spinning around in my head for a while now… you could use templates to implement CUDA-based shaders into that rasterizer, and even stack multiple shaders (STL/boost-style template magic).

That could really be great (if it works out that way).