PDA

View Full Version : Problem rendering Q3 BSP Maps



Alberto García
09-11-2014, 06:11 AM
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

Ruggero Visitnin
09-11-2014, 07:44 AM
Generally i don't like to reply with a link but, i have no idea how to help you because i never dealt with Quake 3 BSP file format sohere (http://www.flipcode.com/archives/Simple_Quake3_BSP_Loader.shtml) there is a tutorial pretty straight forward that i found, i hope it will help you.
concerning the rendering as all the other file format you have to adapt the data to Opengl.
i'm sorry but to give you a decent answer i need some times to make some try.

Alberto García
09-11-2014, 08:33 AM
That code is only to 'read' the BSP, not to draw, which is my problem.