Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Does calling glActiveTexture() even make sense when not using shaders?

I only have to switch the textures before drawing a buffer with glBindTexture(), right?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Yes, you do need texture units when not using shaders; if you look at the evolution of graphics hardware this will be obvious as multitexturing predated the programmable pipeline.

The classic old-school use case is Quake-style lightmapping, and in fact if you look at the Quake source code you'll see that it used multitexturing (via the old GL_SGIS_multitexture extension) and most definitely did not use shaders.

For this use you have one texture representing the diffuse colour, one representing the light colour/intensity, and you modulate them together to get the final surface colour.

The exception to this rule is if you're not doing multitexturing, of course. If you're only ever applying a single texture to your geometry then you can quite happily forget that texture units ever existed (since the default active texture unit is texture unit 0).

There is, by the way, no excuse to not use shaders in 2013; the old "old hardware" excuse is not valid any more and hasn't been for many years. Everything supports shaders nowadays and using them will make your life a lot easier.

share|improve this answer
    
+1, but I actually disagree that there is "no excuse to not use shaders", especially if you're targeting handheld or embedded systems -- or even some consoles. There are quite a few that are still alive and kicking that have either fixed-function pipelines or are only partially programmable. Also I've worked with a few platforms where both are available, but due to driver or hardware issues, the programmable pipeline has ... issues, and the fixed-function / GLES 1.1 pipeline is much faster. Hopefully this won't be the case much longer, but it definitely still is a concern for us! –  leander May 4 '13 at 18:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.