Rendering Quake 3 maps (opengl).

Rendering Quake 3 maps (opengl).

Post by Steven Haggert » Tue, 29 Aug 2000 04:00:00



Hi all,
    I understand that Q3 uses the glRenderElements() (this has been
mentioned in a number of docs)
to render its meshes. This is all well and good until you find that the Q3
vertex structure is as follows:
(According to the unofficial spec...)

{
float[3] position  Vertex position.
float[2][2] texcoord  Vertex texture coordinates. 0=surface, 1=lightmap.
float[3] normal  Vertex normal.
ubyte[4] color  Vertex color. RGBA.

Quote:}

glRenderElements is used to hop around the interleaved array plucking
vertices out and rendering them.
glRenderElements is normally used so you dont transform a point more than
once right? The old
shared vertices thing that we've all used. But what is the chance of having
a vertex that shares
position and texture co-ords and vertex normal and colour? Surely zero? Why
not use glDrawArrays
with a few more vertices?

Any thoughts (maybe Kekoa Proudfoot has some ideas?)

Cheers

Steve.

 
 
 

Rendering Quake 3 maps (opengl).

Post by Charles E Hardwidg » Wed, 30 Aug 2000 10:48:30


Quack uses glDrawElements. It also falls back to glBegin...End when
glLockArraysEXT is not available. I suspect other trickery is got up to as
well.

--
Anti-spam: Replace nospam with blueyonder to reply

 
 
 

1. Using Quake map coordinates with OpenGL

Help! I am new to 3D programming and OpenGL so forgive me if I am
missing something really obvious or basic. I am trying to make a 1st
person walk through that will use coordinates from a Quake map file. For
simplicity's sake I want to be able to use a map file instead of a bsp
file. I have read the Quake Map Specs but I haven't been able to find an
answer to this question or at least missed it if it was there. The
coordinates are in X,Y, and Z arrays and I have been drawing them
sequentially using a for loop. I'm having a hard time understanding how
with 3 of coordinates you can define 1 face of a cube. I've been working
under the assumption that each row of coordinates defines a face however
I'm not sure where to get the 4th coordinate. The following is a solid
cube from one of the Quake map files that I've been working with.  

( -64 64 64 ) ( 64 64 64 ) ( 64 -64 64 )  
( -64 -64 -64 ) ( 64 -64 -64 ) ( 64 64 -64 )
( -64 64 64 ) ( -64 -64 64 ) ( -64 -64 -64 )  
( 64 64 -64 ) ( 64 -64 -64 ) ( 64 -64 64 )  
( 64 64 64 ) ( -64 64 64 ) ( -64 64 -64 )  
( 64 -64 -64 ) ( -64 -64 -64 ) ( -64 -64 64 )  

If I draw these coordinates sequentially with GL_TRIANGLES I of course
end up with a triangle for each face instead of a square. The faces are
in the right place but incomplete. For simplicity's sake I use a for
loop to cycle through the coordinates.  

glBegin(GL_TRIANGLES);          
        for(i=l;i=numverts;i++){
                glVertex3f(x1[i],y1[i],z1[i]);  
        }              
glEnd();

I would use GL_QUADS but I can't figure out where to get the 4th
coordinate needed to complete the quad face. Is there a simple formula
based on the 1st 3 coordinates to determine the 4th coordinate or am I
approaching this the wrong way? I would love to find a formula that
would work with any Quake map including complex ones. Any suggestions
would be much appreciated.

Jim Holmquist

2. animation

3. opengl texture mapping and rendering to bitmap

4. glAlphaFunc() question

5. Problem using FireGL version of OpenGL to render texture-mapped fonts in GL_ALPHA format

6. mac software, OCASSION

7. quake .map exporter

8. 3DSite's Jobs by Mail - makes too much sense to be bypassed!

9. .MAP-exporter for Quake or similar

10. Quake Map exporter

11. calculating textures U and V from quake Map files

12. Help with planes and faces (quake maps)

13. Quake's spherical mapping