Just to make my question clear, first I have a short explanation about my task. I would appreciate if you tell me any comment for each step of my work, since i am beginner in this stuff.
I want to render an image for display on a multilayer display, based on the z values of the picture. I found Blender as a rendering tool (it means i am completely new

So, for extracting z value in Blender, I opened a .blender image, clicked on "Render" menu, then wrote a short script of Python, like:
import bgl
zbuf = bgl.Buffer(bgl.GL_FLOAT, [100*100])
bgl.glReadPixels(150, 140, 100, 100, bgl.GL_DEPTH_COMPONENT, bgl.GL_FLOAT, zbuf)
But I got for all z values 1.0. I know almost nothing about working with Blender. Is there something I am missing?
And, is the process that i am going to do with the whole idea correct or achievable?
Thanks in advance