[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Old pygame tutorial not working



On Tue, Aug 5, 2008 at 3:03 PM, Jake b <ninmonkeys@xxxxxxxxx> wrote:
ian: If I understand right, I think that for speed you're supposed to
avoid immediate mode ( begin/end) as much as possible. Looking at your
loop, is it possible to move begin/end out one more level, or not?
Nope.  Each pixel in the height map represents a vertex.  Thus, a 257x257 pixel heightmap yields a 256x256 quad world.  The normal way to define a quad is to define four vertices, but by using quad strips (triangle strips have the same effect) I can make the landscape in strips of quads each 256 quads long.  This requires only 514 vertex calls instead of the 1024 required to define each quad individually.  Moving "out one more level" would require all the data to be inputed at once, which as far as I know annoyingly can't be done (except with vertex arrays and VBOs which is what we're doing now).  I may be mistaken, but the speed issue is related to the number of OpenGL calls made and glBegin/End aren't especially long.

Ian