Jump to content
  • Advertisement
Sign in to follow this  

Changing CG-Shader at runtime

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

Hello, I´m currently working on an editor for my rendering engine to set up the entire level. I want to edit my shaders which are stored in text files at runtime and "reload" them to see changes immediately. I tried to do it like that: 1. Deleting the "old" shader using cgDestroyProgram:
//where mVSProgram stands for the CGprogram "data-type" returned by cgCreateProgramFromFile()

2. After that I tried to "attach" the new shader file using cgCreateProgramFromFile again:
pShaderPtr->mVSProgram = cgCreateProgramFromFile(GetCGContext(), CG_SOURCE, ShaderPtr->mFragmentShaderFileName[0], GetCGFProfile(), "main", NULL);

There is no crash of the program but the "new" shader looks like the old one. So I assume the "old" shader is still stored somewhere and has to be removed in some other way. Thanks in advance Ralph

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!