Jump to content
  • Advertisement
Sign in to follow this  
Ekast

Changing CG-Shader at runtime

This topic is 3916 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()
cgDestroyProgram(pShaderPtr->mVSProgram);

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!