PDA

View Full Version : HELP: quake 3 bsp questions



sixb0nes
07-18-2000, 04:10 PM
Greets!

I have successfully loaded vertex info from lump 11 of a
quake 3 bsp. I threw a wireframe onscreen to ensure
everything was working fine, which it was -- this brings me to my question:

... what do I do next?

I would like to get the map drawn with GL_TRIANGLES .. but
I get some whacked results when I use them over GL_POINTS/LINES.
Perhaps I need to use strips? .. maybe I need to use data from
another lump (face/surface lump)?

If anyone has links to some detailed q3 map specs, or some other
usable info (I have the unofficial quake 3 map specs,
and have looked over Aftershock) - it would be appreciated.

sixb0nes www.xpression.org (http://www.xpression.org)

XBCT
07-19-2000, 03:18 AM
You have to feed the face´s meshverts into glDrawElements(GL_TRIANGLE,....) and enable the vertices array with glVertexArray first....

Greets,XBTC!

sixb0nes
07-21-2000, 08:28 AM
XBCT-

I don't think I _need_ to use glDrawElements, or glDrawArrays, etc. I
could achieve the same thing by traversing
through the vertices and using glBegin()
and glEnd(). Sure it is faster, but I
should get similar results either way ..
correct?

Here is the pseudo for what I'm trying to
accomplish (i'm only displaying appropriate
face types):

(not = # triangles)
(nov = # vertices in face)

for each face in map
not = nov / 3
for each triangle in not
draw triangle
next triangle
next face

.. using GL_LINES I get something that
resembles the map - using GL_TRIANGLES looks
less than useful.

I've probably loaded my face lump incorrectly
or something.

-sigh-
sixb0nes www.xpression.org (http://www.xpression.org)

ribblem
07-21-2000, 10:18 AM
If all you want to do is load the triangles properly do the following (use triangle fans not triangles):

for(i=0;i<number of faces;++i)
{
glBegin(TRIANGLEFAN)
for(j=0;j<number of verts for this face;++j)
{
draw the verts
}
glEnd()
}

sixb0nes
07-21-2000, 10:39 AM
bingo -
thanks ribblem.

the code _was_ fine.. popped in GL_TRIANGLE_FAN and off to the races.

.. are they always stored as fans? - and if
i may be so intrusive, did you just look at
the vertex coords to figure this out? ..
or a q3 doc somewhere?

tia,
sixb0nes www.xpression.org (http://www.xpression.org)

XBCT
07-22-2000, 02:55 AM
Anyway you really should use glDrawElements + Vertex-arrays.In Q3 every surface needs at least two passes(at least!!) and if you cannot use glLockArraysExt you´ll end up transforming the same vertices as often as there are passes in the surface´s shader.
This will make your viewer unplayable!

Greets,XBTC!

sixb0nes
07-22-2000, 03:15 AM
XBCT-

My goal was to get something onscreen before anything else. I wanted to ensure my face
lump loader was working correctly, etc. Thanks anyway for the input.

Cheers,
sixb0nes www.xpression.org (http://www.xpression.org)

ribblem
07-22-2000, 08:41 AM
I agree, I'm just starting my viewer and wanted to get something viewing too. Right now I'm only loading one texture anyways. The way I have my code written it will be really easy to change it to vertex arrays.

As for how I figured out it was triangle fans I tried triangles and it didn't work. Then I tried triangle strips and it didn't work. So I tried fans and it worked. Real scientific like. :)

ribblem
07-22-2000, 12:12 PM
hey sixbOnes,

Just a word of warning...

I'm now reading in textures and couldn't get the textures to read in properly until I switched to vertex arrays. It really confused me for awhile casue my textures were messed up something fearce on some but not all of my triangles. I'm still not sure what the difference is between my old triangle fan method and my new vertex array method, but my new way works and the old one didn't. It is possible my old way had a typo in it, but I check and didn't see one a few times. So if you are having trouble with textures you might want to switch to vertex arrays like all these guys are saying.

XBCT
07-23-2000, 01:50 AM
"I'm now reading in textures and couldn't get the textures to read in properly until I switched to vertex arrays."

What has the code which reads in your textures to do with the code you draw the triangles with?I think I just don´t understand what you mean ´cause if you have to change for example your jpeg-loader if you change your rendering routines than there is some serious bad code-design going on.... http://www.opengl.org/discussion_boards/ubb/wink.gif

Greets,XBTC!

[This message has been edited by XBCT (edited 07-23-2000).]

sixb0nes
07-23-2000, 06:04 AM
XBCT-

I think he was referring to applying the textures, not loading them in. Again, it
shouldn't matter if you use arrays or not. Perhaps, ribblem, you did have a typo somewhere ;]

sixb0nes www.xpression.org (http://www.xpression.org)

ribblem
07-23-2000, 09:54 AM
Ya I was talking about applying the textures and it didn't make any sense to me either. But now it does, cause while I was thinking about it last night I realized my typo. I stupidly put all the vertex calls in a row followed by all the texCoord calls. Then when I switched to arrays all these calls were put in the right order. I tried it with my old code and that was it. Just a stupid-- not thinking -- mistake.