cg program

Started by
1 comment, last by Lutz 18 years, 9 months ago
I wanted to write a simple cg program that take a value double n from opengl program and add some numbers in to that and return back to opengl. I know i have to use ....... cgGLSetParameter and cgGetNamedParameter. Anyway it didn't work right. need help thank you - Dhanyu
dhanyu
Advertisement
Cg doesnt work like that.
Cg operates on vertices and fragments, its final output is not to a variable but to a fragment which then ends up on the screen.

Now, you can do what you want todo but its a little more involved than what you were trying todo. You would have to write the shaders such that you processed the value you wanted and outputted it to a context and then either glCopyPixels() to retrive the value from the framebuffer or if you used a texture as a render target you could glGetTexImage() todo the same thing.
... and to add:
OpenGL and CG can't handle double values.
Every double is internally converted to float.

This topic is closed to new replies.

Advertisement