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: multitexturing -> multi pass

  1. #1
    Intern Contributor
    Join Date
    Apr 2000
    Location
    Hoegaarden, Belgium
    Posts
    73

    multitexturing -> multi pass

    i'm rendering a scene wich has a base texture/static lightmap/dynamic lightmap.
    I'm using 3 texture units for this:


    glActiveTextureUnit(GL_TEXTURE2_ARB); //Base map
    if (m_LightmapsOnly) glDisable(GL_TEXTURE_2D);
    else glEnable(GL_TEXTURE_2D);
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
    glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
    glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1);

    glActiveTextureUnit(GL_TEXTURE0_ARB); //Base lightmap
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
    glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
    glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1);
    glEnable(GL_TEXTURE_2D);

    glActiveTextureUnit(GL_TEXTURE1_ARB); //Dynamic 1
    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
    glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_ADD);
    glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1);
    glBindTexture(GL_TEXTURE_2D, 1); //!!!!!!!!!!!!!!!!!!!!!!!

    /* blah blah */

    glMultiTexCoord2f(GL_TEXTURE2_ARB,iterator->Vertices[iterator->Indices[i]].tu,iterator->Vertices[iterator->Indices[i]].tv) ;
    glMultiTexCoord2f(GL_TEXTURE0_ARB,iterator->Vertices[iterator->Indices[i]].lu,iterator->Vertices[iterator->Indices[i]].lv) ;
    glMultiTexCoord2f(GL_TEXTURE1_ARB,iterator->Vertices[iterator->Indices[i]].d1u,iterator->Vertices[iterator->Indices[i]].d1v) ;

    How can i achieve the same effect on a card that has only 2 tmus? I tried blending the dynamic lightmap over the modulated base texture and static lightmap, but that gives a lot of z-fighting. (and the wrong effect, i have to add static & dynamic map and then modulate it with the base texture)
    Can i draw anything else between the different passes of a multi-pass algorithm. ?
    I tried using polygonoffset, doesn't work. I'm probably using it in a wrong way.

    MtPOI

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2002
    Location
    Melbourne, Australia
    Posts
    239

    Re: multitexturing -> multi pass

    You shouldn't have z-fighting if you set depth function to GL_LEQUAL (and disable z-writing but that's only for optimization reasons).

Posting Permissions

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