Jump to content
  • Advertisement
Sign in to follow this  

Q3MAP2 Repost

This topic is 4058 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.Vertex + Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces.MeshVert], Scene.BSPMap.fFaces.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.MeshVertCount, GL_INT, @Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces.MeshVert]);
However this gives me a blank screen. This is an alternate solution:
for aux := 0 to Scene.BSPMap.fFaces.MeshVertCount-1 do
glVertex3fv(@Scene.BSPMap.fVertices[Scene.BSPMap.fFaces.Vertex + Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces.MeshVert] + aux].Position);
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.Vertex +
Scene.BSPMap.fMeshVerts[Scene.BSPMap.fFaces.MeshVert + aux]].Position);

Share this post

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!