views:

258

answers:

0

I have this for now:

    //Setup a move to the current position.
    glLoadIdentity();
    glTranslatef(squarePosition.x, squarePosition.y, 0);

//A simple base texture for "diffuse map".
glBindTexture(GL_TEXTURE_2D, spriteTexture[0]); //Bind.

    //Draw vertex/texture into the framebuffer.
    glVertexPointer(2, GL_FLOAT, 0, spriteVertices);
    glEnableClientState(GL_VERTEX_ARRAY);
    glTexCoordPointer(2, GL_SHORT, 0, spriteMappingCoordinates);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

//An additional grayscale image for "specular map".
glBindTexture(GL_TEXTURE_2D, spriteTexture[1]); //Bind.

    //Draw vertex/texture into the framebuffer.
    glVertexPointer(2, GL_FLOAT, 0, spriteVertices);
    glEnableClientState(GL_VERTEX_ARRAY);
    glTexCoordPointer(2, GL_SHORT, 0, spriteMappingCoordinates);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);  

And I want to do it with one single polygon by multi-texturing method, somethin' around glTexEnvi, but I just cannot figure out how to do it exactly. A really simple light-commented code could help me a lot, thanks in advance.