I am very new to computer graphics and if you don’t mind I would share some simple performance results.
The sample program displays 3DS objects.
The three objects (A, B, C) consist of triangles and each triangle has material properties and NO texture. The most naive way to displaying such object is
glBegin(GL_TRIANGLES)
loop all triangles
{
glMaterial(ambient, diffuse, specular, shininess)
loop all vertices in the current triangle
{
glNormal(), glVertex()
}
}
glEnd()
The results of this naive code are in row “BM”
Row “DL” is the same code implemented as display list.
Row “DLWM” is the same display list without glMaterial() functions.
Row “vert” is total number of vertices, “triang” is total number of triangles.
Measure is Frames per Second.
object A B C
vert 3726 7089 11781
triang 6885 10583 21692
BM 268 181 94
DL 349 242 124
DLWM 719 661 901
My conclusions:
- Display lists are really effective.
- glMaterial() is veeeery low. This means that polygons should be sorted by material and glMaterial() should be called only once when new materal replaces old one, not for every polygon.
Any comments, please??
P.S. As I go deeper in openGL, new tests will come - textures, multitextures, VBO, ets.