5
glProgramParameter Must Be Called Before the Shaders are Linked
glProgramParameteriEXT( progname, GL_GEOMETRY_OUTPUT_TYPE_EXT, int value )
The primitive type that this
Geometry Shader will be sending
on to the rest of the pipeline
GL_POINTS
mjb – May 10, 2009
_
_
GL_TRIANGLE_STRIP
Warning: glProgramParameteriEXT( ) calls can go into a Display List,
deferring their execution until it is too late! (Bad idea…)
This gets executed
now
.
GLuint dl = glGenLists( 1 );
glNewList( dl, GL_COMPILE );
. . .
program = glCreateProgram();
. . .
lPro
ramParameteriEXT
ro
ram
GL GEOMETRY INPUT TYPE EXT
in
utGeometr
T
e
____
glProgramParameteriEXT( program, GL_GEOMETRY_OUTPUT_TYPE_EXT, outputGeometryType );
glProgramParameteriEXT( program, GL_GEOMETRY_VERTICES_OUT_EXT, 101 );
glLinkProgram( program );
glUseProgram( program );
. . .
glEndList( );
mjb – May 10, 2009
This gets executed
now
, probably with
the wrong Program Parameter settings,
generating an unexpected Link Error!
These get executed later, whenever
the display list is glCallList’ed.
Moral: If you are creating a display list from a stream of input data, defer both the setting of
Program Parameters and the Linking of the Program until after the Display List is complete.
There is rarely a good reason to have calls to glProgramParameteriEXT( ) in a display list.
评论9
最新资源