Jump to content
  • Advertisement
Sign in to follow this  
rcook

glsl Uniforms, quick question

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

I have a basic glsl shader, one of the things I'm doing is tiling textures and wanted to do so inside my shader. Can I just rebind the uniform which represents the 2d texture for each different tile? Something like this: foreach(tile) { tex_uniform = tiles_tex; draw_tile(); } Or does setting uniforms just keep overwriting it and only the last time it gets called is visible?

Share this post


Link to post
Share on other sites
Advertisement
yes that will work
though instead of tex_uniform = tiles_tex; u have the correct code I assume eg glUniform1i(..)

though ideall u would sort the tiles based on what texture they use + only call glUniform when the texture changes

Share this post


Link to post
Share on other sites
Yep it worked out just fine.

I wanted to double check my assumptions about the project because I was having an error (nothing drawing).

Found out it was just some calls I was making inside glBegin I shouldn't have :)

Gracias for the response

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!