Sign in to follow this  

Q3MAP2 Repost

This topic is 3875 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm reposting this problem since it took me a long time to post some relevant code. So here it is: I was drawing faces like this:
glDrawArrays(GL_TRIANGLE_FAN, Scene.BSPMap.fFaces[i].Vertex + Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces[i].MeshVert], Scene.BSPMap.fFaces[i].MeshVertCount);
which works ok for q3map compiled BSPs. On q3map2 compiled maps it looks weird (like triangles are missing, but actually is even more f***d up). I found out that in order to render a q3map2 BPS you should use the MeshVert array as an index to vertices you want to draw, which would produce a call like this:
glDrawElements(GL_TRIANGLES, Scene.BSPMap.fFaces[i].MeshVertCount, GL_INT, @Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces[i].MeshVert]);
However this gives me a blank screen. This is an alternate solution:
glBegin(GL_TRIANGLES);
for aux := 0 to Scene.BSPMap.fFaces[i].MeshVertCount-1 do
glVertex3fv(@Scene.BSPMap.fVertices[Scene.BSPMap.fFaces[i].Vertex + Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces[i].MeshVert] + aux].Position);
glEnd();
Which gives me errors the same way the triangle fan solution did. Any ideeas on what might go wrong?

Share this post


Link to post
Share on other sites
Fund problems:

1. GL_UNSIGNED_INT instead of GL_INT (opengl does not support negative indices). Worked ok with my signed int array though.

2. Aux was in the wrong place wrong. Right way is:


glVertex3fv(@Scene.BSPMap.fVertices[Scene.BSPMap.fFaces[i].Vertex +
Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces[i].MeshVert + aux]].Position);

Share this post


Link to post
Share on other sites
Sign in to follow this