Jump to content
  • Advertisement
Sign in to follow this  
Code-R

Setting uniforms when switching shaders

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

If I have 2 programs that I switch back and forth between, do I have to re-set the uniforms and re-get uniform locations everytime I switch between them?

Share this post


Link to post
Share on other sites
Advertisement
Quote:

9) Should uniform values be state per program object?

DISCUSSION: Should values loaded for uniforms be kept in a program
object, so that they are retained across program object switches? This
is application friendly. However, loading uniforms becomes a bit more of
a heavy weight operation because the OpenGL implementation now has to
store its values with the program object, and reload when the program
object is made current, even if the previous program object already had
the same uniform values loaded.


RESOLUTION: YES. We don't want to force an application to re-load its
uniforms every time a program object is used.


from the extension registry

Share this post


Link to post
Share on other sites
So in a word NO... Unless you want to update the uniform variable then you need to do glUniform4fvARB() after you call the GLSL program that will allow you to update the uniforms...

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!