coplanar geometry

A little background first. I have an app that draws hundreds of thousands of polgyons to screen. The majority of this geometry is stored on disk and while a lesser amount is stored in memory. I have mechanisms in place to load geometry from disk and into memory as needed.

The amount of geometry is rather large. Some sets run into hundreds of megs of bytes. One interesting bit is all of the geometry is co-planar, that is all the geometry has a z coordinate that is set to 0.

The geometry is drawn using simple glDrawArrays calls.

OK, here’s my question. Is there a way to somehow eliminate the Z coordinate from my geometry sets yet still have all the geometry drawn on Z=0 plane? That is everytime I send my geometry to the hardware, it ‘knows’ to use Z=0 for my Z coordinate?

If I could do that I would cut down memory usage bigtime!

Can’t you just set the transform matrix and then use glvertex2f()? I am not sure if this is correct, but it seems like it would work.

Of course, my guess is it would be faster to draw all those brushes in one or a few passes, rather than transforming the matrix for each face of each object, and rendering each face separately.

Usually when people have that much geometry rendering in real-time, they use static meshes that share one set of vertices.

If you look at “vertex specification” in the OpenGL standard, you will see the function glVertex2fv(). You’ll also notice a “count” argument to glVertexPointer(). That’s hardly “advanced” usage of the API, though…

Excuse me, I made one mistake that changes things slightly. In this particular app it’s not the Z coordinate that’s 0, it’s the Y. Y is always 0.

I understand that when glVertex2f(…) is called, the Z coordinate is assumed to be 0, but what I want to do is this:

I have a coordinate that is x,y,z where x = 1, and z = 2. Y is always 0, not Z (at least not in this app).

Maybe through matrix manipulation the second coordinate of a glVertex2f call can be made to apply to the Z axis?

Draw on x0z plane & modify glulookat. Might be implemented differently, though.

I think what M/\dm/
is trying to say is that you could draw your geometry using X & Y and add an extra rotation into your Modelview matrix that would rotate the geometry into X & Z…

Yeah, I believe that’s what he’s saying. Anyway, I’ve already tested what you guys proposed and it does what I need. I should be able to reduce my memory requirement by 1/3.

I’ve thought about re-writing that part of the code to eliminate the Z coordinate for months now. I should’ve done this a long time ago.