Sign in to follow this  

Changing CG-Shader at runtime

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

This topic is 3724 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this