OpenGL C bindings library: libGL.a
void glFeedbackBuffer(GLsizei Size, GLenum Type, GLfloat *Buffer)
The glFeedbackBuffer subroutine controls feedback. Feedback, like selection, is a GL mode. The mode is selected by calling glRenderMode with GL_FEEDBACK. 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.
The glFeedbackBuffer subroutine has three arguments:
The glFeedbackBuffer subroutine must be issued before feedback mode is enabled (by calling glRenderMode with argument GL_FEEDBACK). Setting GL_FEEDBACK without establishing the feedback buffer, or calling glFeedbackBuffer while the GL is in feedback mode, results in an error.
The GL is taken out of feedback mode by calling glRenderMode with a parameter value other than GL_FEEDBACK. When this is done while the GL is in feedback mode, glRenderMode returns the number of entries placed in the feedback array. The returned value never exceeds Size. If the feedback data requires more room than is available in Buffer, glRenderMode returns a negative value.
While in feedback mode, each primitive that would be rasterized generates a block of values that get 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 glPolyMode interpretation of polygons 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 renders polygons by performing this decomposition.
The glPassThrough subroutine can be used to insert a marker into the feedback 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 red, green, blue, alpha (RGBA) mode and one value in color index mode.
where value is a floating-point number, and n is a floating-point integer giving the number of vertices in the polygon. GL_POINT_TOKEN, GL_LINE_TOKEN, GL_LINE_RESET_TOKEN, GL_POLYGON_TOKEN, GL_BITMAP_TOKEN, GL_DRAW_PIXEL_TOKEN, GL_COPY_PIXEL_TOKEN and GL_PASS_THROUGH_TOKEN are symbolic floating-point constants. GL_LINE_RESET_TOKEN 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 number of values per vertex. The variable k is 1 in color index mode and 4 in RGBA mode.
Type | Coordinates | Color | Texture | Total Number of Values |
GL_2D | x, y | 2 | ||
GL_3D | x, y, z | 3 | ||
GL_3D_COLOR | x, y, z | k | 3+k | |
GL_3D_COLOR_TEXTURE | x, y, z | k | 4 | 7+k |
GL_4D_COLOR_TEXTURE | 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 coordinate generation is enabled. They are always transformed by the texture matrix.
The glFeedbackBuffer subroutine, when used in a display list, is not compiled into the display list but rather is executed immediately.
Associated gets for the glFeedbackBuffer subroutine are as follows. (See the glGet subroutine for more information.)
glGet with argument GL_RENDER_MODE.
glGetPointerv with argument GL_FEEDBACK_BUFFER_POINTER.
/usr/include/GL/gl.h | Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |
The glBegin or glEnd subroutine, glGetPointerv subroutine, glLineStipple subroutine, glPassThrough subroutine, glPolygonMode subroutine, glRenderMode subroutine, glSelectBuffer subroutine.