Multitexturing with Lightmaps

Hi,

I want to render a floor with 10*10 tiled floor-textures and a non-tiled lightmap. The lightmap shouldn’t cover the whole area of the quad, for example only 1/10 of the area. How can I move the Lightmap in any position that I want?

Here is my code:

        glActiveTexture(GL_TEXTURE0); //floor
        glEnable(GL_TEXTURE_2D); 
        glBindTexture(GL_TEXTURE_2D, texture[0]); 
        glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); 
        glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_REPLACE); 

//        glPushMatrix(); 
        glActiveTexture(GL_TEXTURE1); //lightmap 
        glEnable(GL_TEXTURE_2D); 
        glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT); 
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); //no wrap 
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP); 
        glMatrixMode(GL_TEXTURE); 
        glLoadIdentity(); 
        glTranslatef(-1.0f,0.0f, 0.0f);  //move lightmap 
        glBindTexture(GL_TEXTURE_2D, texture[39]); 
        glMatrixMode(GL_MODELVIEW); 
//        glPopMatrix(); 

        glBegin(GL_QUADS);  
            glNormal3f(0, 1, 0); 
              glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f); 
            glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f); 
            glVertex3f(0, 0, 0); 
            glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 10.0f);  //size of texture: 1/10
            glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 10.0f); 
            glVertex3f(0, 0, 49); 
            glMultiTexCoord2f(GL_TEXTURE0, 10.0f, 10.0f); 
            glMultiTexCoord2f(GL_TEXTURE1, 10.0f, 10.0f); 
            glVertex3f(49, 0, 49); 
              glMultiTexCoord2f(GL_TEXTURE0, 10.0f, 0.0f); 
            glMultiTexCoord2f(GL_TEXTURE1, 10.0f, 0.0f); 
            glVertex3f(49, 0, 0); 
        glEnd(); 

        glActiveTexture(GL_TEXTURE1); 
        glDisable(GL_TEXTURE_2D); 

        glActiveTexture(GL_TEXTURE0); 
        glDisable(GL_TEXTURE_2D);

My problem consist of the lightmap which will also be tiled.

I’m moving this to the beginners forum. You can move your lightmap around by adjusting the texture coordinates, and it’s repeating because you’re not binding it prior to changing its parameters.

– Tom

Can you give me a code snipet for this, because I don’t really understand how to realize that.
I want to illustrate my problem again with a little graphic:

-------------
|   |   |   |
-------------
|   |   | O |
-------------
|   |   |   |
-------------
|   |   |   |
-------------

These are 3x4 tiled textures on one QUAD, but I will only light up one or maybe two of them. Therefore I don’t want to use a big lightmap for the whole area.