View Full Version : How should I apply 'color texture' and 'shadow mapping' on one model meanwhile?

06-08-2013, 12:30 AM
I create a scene, which is composed of one md2 format model and one quad served as a ground. The md2 model has its own color texture, the color texture can be displayed correctly. But when I apply the shadow mapping on the scene, the color texture of the md2 model is displayed incorrectly, the texture coordinate is totally wrong, I feel the issue is in connection with TexGen procedure of shadow mapping, in which the glEnable(GL_TEXTURE_GEN_S/T/R/Q) is called, To my surprised, calling glEnable(GL_TEXTURE_GEN_S/T/R/Q) not only affects the GL_TEXTURE0 (for shadow mapping), but also affects the GL_TEXTURE1, to which the model texture object is bound. I had hoped it is only affect the GL_TEXTURE0.

Who can tell me how to use them properly meanwhile? Could you please show me some sample code?