GLHISTOGRAM(3G)
โจ glHistogram โ define histogram table โจ
okay bestie, welcome to glHistogram, a page from section 3G of the manual (that's the OpenGL-adjacent girlies ๐
). She's short, she's specific, and she's about to redefine your histogram table. let's go ๐ฆ
๐ C SPECIFICATION
void glHistogram( GLenum target,
GLsizei width,
GLenum internalformat,
GLboolean sink )
๐ PARAMETERS
targetโ the histogram whose parameters we're setting. literally has to be one ofGL_HISTOGRAMorGL_PROXY_HISTOGRAM, no other options bestie.widthโ how many entries are in the histogram table. must be a power of 2. that's the vibe check, and it is not optional ๐internalformatโ the of entries in the histogram table. (no bestie, the blank is in the original, I am not making that up, the source really did just leave a hole there ๐ญ not me being the one to report it faithfully.) must be one ofGL_ALPHA,GL_ALPHA4,GL_ALPHA8,GL_ALPHA12,GL_ALPHA16,GL_LUMINANCE,GL_LUMINANCE4,GL_LUMINANCE8,GL_LUMINANCE12,GL_LUMINANCE16,GL_LUMINANCE_ALPHA,GL_LUMINANCE4_ALPHA4,GL_LUMINANCE6_ALPHA2,GL_LUMINANCE8_ALPHA8,GL_LUMINANCE12_ALPHA4,GL_LUMINANCE12_ALPHA12,GL_LUMINANCE16_ALPHA16,GL_R3_G3_B2,GL_RGB,GL_RGB4,GL_RGB5,GL_RGB8,GL_RGB10,GL_RGB12,GL_RGB16,GL_RGBA,GL_RGBA2,GL_RGBA4,GL_RGB5_A1,GL_RGBA8,GL_RGB10_A2,GL_RGBA12, orGL_RGBA16.sinkโ if it'sGL_TRUE, the pixels get consumed by the histogramming process โ no drawing, no texture loading, they're gone, they ate and they left no crumbs ๐ฝ๏ธ. if it'sGL_FALSE, the pixels move on to the minmax process after histogramming like nothing happened.
๐ DESCRIPTION
when GL_HISTOGRAM is enabled, RGBA color components get converted into histogram table indices by clamping them to the range [0,1], multiplying by the width of the histogram table, and rounding to the nearest integer. then the table entries those RGBA indices picked out get incremented. (and if the internal of the histogram table includes luminance โ same mystery blank, same energy ๐ โ then the index derived from the R color component decides which luminance table entry gets incremented.) if a histogram table entry gets incremented past its maximum value, its value becomes undefined. that is not an error. it's just chaos. periodt.
histogramming only happens for RGBA pixels (though those pixels might have started out as color indices and gotten converted to RGBA by index table lookup). you turn it on with glEnable and off with glDisable.
when target is GL_HISTOGRAM, glHistogram redefines the current histogram table so it has width entries of the specified by internalformat. the entries are indexed 0 through widthโ1, and every single entry is initialized to zero. whatever was in the previous histogram table, if anything was, is lost ๐. and if sink is GL_TRUE, pixels get discarded after histogramming โ no further processing of those pixels happens at all, and no drawing, texture loading, or pixel readback will result. they're just gone, bestie.
when target is GL_PROXY_HISTOGRAM, glHistogram computes all the state information as if the histogram table were about to be redefined, but doesn't actually define the new table. sneaky. if the requested histogram table is too big for anyone to support, the state information gets set to zero. it's basically a vibe check you can run ahead of time to find out whether a histogram table with those parameters can even be supported ๐ฎ
๐ NOTES
glHistogram is only present if GL_ARB_imaging comes back when glGetString is called with an argument of GL_EXTENSIONS. so check first, bestie.
๐จ ERRORS
GL_INVALID_ENUMgets generated iftargetisn't one of the allowable values.GL_INVALID_VALUEgets generated ifwidthis less than zero, or is not a power of 2.GL_INVALID_ENUMgets generated ifinternalformatisn't one of the allowable values.GL_TABLE_TOO_LARGEgets generated iftargetisGL_HISTOGRAMand the histogram table you specified is too large for the implementation. she simply cannot hold all that ๐GL_INVALID_OPERATIONgets generated ifglHistogramgets executed between the execution ofglBeginand the corresponding execution ofglEnd. do not do that. that's the rule.
๐ ASSOCIATED GETS
glGetHistogramParameter
๐ SEE ALSO
glGetHistogram(3G)glResetHistogram(3G)
okay that's the whole page, you ate it ๐
the footer of this one is just GLHISTOGRAM(3G) on its own line โ no source, no version, no date, that's all she gave us โ so that's the sign-off: GLHISTOGRAM(3G), that's it, that's the whole outro ๐ซถโจ
๐ฆ 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