Let's say I've three different texture objects with different image data on them. These three texture objects are all bound to texture unit 0.
I've three models in my scene and each uses one of these textures.
In my fragment shader I've a sampler2D variable. And all models use the same shader program for rendering.
Now I do the following operations in sequence
- Bind texture object 1
Render model 1
Bind texture object 2
Render model 2
Bind texture object 3
- Render model 3
What is want to ask is this the way you texture different models with different textures and does the sampler in fragment shader reads data from currently bound texture. What happens if a texture is bound to a different texture unit, do I need a different sampler for that.