Convert GL_UNSIGNED_INT_24_8 packed depth stencil to float depth

Hello,

I want to get the depth values of the FBO's depth-stencil texture attachment as float.

First I read the values with their original packed integer format (GL_UNSIGNED_INT_24_8):
Code :

unsigned int values[CubeMapSize];
glBindTexture(GL_TEXTURE_CUBE_MAP, CubeMapHandle);
glGetTexImage(GL_TEXTURE_CUBE_MAP_POSITIVE_X /*reading one cube map side only*/, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, values);

Now I want to convert one value (here the first) to float-depth:

Code :

float depth = DoSomeConversion(values[0]);

Anybody knows how the correct conversion has to look like?

Maybe just take the upper or lower 24 bits and divide by 2^24 or something like that?

Help is really appreciated!