HP j6700 OpenGL Implementation Guide for HP-UX 11.x - Page 56

Gl_quads, Gl_quad_strip, Gl_triangle_strip

Page 56 highlights

programming hints OpenGL performance hints mode Specifies the primitive or primitives that will be created from the vertices. Ten symbolic constants are accepted: GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, and GL_POLYGON. list A sequence of starting indices in the enabled arrays. Each index is the start of a primitive in the set. The final value in the sequence indexes the end of the set. The total number of indices is count+1. count The number of primitives in the set to render. When glDrawArraySethp is called, it iterates over count + 1 vertex array indices from list. For 0 HP uses list[i+1] - list[i] sequential elements from each enabled array to construct a sequence of geometric primitives, beginning with element list[i]. Calling glDrawArraySethp(mode, list, count) is functionally equivalent to: for (i = 0; i < count; i++) glDrawArrays(mode, list[i], list[i+1]- list[i]); textures If calls to glTexImage are put into a display list, they may be cached. In general, for best performance, use Array Sets and Arrays, Display, and Immediate Mode (Vertex API). Note that if you are going to use the same texture multiple times, you may gain better performance if you put the texture in a display list. Another solution would be to use texture objects. Since 3D textures can potentially become very large, they are not cached. state changes and their effects on display lists If there are several state changes in a row, it is possible, in some circumstances, for the display list to optimize them. It is more efficient to put a state change before a glBegin, than after it. For example, this is always more efficient: glColor3f(1,2,3); glBegin(GL_TRIANGLES); glVertex3f(...); 54 Chapter 5

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62

programming hints
OpenGL performance hints
Chapter 5
54
mode
Specifies the primitive or primitives that will be
created from the vertices. Ten symbolic constants are
accepted:
GL_POINTS
,
GL_LINES
,
GL_LINE_STRIP
,
GL_LINE_LOOP
,
GL_TRIANGLES
,
GL_TRIANGLE_STRIP
,
GL_TRIANGLE_FAN
,
GL_QUADS, GL_QUAD_STRIP
, and
GL_POLYGON
.
list
A sequence of starting indices in the enabled arrays.
Each index is the start of a primitive in the set. The
final value in the sequence indexes the end of the set.
The total number of indices is count+1.
count
The number of primitives in the set to render.
When
glDrawArraySethp
is called, it iterates over count + 1 vertex array
indices from list. For 0 HP uses
list[i+1] - list[i]
sequential
elements from each enabled array to construct a sequence of geometric
primitives, beginning with element
list[i]
.
Calling
glDrawArraySethp(mode, list, count)
is functionally
equivalent to:
for (i = 0; i < count; i++)
glDrawArrays(mode, list[i], list[i+1]- list[i]);
textures
If calls to
glTexImage
are put into a display list, they may be cached. In
general, for best performance, use Array Sets and Arrays, Display, and
Immediate Mode (Vertex API). Note that if you are going to use the same
texture multiple times, you may gain better performance if you put the
texture in a display list. Another solution would be to use texture objects.
Since 3D textures can potentially become very large, they are not cached.
state changes and their effects on display lists
If there are several state changes in a row, it is possible, in some
circumstances, for the display list to optimize them.
It is more efficient to put a state change before a
glBegin
, than after it.
For example, this is always more efficient:
glColor3f(1,2,3);
glBegin(GL_TRIANGLES);
glVertex3f(...);