From: Dale Kirkland To: opengl-participants Subject: [opengl-participants] Histogram and Minmax Issues Date: Wed, 6 Sep 2000 10:51:06 -0500 In implementing minmax and histogram, we've encountered a couple of problems in both the SI and conformance that I'd like to get folks thinking about (and maybe vote on at the next ARB). -------------------------------------------------------------- The issues for histogram are: 1. In the histogram conformance test, one of the tests checks to see if HISTOGRAM_SYNC works. The routine TestRGB() is called to test the image data to make sure it didn't change. Because histogram is still enabled and HISTOGRAM_SYNC is enabled when TestRGB() is called, the ReadPixels call doesn't read anything. The test could fail or pass depending on what is in the buffer used by TestRGB(). To fix this, we've added a Disable(HISTOGRAM) before TestRGB() is called and before all of the returns. The changes for this are: 210a211 > glDisable(GL_HISTOGRAM); 223a225 > glDisable(GL_HISTOGRAM); 229a232 > glDisable(GL_HISTOGRAM); 235c238 < ** not been in effect. --- > ** not been in effect. Disable histogram prior to readback. 236a240 > glDisable(GL_HISTOGRAM); 241a246 > glEnable(GL_HISTOGRAM); 248a254,255 > /* Disable histogram prior to readback */ > glDisable(GL_HISTOGRAM); 253a261 > glEnable(GL_HISTOGRAM); 2. The SI does not treat the histogram values as color components. According to the 1.2 Spec for GetHistogram, "Pixel processing and component mapping are identical to those of GetTexImage." The SI returns the histogram value without any conversion. Maybe this is how the spec should have been written. Reading floating-point values back from the histogram that has and internal format of UNSIGNED_INT gives some awfully small values. 3. The SI does not support reading histogram values in packed-pixel formats. -------------------------------------------------------------- The issues for minmax are: 1. The minmax test uses the color.epsilon calculation which is based on the size of the color components for the image data in the frame buffer. There are 2 issues with this: 1) if the visual (pixel format) doesn't have an alpha buffer, then the epsilon for alpha is much smaller than the epsilon for RGB, 2) minmax has nothing to do with the frame buffer. The proposed change for this is to use a fixed epsilon. Seems like an epsilon that corresponds to an 8-bit color component should be the minimum. The changes for this are as follows: 33c33 < ** 2.5 * Color epsilon. Zero epsilons. --- > ** 1/255 43a44,48 > /* > * Epsilon is based on 8 bits of precision > */ > #define EPSILON_VALUE (1.0 / 255.0) > 79c84 < epsilon.color[startcomponent+j]) { --- > EPSILON_VALUE) { Let me know of any comments/issues. Dale Kirkland