HP Workstation zx2000 HP OpenGL Implementation Guide for HP-UX 11.X (IPF versi - Page 37

textures, performance, use Array Sets and Arrays, Display, and Immediate Mode Vertex API. Note

Page 37 highlights

programming hints The amount of performance benefit depends upon several factors, including the number of primitives in the set, the length of the primitives in the set, and maximum rendering speed of the graphics device. To achieve optimum glDrawArraySetHP rendering performance, group as many primitives in each set as possible. using glDrawArraySetHP To use glDrawArraySetHP, the current vertex array must be set and enabled. This is done using glNormalPointer, glVertexPointer, glEnableClientState, and so on, or glInterleavedArrays. After the vertex array is established and enabled, glDrawArraySetHP may be used. The C declaration of glDrawArraySetHP is: void glDrawArraySetHP(GLenum mode, const GLint* list, GLsizei count); where: ❏ 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 is 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 is the number of primitives in the set to render. When glDrawArraySetHP is called, it iterates over count + 1 vertex array indices from list. Each index 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. OpenGL implementation guide 5-3

  • 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

OpenGL implementation guide
5–3
programming hints
The amount of performance benefit depends upon several factors, including the number of
primitives in the set, the length of the primitives in the set, and maximum rendering speed of the
graphics device.
To achieve optimum
glDrawArraySetHP
rendering performance, group as many primitives
in each set as possible.
using glDrawArraySetHP
To use
glDrawArraySetHP
, the current vertex array must be set and enabled. This is done
using
glNormalPointer
,
glVertexPointer
,
glEnableClientState
, and so on, or
glInterleavedArrays
. After the vertex array is established and enabled,
glDrawArraySetHP
may be used.
The C declaration of
glDrawArraySetHP
is:
void glDrawArraySetHP(GLenum mode,
const GLint* list, GLsizei count);
where:
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
is 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
is the number of primitives in the set to render.
When
glDrawArraySetHP
is called, it iterates over count + 1 vertex array indices from list.
Each index 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.