Advertisement

Speed: Vertex arrays vs glVertex*

Started by December 11, 2002 07:32 AM
0 comments, last by Structural 22 years, 2 months ago
I''ve been reading a lot recently about the speed issues on openGL and I was kinda wondering what is actually faster: 1) Vertex/index/normal/texcoord arrays 2) giving each vertex/texcoord/normal with ordinary GL functions Obviously, and stated in many articles, is the array solution faster, but I''ve found out today that it has limitations. The first one being the fact that one vertex can only have ONE normal/texcoord. Thus, when you have a cube for example, where each vertice is part of 3 faces, you need 3 different normals and 3 different texcoords (different for each face). So basically to make the vertex/index array work you need to duplicate the vertice. That makes 3 times as many vertices as you would originally store when using the "ordinary" GL functions. This also goes for normals and texture coordinates, which equals to at least 9 times as many data in memory (in a simple model, this will grow exponentially for bigger/more complex models). So, I was wondering what the hell was actually faster. In either case 24 vertices are sent to the OGL layer and 24 texcoords. The only thing one could save on was normals, which, if only defined per face, would be 24 in arrays vs 6 with ordinary GL functions. So, what is actually faster? Making less calls to OGL with the vertex/index/etc array, but duplicating the vertices/texcoords/normals (which is basically a one-time operation) or giving each vertex/texcoord seperately with the GL functions and saving memory? ______________________________ If idiots could fly, I would be a space-shuttle.
STOP THE PLANET!! I WANT TO GET OFF!!
Arrays do have those limitations but they are *much* faster. Even just the difference in function call overhead will probably make the difference, not to mention whatever setup the system has to do before accepting a vertex. The difference outweighs the need to duplicate some vertices.

This topic is closed to new replies.

Advertisement