Advertisement Jump to content
Sign in to follow this  
dhanyu

OpenGL cg program

This topic is 4915 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 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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
... and to add:
OpenGL and CG can't handle double values.
Every double is internally converted to float.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!