getting 3D information
To get the position in 3D we will simply use the Z component along with the X and Y components. You can also get the normals (which is essentially a vector perpendicular to the currently processed triangle) of the triangles as they are set (d3d_draw functions have the normals already). When you apply the shader to a 3D object then you can retrieve the normal which is useful for lighting.
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
Here is a screenshot of a simple 3D demo scene: