   Render the Depth Buffer
  Hello everybody,I currently render the depth buffer in my application by copying it to a texture, clearing the screen and drawing a fullsize quad to display it. (2 passes)Somehow, this strikes me as an ugly way to go about and do it. Is it possible to just access the depth buffer in a GLSL shader and change the fragment color to it? This would allow me to do all this in one pass.// draw the mesh to fill the depth bufferglDisable(GL_LIGHTING);for (unsigned int i = 0; i < meshes.size(); i++){if (!visible){continue;}//setup_lighting(i);draw_mesh(i);}// copy depth buffer to textureglBindTexture(GL_TEXTURE_2D, depthTexture);glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 512, 512);// clear screencls();// enable texturing and bind the depth textureglEnable(GL_TEXTURE_2D);glBindTexture(GL_TEXTURE_2D, depthTexture);// overlay texture to fullsizequaddrawFullsizeQuad();
  this is the result I'm getting. I'd like to do this using shaders only.;  YeahIn the pixel shader you can use gl_FragCoord as an input, and if it's in screenspace then the z coord should be depth. Then draw that as a color output?   