Original Post
🔒 Locked
Rendering a large grid
Advertisement
You have a grid, so just use a triangle strip to start.
For example, using one big degenerated triangle strip,
where vertex(.,.) is a macro which sends the texture and vertex coordinates, normals, and colors for points in the grid.
Next, you''ll want to add some level-of-detail support and view-frustrum culling. For example,
http://www.flipcode.com/cgi-bin/msg.cgi?showThread=05-14-2002&forum=iotd&id=-1
has one approach, although you''ll probably want to start with something simpler.
For example, using one big degenerated triangle strip,
glBegin(GL_TRIANGLE_STRIP); // use degenerated triangle strips
for(x = 0; x <= xmax; x += step) {
vertex(x, ymax); // degenerated
for(y = ymax; y >= 0; y -= step) {
vertex(x, y);
vertex(x + step, y);
}
vertex(x + step, y + step); // degenerated
}
glEnd();
where vertex(.,.) is a macro which sends the texture and vertex coordinates, normals, and colors for points in the grid.
Next, you''ll want to add some level-of-detail support and view-frustrum culling. For example,
http://www.flipcode.com/cgi-bin/msg.cgi?showThread=05-14-2002&forum=iotd&id=-1
has one approach, although you''ll probably want to start with something simpler.
for speed, use vertex arrays (vertex buffers in DX). yes, triangle strips are good. But you can make them faster, new video cards have vertex caches on them, usually 16 verticies (I think)... so, order your rendering to make the strips go through 16 vertices, then move across 1 column... repeat till then edge, then go up 1 row...
this could, in theory, reduce your vertex transforms to 56%.... which makes a noticable difference (I got about 40% boost in fps when I went from 1 big mesh to lots of smaller mesh''s)
this could, in theory, reduce your vertex transforms to 56%.... which makes a noticable difference (I got about 40% boost in fps when I went from 1 big mesh to lots of smaller mesh''s)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement