Skip to main content
gamedev.net
🔒 Locked

cg program

Started by dhanyu Aug 1, 2005 at 8:20 PM 1 replies 450+ views
Original Post
dhanyu
dhanyu
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
_the_phantom_
_the_phantom_
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.
Lutz
Lutz
... and to add:
OpenGL and CG can't handle double values.
Every double is internally converted to float.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.