Next | Prev | Up | Top | Contents | Index

Using the Histogram Extension

To collect histogram information, follow these steps:

  1. Call glHistogramExt() to define the histogram, for example:

    glHistogramEXT(GL_HISTOGRAM_EXT,

                  256               /* width (number of bins) */,
                  GL_LUMINANCE      /* internalformat */,
                  GL_TRUE           /* sink */);

  1. Enable histogramming by calling

    glEnable(GL_HISTOGRAM_EXT)

  2. Perform the pixel operations for which you want to collect information (drawing, reading, or copying pixels).

    For each component represented in the histogram internal format, let the corresponding component of the incoming pixel (luminance corresponds to red) be of value c (after clamping to [0, 1). The corresponding component of bin number floor((width-1)*c) is incremented by 1.

  3. Call glGetHistogramEXT() to query the current contents of the histogram:

    void glGetHistogramEXT( GLenum target, GLboolean reset, GLenum format,

    GLenum type, GLvoid *values )


Next | Prev | Up | Top | Contents | Index