Hello, I want to use the OpenGL histogram to compute the area of each triangle. So, I give a different color for every triangle and then compute the histogram. The problem is that I only have 1020 colors (256 + 256 + 256 + 256) - 4 (RGBA) ( - 4 is due to the background) and I have to do several rendering passes, because I’m trying to render an object about 5400 triangles.
The first idea that comes to my mind is to use a pixel format RGBA16 so I’ll have more colors (65536 + 65536 + 65536 + 65536). I don’t know if it is possible. Previously I’ve used the pbuffer extensions for creating a buffer with this features:
WGL_DRAW_TO_PBUFFER_ARB,
GL_TRUE,
WGL_SUPPORT_OPENGL_ARB,
GL_TRUE,
WGL_FLOAT_COMPONENTS_NV,
GL_TRUE,
WGL_RED_BITS_ARB,
16,
WGL_GREEN_BITS_ARB,
16,
WGL_BLUE_BITS_ARB,
16,
WGL_ALPHA_BITS_ARB,
16,
WGL_DEPTH_BITS_ARB,
24,
And then I’ve tried this.
activate_pbuffer();
// clear all pixels.
glClear( GL_COLOR_BUFFER_BIT );
renderGeometry();
glHistogram(GL_HISTOGRAM, 65536, GL_RGBA16, GL_TRUE);
glEnable(GL_HISTOGRAM);
// Perform the pixel operation
glCopyPixels(0, 0, width, height, GL_COLOR);
glGetHistogram(GL_HISTOGRAM, GL_FALSE, GL_RGBA, GL_UNSIGNED_INT, histoGram);
glResetHistogram(GL_HISTOGRAM);
glDisable(GL_HISTOGRAM);
deactivate_pbuffer();
But it doesn’t work. Any idea?
Thank you in advance.