View Full Version : Draw the depth buffer as 2D image
05-14-2007, 02:01 AM
I need to draw on the color buffer the depth buffer,in a greyscale. I try with glcopypixel, but it went wrong..
Pratically, I need to use the depth buffer as an image, so I'm looking for a command or a method to do this.
05-14-2007, 02:47 AM
compute the depth manually. i do that for shadow cube maps, like this:
in your vs:
v_LightVector = u_LightPosition-gl_Vertex.xyz;and in your fs:
gl_FragColor.r = length( v_LightVector );v_LightVector is a varying vec3. instead of the light's position, you'd need the camera's, of course.
05-14-2007, 01:21 PM
In fixed function, CopyTexImage to a DEPTH_COMPONENT texture.
Draw that texture as a quad back to the window, as L, A, or I values.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.