GLFEEDBACKBUFFER(3G)
π GLFEEDBACKBUFFER π
okay bestie, gather round, because we're talking about glFeedbackBuffer from the 3G manual β yes the OpenGL one, the iconic one, the one that lets you spy on what the GL would have drawn instead of actually drawing it. it's giving surveillance but make it β¨graphicsβ¨.
πΈ NAME πΈ
glFeedbackBuffer β controls feedback mode π
β¨ C SPECIFICATION β¨
void glFeedbackBuffer( GLsizei size,
GLenum type,
GLfloat *buffer )
π¦ PARAMETERS π¦
sizeβ the max number of values that can be written intobuffer. like, the vibe capacity. πtypeβ a symbolic constant that describes what info gets returned for each vertex. the accepted ones areGL_2D,GL_3D,GL_3D_COLOR,GL_3D_COLOR_TEXTURE, andGL_4D_COLOR_TEXTURE. no others, periodt. πbufferβ returns the feedback data. this is where the tea gets poured. π΅
π DESCRIPTION π
So glFeedbackBuffer controls feedback. and feedback, just like selection, is a GL mode. you select it by calling glRenderMode with GL_FEEDBACK. when the GL is in feedback mode, no pixels are produced by rasterization β instead, all the info about the primitives that would have been rasterized gets fed back to the application using the GL. it's the "not me being a renderer, me being a reporter" era. π
glFeedbackBuffer has three arguments: buffer is a pointer to an array of floating-point values that feedback info gets placed into. size tells you how big that array is. type is the symbolic constant describing what's fed back for each vertex.
π¨ important, no cap:glFeedbackBuffermust be issued before feedback mode is enabled (that's by callingglRenderModewith argumentGL_FEEDBACK). settingGL_FEEDBACKwithout establishing the feedback buffer, or callingglFeedbackBufferwhile the GL is already in feedback mode, is an error. don't do it. π
When glRenderMode 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. and if the feedback data needed more room than was available in buffer, glRenderMode returns a negative value π. to take the GL out of feedback mode, call glRenderMode with a parameter value that isn't GL_FEEDBACK.
While in feedback mode, every primitive, bitmap, or pixel rectangle that would be rasterized generates a block of values that get copied into the feedback array. if doing that would make the number of entries exceed the max, the block gets partially written so as to fill the array (if there's any room left at all), and an overflow flag is set. each block starts with a code indicating the primitive type, then values describing the primitive's vertices and associated data. entries are also written for bitmaps and pixel rectangles.
Feedback happens after polygon culling and glPolygonMode interpretation of polygons has taken place, so polygons that are culled are not returned in the feedback buffer. it can also happen after polygons with more than three edges get broken up into triangles, if the GL implementation renders polygons by performing this decomposition. fyi. π«Ά
The glPassThrough command 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 RGBA mode and one value in color index mode.
feedbackList β feedbackItem feedbackList | feedbackItem
feedbackItem β point | lineSegment | polygon | bitmap |
pixelRectangle | passThru
point β GL_POINT_TOKEN vertex
lineSegment β GL_LINE_TOKEN vertex vertex | GL_LINE_RESET_TOKEN
vertex vertex
polygon β GL_POLYGON_TOKEN n polySpec
polySpec β polySpec vertex | vertex vertex vertex
bitmap β GL_BITMAP_TOKEN vertex
pixelRectangle β GL_DRAW_PIXEL_TOKEN vertex | GL_COPY_PIXEL_TOKEN
vertex
passThru β GL_PASS_THROUGH_TOKEN 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. 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 gives the correspondence between type and the number of values per vertex. k is 1 in color index mode and 4 in RGBA mode. (iconic variable, we stan π)
- Type:
GL_2Dβ Coordinates:x, yβ Color: (none) β Texture: (none) β Total Number of Values:2 - Type:
GL_3Dβ Coordinates:x, y, zβ Color: (none) β Texture: (none) β Total Number of Values:3 - Type:
GL_3D_COLORβ Coordinates:x, y, zβ Color:kβ Texture: (none) β Total Number of Values:3+k - Type:
GL_3D_COLOR_TEXTUREβ Coordinates:x, y, zβ Color:kβ Texture:4β Total Number of Values:7+k - Type:
GL_4D_COLOR_TEXTUREβ Coordinates:x, y, z, wβ Color:kβ Texture:4β Total Number of Values: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. no exceptions bestie. π
π NOTES π
glFeedbackBuffer, when used in a display list, is not compiled into the display list but is executed immediately. it simply refuses to be archived, main character energy fr. π₯
When the GL_ARB_multitexture extension is supported, glFeedbackBuffer returns only the texture coordinates of texture unit GL_TEXTURE0_ARB. just the one. that's it. π«Ά
π ERRORS π
GL_INVALID_ENUMis generated iftypeis not an accepted value.GL_INVALID_VALUEis generated ifsizeis negative.GL_INVALID_OPERATIONis generated ifglFeedbackBufferis called while the render mode isGL_FEEDBACK, or ifglRenderModeis called with argumentGL_FEEDBACKbeforeglFeedbackBufferis called at least once.GL_INVALID_OPERATIONis generated ifglFeedbackBufferis executed between the execution ofglBeginand the corresponding execution ofglEnd.
π¨ all four of those? errors. actual errors. not a drill, not a vibe, not a little oopsie. π
β ASSOCIATED GETS β
glGetwith argumentGL_RENDER_MODEglGetwith argumentGL_FEEDBACK_BUFFER_POINTERglGetwith argumentGL_FEEDBACK_BUFFER_SIZEglGetwith argumentGL_FEEDBACK_BUFFER_TYPE
π SEE ALSO π
glBegin(3G), glLineStipple(3G), glPassThrough(3G), glPolygonMode(3G), glRenderMode(3G), glSelectBuffer(3G)
and that's the whole page bestie, every last flag and token accounted for, nothing skipped, nothing invented, we ate and left zero crumbs π β¨
this was GLFEEDBACKBUFFER(3G) β the 3G manual, signed off the same way it started, because the glow is eternal. bye babe, go set up that feedback buffer before you enable feedback mode, i'm literally begging you ππ¦π
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms