Sign in to follow this  
Rimio

Q3MAP2

Recommended Posts

Hey dudes, I wrote a simple Q3 loader and it seems to load standard q3 bsp files ok. However, any map compiled with q3map2 does not work (looks weird) in my loader but works in Quake 3. It is a pity, since GtkRadient is such a nice tool. Any ideea?

Share this post


Link to post
Share on other sites
Well yes. I was using triangle fans but found out i should be using indexed triangles. The problem is I cant get them working (however I believe I wrote good code). I will post snippets when I get home.

Share this post


Link to post
Share on other sites
Here's what I mean.

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.

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this