Jump to content
  • Advertisement
Sign in to follow this  
ldb

glsl fragment shaders

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

My simple question involves dealing with several fragment shader programs. Is having N different program objects all compiled/linked during initialization and switching via glUseProgram(program) the most effecient way to do this? Or is there a detach/attach game with a single program-object that turns out to be faster?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by ldb
My simple question involves dealing with several fragment shader programs. Is having N different program objects all compiled/linked during initialization and switching via glUseProgram(program) the most effecient way to do this? Or is there a detach/attach game with a single program-object that turns out to be faster?

You can detach/attach shaders from a program object ofcourse but that won't have any effect until the program is linked again, which brings us back where we started. Changing shader program bindings is an expensive operation true, but with true dynamic branching that can be alleviated by using if-else blocks and clever manipulation of uniforms; however your first way is the way (atleast) I would currently prefer.

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!