PDA

View Full Version : How do you combine the shadow map with image textures?



Ozzlinn
06-21-2013, 07:51 PM
Hello,

I've got a shadow map working on some objects and they successfully cast shadows on each other. However, when I try to add image textures to the objects the images seem to override the shadow textures. For example, I initially call:

<code>
glBindTexture(GL_TEXTURE_2D, shadow_map_texture);
</code>


but when I call:

<code>
glBindTexture(GL_TEXTURE_2D,image_texture);
</code>

the shadows disappear. I am new to shadow mapping. Any ideas would help. Thanks!

tonyo_au
06-22-2013, 02:29 AM
If you wish to use 2 textures simultaneously you have to bind to different texture units. With fixed function code you use



glActiveTexture(GL_TEXTURE0);
glBindTexture(); // - texture 1
glActiveTexture(GL_TEXTURE1);
glBindTexture(); // - bind texture 2