I’m writing a BSP file loader, it works fine whith some maps but load wrong another ones.
This is my render function:
void Process( )
{
int i, j;
glEnable( GL_TEXTURE_2D );
for ( i = 0; i < this->numOfFaces; i++ )
{
glBindTexture( GL_TEXTURE_2D, this->map_textures[this->faces[i].texture].id );
if ( this->faces[i].type == BSP_POLYGON_FACE )
{
glBegin( GL_TRIANGLE_FAN );
for ( j = this->faces[i].firstVertexIndex; j < this->faces[i].numVertices + this->faces[i].firstVertexIndex; j++)
{
glTexCoord2f( this->vertices[j].decalS, this->vertices[j].decalT );
glVertex3f( this->vertices[j].position.X( ), this->vertices[j].position.Y( ), this->vertices[j].position.Z( ));
}
glEnd( );
}
}
}
I have tested the vertices and faces data, and it seems that load fine.
Have anyone the method to render de BSP face data?
I hope your help,
Thanks in advance