GLFEDBACKBUFER(3G) GLFEDBACKBUFER(3G)
NAME
glFeedbackBuffer - controls feedback mode
C SPECIFICATION
void glFeedbackBuffer( GLsizei size,
GLenum type,
GLfloat *buffer )
PARAMETERS
size Specifies the maximum number of values that can be written into
buffer.
type Specifies a symbolic constant that describes the information
that will be returned for each vertex. GL2D, GL3D,
GL3DCOLOR, GL3DCOLORTEXTURE, and GL4DCOLORTEXTURE are
accepted.
buffer Returns the feedback data.
DESCRIPTION
The glFeedbackBuffer function controls feedback. Feedback, like selec-
tion, is a GL mode. The mode is selected by calling glRenderode with
GLFEDBACK. When the GL is in feedback mode, no pixels are produced
by rasterization. Instead, information about primitives that would
have been rasterized is fed back to the application using the GL.
glFeedbackBuffer has three arguments: buffer is a pointer to an array
of floating-point values into which feedback information is placed.
size indicates the size of the array. type is a symbolic constant
describing the information that is fed back for each vertex.
glFeedbackBuffer must be issued before feedback mode is enabled (by
calling glRenderode with argument GLFEDBACK). Setting GLFEDBACK
without establishing the feedback buffer, or calling glFeedbackBuffer
while the GL is in feedback mode, is an error.
When glRenderode is called while in feedback mode, it returns the num-
ber of entries placed in the feedback array, and resets the feedback
array pointer to the base of the feedback buffer. The returned value
never exceeds size. If the feedback data required more room than was
available in buffer, glRenderode returns a negative value. To take
the GL out of feedback mode, call glRenderode with a parameter value
other than GLFEDBACK.
While in feedback mode, each primitive, bitmap, or pixel rectangle that
would be rasterized generates a block of values that are copied into
the feedback array. If doing so would cause the number of entries to
exceed the maximum, the block is partially written so as to fill the
array (if there is any room left at all), and an overflow flag is set.
Each block begins with a code indicating the primitive type, followed
by values that describe the primitive's vertices and associated data.
Entries are also written for bitmaps and pixel rectangles. Feedback
occurs after polygon culling and glPolygonode interpretation of poly-
gons has taken place, so polygons that are culled are not returned in
the feedback buffer. It can also occur after polygons with more than
three edges are broken up into triangles, if the GL implementation ren-
ders polygons by performing this decomposition.
The glPassThrough command can be used to insert a marker into the feed-
back buffer. See glPassThrough.
Following is the grammar for the blocks of values written into the
feedback buffer. Each primitive is indicated with a unique identifying
value followed by some number of vertices. Polygon entries include an
integer value indicating how many vertices follow. A vertex is fed
back as some number of floating-point values, as determined by type.
Colors are fed back as four values in RGBA mode and one value in color
index mode.
feedbackList <- feedbackItem feedbackList feedbackItem
feedbackItem <- point lineSegment polygon bitmap pixel-
Rectangle passThru
point <- GLPOINTOKEN vertex
lineSegment <- GLINETOKEN vertex vertex GLINERESETOKEN
vertex vertex
polygon <- GLPOLYGONTOKEN n polySpec
polySpec <- polySpec vertex vertex vertex vertex
bitmap <- GLBITMAPTOKEN vertex
pixelRectangle <- GLDRAWPIXELTOKEN vertex
GLCOPYPIXELTOKEN vertex
passThru <- GLPASTHROUGHTOKEN value
vertex <- 2d 3d 3dColor 3dColorTexture 4dColorTexture
2d <- value value
3d <- value value value
3dColor <- value value value color
3dColorTexture <- value value value color tex
4dColorTexture <- value value value value color tex
color <- rgba index
rgba <- value value value value
index <- value
tex <- value value value value
value is a floating-point number, and n is a floating-point integer
giving the number of vertices in the polygon. GLPOINTOKEN,
GLINETOKEN, GLINERESETOKEN, GLPOLYGONTOKEN, GLBITMAPTOKEN,
GLDRAWPIXELTOKEN, GLCOPYPIXELTOKEN and GLPASTHROUGHTOKEN are
symbolic floating-point constants. GLINERESETOKEN is returned
whenever the line stipple pattern is reset. The data returned as a
vertex depends on the feedback type.
The following table gives the correspondence between type and the num-
ber of values per vertex. k is 1 in color index mode and 4 in RGBA
mode.
Type Coords Color Tex Total # of Values
GL2D x, y 2
GL3D x, y, z 3
GL3DCOLOR x, y, z k 3]k
GL3DCOLORTEXTURE x, y, z k 4 7]k
GL4DCOLORTEXTURE x, y, z, w k 4 8]k
Feedback vertex coordinates are in window coordinates, except w, which
is in clip coordinates. Feedback colors are lighted, if lighting is
enabled. Feedback texture coordinates are generated, if texture coor-
dinate generation is enabled. They are always transformed by the tex-
ture matrix.
NOTES
glFeedbackBuffer, when used in a display list, is not compiled into the
display list but is executed immediately.
When the GLARBmultitexture extension is supported, glFeedbackBuffer
returns only the texture coordinates of texture unit GLTEXTURE00ARB.
ERORS
GLINVALIDENUM is generated if type is not an accepted value.
GLINVALIDVALUE is generated if size is negative.
GLINVALIDOPERATION is generated if glFeedbackBuffer is called while
the render mode is GLFEDBACK, or if glRenderode is called with argu-
ment GLFEDBACK before glFeedbackBuffer is called at least once.
GLINVALIDOPERATION is generated if glFeedbackBuffer is executed
between the execution of glBegin and the corresponding execution of
glEnd.
ASOCIATED GETS
glGet with argument GLRENDERMODE
glGet with argument GLFEDBACKBUFERPOINTER
glGet with argument GLFEDBACKBUFERSIZE
glGet with argument GLFEDBACKBUFERTYPE
SEE ALSO
glBegin, glLineStipple, glPassThrough, glPolygonode, glRenderode,
glSelectBuffer
GLFEDBACKBUFER(3G)
|