Name
gl.FeedbackBuffer -- controls feedback mode
Synopsis
buffer = gl.FeedbackBuffer(size, type)
Function
The gl.FeedbackBuffer() function controls feedback. Feedback, like selection, is a GL mode. The mode is selected by calling gl.RenderMode() 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.

gl.FeedbackBuffer() has two arguments: size indicates the size of the array that is to be returned, in items of #GL_FLOAT. type is a symbolic constant describing the information that is fed back for each vertex. gl.FeedbackBuffer() must be issued before feedback mode is enabled (by calling gl.RenderMode() with argument #GL_FEEDBACK). Setting #GL_FEEDBACK without establishing the feedback buffer, or calling gl.FeedbackBuffer() while the GL is in feedback mode, is an error.

When gl.RenderMode() is called while in feedback mode, it returns the number 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, gl.RenderMode() returns a negative value. To take the GL out of feedback mode, call gl.RenderMode() with a parameter value other than #GL_FEEDBACK.

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 gl.PolygonMode() 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 gl.PassThrough() command can be used to insert a marker into the feedback buffer. See gl.PassThrough for details.

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.

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

gl.FeedbackBuffer(), when used in a display list, is not compiled into the display list but is executed immediately.

Please note that gl.FeedbackBuffer() returns only the texture coordinate of texture unit #GL_TEXTURE0.

To free a buffer allocated by this function, call gl.FreeFeedbackBuffer(). See gl.FreeFeedbackBuffer for details.

Please consult an OpenGL reference manual for more information.

Inputs
size
specifies the maximum number of values that will be returned
type
specifies a symbolic constant that describes the information that will be returned for each vertex; #GL_2D, #GL_3D, #GL_3D_COLOR, #GL_3D_COLOR_TEXTURE, and #GL_4D_COLOR_TEXTURE are accepted
Results
buffer
pointer to feedback buffer
Errors
#GL_INVALID_ENUM is generated if type is not an accepted value.

#GL_INVALID_VALUE is generated if size is negative.

#GL_INVALID_OPERATION is generated if gl.FeedbackBuffer() is called while the render mode is #GL_FEEDBACK, or if gl.RenderMode() is called with argument #GL_FEEDBACK before gl.FeedbackBuffer() is called at least once.

#GL_INVALID_OPERATION is generated if gl.FeedbackBuffer() is executed between the execution of gl.Begin() and the corresponding execution of gl.End() .

Associated gets
gl.Get() with argument #GL_RENDER_MODE

gl.Get() with argument #GL_FEEDBACK_BUFFER_POINTER

gl.Get() with argument #GL_FEEDBACK_BUFFER_SIZE

gl.Get() with argument #GL_FEEDBACK_BUFFER_TYPE


Show TOC