Rectangles appear as triangles

I am running a bsp loader that I found on the internet. It loads and renders (using opengl) version 46 bsp files (quake 3). When I run the application with the bsp file that comes with this sample program it displays four interconnected rooms with textures and lighting.

When I try to create my own simple room (four walls, ceiling, and floor) using gtkradiant and then load this bsp. I am able to load and render the bsp file but all six faces simply show up as triangles (properly textured) not the rectangles that they should show up as.

Any idea what I may be doing wrong (presumably in the bsp compilation phase) that would cause these polygons to show up as triangles?

When I look at the code I see that the faces (polygons) are all being rendered using the GL_TRIANGLE_FAN:

glDrawArrays(GL_TRIANGLE_FAN, polygonFacespolygonFaceNumber].firstVertexIndex,
polygonFaces [polygonFaceNumber].numVertices);

Try with GL_QUADS maybe?

If it doesn’t work, look at if the texture is a rectangle (posx.jpg or other).

You got the solution on your own ! So, whether you try to find how to model your scene with fan triangles or whether you change the code so that it can recognized other primitives. The last might be a bit hard, but the former might not be possible.

Hope that helps.