I split this off from the lighting thread because they're not really related.
Problems with texture mapping
- Textures drawn incorrectly
- Black spots from polygon bounds
- Slow as a snail in a coma
Addressing point 1Had to change the way you approached texture bundles. I've modified the SurfaceSet class (code files should be attached to this post). Basically, rather than 1 big Surface (which was being tiled on the
texturedPolygon routine, causing the weird image), it creates a seperate Surface for each texture.
Also, Globe.cpp was modified in the
Globe::setTexture method, when enumerating polygons
void Globe::setTexture(SurfaceSet *texture)
{
_texture = texture;
_texture->setPalette( this->getPalette() );
draw();
}
and
Globe::draw was modified thusly
texturedPolygon(getSurface(), (Sint16*)&x, (Sint16*)&y, (*i)->getPoints(), _texture->getFrame((*i)->getTexture())->getSurface(), 0, 0);
Addressing points 2 & 3I'm going to have a play at trying to re-write the texturedPolygon, hoping to improve performance, and might fix the polygon edges... We'll see...