I try to implement the picking, my first implementation works fine but I would like to avoid using glReadPixels (because it is buggy on some graphics cards…). I use the depth coordinates in the select buffer (see glSelectBuffer) to find the picked object in the scene and I want to convert the smallest depth value into window Z coordinate in order to pass it directly to gluUnproject (the third parameter called winZ). I do this to convert the integer stored in the select buffer into a float:
float depthMin = 1.0f + ((float) zmin / 0x7fffffff);
Then, depthMin is between 0 and 1 but it does not match with the window coordinate that I get with glReadPixels. I think I have forgotten a step but which one? Please can you help me?