multitextures
I''m using light map.
When light texture id is active (!=0) for a set of polygons
I''m selecting multitextures, if not I''m using one texture.
In my scene I have lighted walls and unlightted wals.
In some circumstances the texture are get messed up on the
walls that are using one texture (texture is beeinbg replaced with other textures from around while I''m moving in 3d space).
Here is my code that does the
preparation.
What''s wrong !!!
glColor3fv(polygon.color);
if(textureID > 0)
{
glEnable(GL_TEXTURE_2D);
if(polygon.textureID > 0 && polygon.ilumtextureID > 0)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture(GL_TEXTURE_2D, polygon.textureID);
glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture(GL_TEXTURE_2D, polygon.ilumtextureID);
}
else
{
glBindTexture(GL_TEXTURE_2D, polygon.textureID);
}
}
glBegin(GL_TRIANGLE_STRIP);
{
PVtciItm it = polygon.v_pvtci.begin();
for(; it != polygon.v_pvtci.end();it++)
{
if((bool)it->clr) // vertex has it''s own color
glColor4fv((float*)it->clr);
if(polygon.ilumtextureID)
{
glMultiTexCoord2fARB(GL_TEXTURE0_ARB,it->tex.u, it->tex.v);
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,it->lm.u, it->lm.v);
}
else if(polygon.textureID)
{
glTexCoord2f(it->tex.u,it->tex.v);
}
glVertex3f(it->pt->x,it->pt->y,it->pt->z);
}
}
glEnd();
glDisable(GL_TEXTURE_2D);
buflea
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement