Vertizor
2004.09.27, 05:43 PM
Rather than start a new thread, I figured I would just revive this discussion on depth testing.
Not sure how similar my current problem is to Wheatie's problem, but here goes:
I'm trying to setup a scene like a 3D modeling application(*). My problem is, I'm not entirely sure how to setup depth testing properly. When I draw my [standard, required] grid plane using glBeing(GL_LINES), if it's draw first, then my geometry after, the polygons always overlap the grid lines. If I invert it (draw model first, grid after) the gridlines completely overlap the polygons, even though based on the world coords, the polygons should obscure the gridlines. Basically when I want to achieve is: the grid plane will cover the 0y plane, if a model (a box for ex.) is half above this plane, and have below this plane, the part that's below it should appear to be behind the grid lines. The part that's above the 0y mark should appear on top of the grid lines. This whole "appearance" invovles rotating the view to certain angles where I can see the grid plane intersect the model.
I realize that I could just partition my model (or better yet partition my whole scene) and reorder the drawing calls to create the desired effect. I was hoping for a better solution from OpenGL.
* - Before anyone rolls their eyes and say: "oh great another 3D modeling app." Let me explain. I'm not trying to make another 3D modeling app per se. I'd rather work on making a UV unwrapping tool for skinning.
Not sure how similar my current problem is to Wheatie's problem, but here goes:
I'm trying to setup a scene like a 3D modeling application(*). My problem is, I'm not entirely sure how to setup depth testing properly. When I draw my [standard, required] grid plane using glBeing(GL_LINES), if it's draw first, then my geometry after, the polygons always overlap the grid lines. If I invert it (draw model first, grid after) the gridlines completely overlap the polygons, even though based on the world coords, the polygons should obscure the gridlines. Basically when I want to achieve is: the grid plane will cover the 0y plane, if a model (a box for ex.) is half above this plane, and have below this plane, the part that's below it should appear to be behind the grid lines. The part that's above the 0y mark should appear on top of the grid lines. This whole "appearance" invovles rotating the view to certain angles where I can see the grid plane intersect the model.
I realize that I could just partition my model (or better yet partition my whole scene) and reorder the drawing calls to create the desired effect. I was hoping for a better solution from OpenGL.
* - Before anyone rolls their eyes and say: "oh great another 3D modeling app." Let me explain. I'm not trying to make another 3D modeling app per se. I'd rather work on making a UV unwrapping tool for skinning.