Sign in to follow this  
rcook

glsl Uniforms, quick question

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this