PDA

View Full Version : It's all about vertices...



B_old
10-29-2002, 05:35 AM
Hello.
I have a few questions about the way to display the 3D-objects in my application.

First I wonder wether I shall have all objects as a group of triangles or may I use quads as well? (I want the fastest of course)
Or does it actually matter?

Then I read about different ways to transfer the geometric data to the GPU:
Immediate mode
Display lists
(Compiled) Vertex arrays
What is this about?

Has the geometry to do with the T&L-unit?
Do I use it automatically (trough OpenGL) or do I need to write special code to use it?

Well, any advice on this stuff would be very nice to hear.
Thanks a lot.

Leyder Dylan
10-29-2002, 09:12 AM
This answer comes from a NVIDIA called "OpenGL Performance"

Very excellent document

1.

Fastest
GL_TRIANGLE_STRIP

GL_TRIANGLE_FAN

GL_QUAD_STRIP
These maximize reuse of the vertices shared within a given graphics primitive, and are all similarly fast.


GL_TRIANGLES

GL_QUADS
These aggregate (potentially multiple) disjoint triangles and quads, and amortize function overhead over multiple primitives.

Slowest
GL_POLYGON
A bit slower than the independent triangles and quads.


===========================================


2.

Fastest
DrawElements/DrawArrays Using wglAllocateMemoryNV(size,0,0,1)
Saves data in video memory, eliminating any bus bottleneck. Very poor read/write access.


DrawElements/DrawArrays Using wglAllocateMemoryNV(size,0,0,.5)
Saves data in AGP (uncached) memory, and allows hardware to pull it directly. Very poor read access, must write sequentially (see below)


Display Lists
Can encapsulate data in the most efficient manner for hardware, though they are immutable (i.e. once created, you canít alter them in any way).


DrawElements using

Compiled Vertex Arrays (glLockArraysEXT)
Copies locked vertices to AGP memory, so that the hardware can then pull it directly. Only one mode is supported (see q, 7 below).


DrawElements and DrawArrays using Vertex Arrays with Common Data Formats
Optimized to assemble primitives as efficiently as possible, and minimizes function call overhead. 13 formats supported (see q. 6).


Immediate Mode
Multiple function calls required per primitive results in relatively poor performance compared to other options above.

Slowest
All Other Vertex Arrays
Must be copied from application memory to AGP memory before the hardware can pull it. Since data can change between calls, data must be copied every time, which is expensive.


=======================================

3. T&L is automatic. But now, instead of T&L, the Vertex Shader is the new generation. But the GeForce 3 & 4 always support T&L for comptability.

B_old
10-30-2002, 01:35 AM
OK, thanks.
That was very usefull information for me.

EDIT:
I know to use DisplayLists. But I wonder if they are very common.
For if I get it right you would have to compile a list for virtually every brush in your game world? Or is this still better than calling a simple 'DrawCube'-function which performs the drawinf of a cube.
By the way I made a test, DisplayList vs. 'DrawCube' and I could no see any difference in performance, strange huh?

What is the trick about VertexArrays? Does it need any special gl-commands or what?
Thanks for the help as I maybe will start trying to display a 'map' soon.


[This message has been edited by B_old (edited 10-30-2002).]