Jump to content
  • Advertisement
Sign in to follow this  
thmfrnk

OpenGL Change Effect Value while Shader is bounded

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

Hey,

 

I'm wondered that it is not possible to change a Shader Value (SetValue) of an Effect which was already bound.. In OpenGL it is possible to update any Uniform Variable even the shader still enabled. I think in some reasons this could cause a lot of CPU load. In my example I have a Scene graph including some meshes and each mesh haves a couble of subs with different materials. So I need to load (begin) and disable the shader for each sub, because of changing material and matrix... Same for my lighting pipeline.

 

I'm right or doing something wrong ?

 

Cheers,

Thomas

Share this post


Link to post
Share on other sites
Advertisement

Call "effect->CommitChanges()" after you change shader constant.

 

for_each_mesh

    effect->SetValue(...)

    effect->SetValue(...)

    ...

    effec->CommitChanges();

    draw()

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!