Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How do you combine the shadow map with image textures?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2013
    Posts
    8

    How do you combine the shadow map with image textures?

    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!

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,117
    If you wish to use 2 textures simultaneously you have to bind to different texture units. With fixed function code you use

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •