0
votes

I've always drawn just one texture selecting the 0 texture unit

glActiveTexture(GL_TEXTURE0);

What's the criterion to choose another texture unit?

I mean: if I had to work with multiple textures, which unit should I choose? I'm a complete beginner to openGL and I was wondering if I could use the same 0 texture unit for all my graphic texturing. How many texture units are there? Can I use a maximum of N textures if there are N texture units?

1

1 Answers

1
votes

'The number of texture units is implementation dependent, but must be at least two.'

See: glActiveTexture Docs

After the glActiveTexture() call you bind a texture using glBindTexture(). You can bind multiple textures to the same unit. But only one of them is sampled.

See: Texture Binding

So if you have N texture units you can at most sample N textures in one shader.