Graphics Reference
In-Depth Information
where topology must be one of the following:
points
lines
lines_adjacency
triangles
triangles_adjacency
Figure 12.1 also shows you that the geometry shader is followed by another
primitive assembly step. Thus, on the output side, a geometry shader needs to
tell that step what topology to use to assemble the emited vertices. To do this,
a second layout statement is included at the top of the code:
layout( topology , max_vertices= num ) out;
where topology must be one of the following:
points
line_strip
triangle_strip
and num is the maximum number of vertices that this geometry shader will
emit. All graphics cards have a maximum that num can be, usually around 1024.
New OpenGL API Functions
It is a litle clumsier, but you can also choose not to use the layout identi-
fiers and instead use glProgramParameteri( ) calls. The OpenGL function
glProgramParameteri( ) sets various parameters concerning the operation of
the geometry shader. There are three primary uses of this function
1. The number of vertices the geometry shader will be emiting is given by
glProgramParameteri( progname,
GL_GEOMETRY_VERTICES_OUT, intvalue)
where intvalue is that number. For many of the current graphics boards
(as of this writing), invalue can be as much as 1024. (1024 sounds like a
lot, but if you are trying to smooth a pyramid into a hemisphere, it isn't
nearly enough. This is one of the reasons that geometry shaders are not
intended for general level-of-detail work.)
Search WWH ::




Custom Search