PDA

View Full Version : Orthographic-Space Drawing over Scene



strattonbrazil
12-03-2011, 12:29 PM
I'm currently rendering my scene using a typical perspective projection with the depth buffer enabled. Using that same projection, I project a variety of points in world space into screen space.

Using an orthographic projection, I'd like to draw these things points onto the screen such that the depth buffers sync intuitively. For example, if I render a cube at the origin, points projected onto the screen from (0,0,0) won't pass the depth test, while points "in front" of the cube will.

I have another post, where I seemed to misunderstand how to project these points as I was setting the ortho matrix to a 0-1 near/far range to match the projected ranges. The points would only show up, though, if I set the range to (-1,1) even if the projected z-coordinates passed from glVertex3f() were between (0,1).

http://www.opengl.org/discussion_boards/...6494#Post306494 (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Main=59056&Number=3064 94#Post306494)

What is the proper setup to get these points onto the screen with the correct depth? Negating them get them on the screen, but then they always seem to pass the depth test.