Any ideas of what I did wrong?
Is FBO rendering considered as valid per-pixel operation (since I am also using Pixel Sahders)? Is histogram computation compatible with it?
did you check if something went wrong after some call? A quick and dirty method to check this is by placing a
printf(“Error: %s”, gluErrorString(glGetError()));
after every related OpenGL call. You could also check whether your histogram is set to 0s by OpenGL by putting some pattern or random numbers in the array and check whether this pattern is the same after the calls.
mhagain, do you mean that there is no way to get hardware accelerated histogram function? I have to write some dirty code based on shaders?
“dirty code based on shaders” is hardware acceleration. And yes, odds are that glHistogram is not hardware accelerated; if you want to ensure performance in computing histograms, you will need “dirty code based on shaders.”
Google for GLSL histogram gives a few candidate approaches. HLSL histogram will likely give a few more (and converting sample HLSL code to GLSL is a complete no-brainer).
Wouldn’t it be easier to implement the histogram in OpenCL? If I read the docs correctly, it’s possible to share renderbuffers across OpenGL and OpenCL.