View Full Version : glDrawElements

03-25-2006, 08:54 AM

I tried to improve performance of drawing models in my game. I tried with "glDrawElements(GL_TRIANGLES, ...)", before I found out, that it gives pure profits.

It is common, that some points are shared beetween triangles. It happens, that they have got identical position, and teture coordinates. But it's rare, that they have same normals. They do, only if they situated on a same plane (well, parallel, but they have same position, so it's the same).

Is there any way to specify different indexes for one point in arrays of Vertex, TexCoords and Normals? If not, how to improve rendering, if used type defines model as a set of triangles?

03-25-2006, 09:38 AM
No, not possible. There are several threads, discussing the pro and cons of such flexibility, but it has never been added to OpenGL.

The best way to improve vertex-throughput is simply by using "Vertex Buffer Objects" (VBO) together with glDrawRangeElements.


03-27-2006, 12:06 AM
you could calculate a vertex normal as the average of all connected trias. of course, this works only on smooth surfaces, not if there is a sharp edge...