• Advertisement
Sign in to follow this  

glsl Uniforms, quick question

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