PDA

View Full Version : Need advice with terrains



Javac
10-07-2003, 01:10 AM
I need an advice to create some realistic terrains from data files with x,y and height
in world coordinates.I'm working with Open Gl version 1.1.Should I do it with GL_TRIANGLE_STRIP or GL_QUAD_STRIP?
Is there any difference between them(excepting that quad strip will be twice faster)?

10-07-2003, 03:58 AM
It is suggested that you use triangles when rendering terrain. If you use quads, then you lose a degree of realism in the rendered terrain. When it comes to speed, it depends on how you have everything set up.
http://www.lighthouse3d.com/opengl/terrain/ http://www.robot-frog.com/3d/hills/heightmaps.html

10-07-2003, 04:00 AM
Also, if you plan on using collision detection and response with the terrain, then use triangles (trust me, you'll agree).

Javac
10-07-2003, 04:06 AM
Thank you a lot about tutorials!!!!
I found the answers!

Leyder Dylan
10-07-2003, 05:55 AM
Just for your information :




I. Geometry
1. What are the fastest transfer mechanisms for geometry?

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.


2. What are the fastest primitives to use?

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.


The GeForce2 GTS is able to setup primitives much faster than GeForce 256 or Quadro, so that all primitives are equally fast when accessing vertices in the vertex cache (see vertex cache question below for other details).

3. Which vertex array calls should I use?

Fastest
glDrawElements
Can take advantage of shared vertices and conserve front-side bus bandwidth by merely sending indices to the data.


glDrawArrays
The most efficient way to send vertices that are not shared, though much slower than glDrawElements in the common case of shared vertices.

Slowest
glArrayElement
Call overhead per vertex severely impacts performance. Avoid if at all possible.