So, recently I followed this tutorial about shadow mapping, but in the tutorial it doesn't texture the object.. When I try to add a texture, it's distorted by the TexGen. Also I've tried to use glActiveTexture() with no success(dunno exactly how glActiveTexture() work).

So can anyone help me by adding textures into above code base? From there, I can learn how to use glActiveTexture() and overcome that TexGen issue.

Thanks in advance.. To note, I'm not using GLSL.


1 Answer 1


If multi-texturing is supported, texture coordinate generation will affect the active texture unit (quote from the documentation, emphasis is mine):

When the ARB_multitexture extension is supported, glTexGen sets the texture generation parameters for the currently active texture unit, selected with glActiveTexture.

So you simply need to make sure texture coordinates generation is disabled for the color texture, but enabled for the shadow texture. As you guessed, this is done with glActiveTexture(), by writing for example:

glActiveTexture(GL_TEXTURE0); // Assuming the color texture to be #0

glActiveTexture(GL_TEXTURE1); // Assuming the shadow texture to be #1
glTexGenfv(GL_S, GL_EYE_PLANE, textureMatrix.GetRow(0));
// [...]

This being said, you're adding to yourself a lot of trouble by sticking with fixed pipeline instead of using GLSL.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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