In feedback mode, each primitive that would be rasterized (or each call to glDrawPixels() or glCopyPixels(), if the raster position is valid) generates a block of values that's copied into the feedback array. The number of values is determined by the type argument to glFeedbackBuffer(), as listed in Table 12-1 . Use the appropriate value for the type of primitives you're drawing: GL_2D or GL_3D for unlit two- or three-dimensional primitives, GL_3D_COLOR for lit, three-dimensional primitives, and GL_3D_COLOR_TEXTURE or GL_4D_COLOR_TEXTURE for lit, textured, three- or four-dimensional primitives.
Each block of feedback values 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 pixel rectangles. In addition, pass-through markers that you've explicitly created can be returned in the array; the next section explains these markers in more detail. Table 12-2 shows the syntax for the feedback array; remember that the data associated with each returned vertex is as described in Table 12-1 . Note that a polygon can have n vertices returned. Also, the x, y, z coordinates returned by feedback are window coordinates; if w is returned, it's in clip coordinates. For bitmaps and pixel rectangles, the coordinates returned are those of the current raster position. In the table, note that GL_LINE_RESET_TOKEN is returned only when the line stipple is reset for that line segment.
| Primitive Type | Code | Associated Data |
|---|---|---|
Point | GL_POINT_TOKEN | vertex |
Line | GL_LINE_TOKEN or GL_LINE_RESET_TOKEN | vertex vertex |
Polygon | GL_POLYGON_TOKEN | n vertex vertex ... vertex |
Bitmap | GL_BITMAP_TOKEN | vertex |
Pixel Rectangle | GL_DRAW_PIXEL_TOKEN or GL_COPY_PIXEL_TOKEN | vertex |
Pass-through | GL_PASS_THROUGH_TOKE N | a floating-point number |
OpenGL Programming Guide