Original Post
I''m just about to begin on the graphics part of my(our really) 3d in 2d engine and I have a question about depthtesting.
My original idea was to first draw a mesh of the current scene, draw the pre-rendered background then draw the 3d-models on top of that and do the depth-testing against the scene mesh.
That approach brings a problem though. If using very complex scenes (and I''m probably talking about VERY complex scenes), the background mesh will also get very complex and will take alot of time to draw every frame. Also, the clipping would not get "perfect"
However, now I begun thinking about that instead of drawing a mesh for depth-testing, I could write directly to the depth buffer. However, the only way I found to do that is using the glDrawPixels function that should be REALLY slow. A solution to that would be to blit the pixels to the depth buffer, lock the depth bufffer, sort the 3d objects depth- wise and render them back-to-front (since I''ve locked the depth buffer because I only want to draw it once).
So, my question is if there is any faster way than using glDrawPixels for writing in the depth buffer and whetever I should stick to the first approach or try the depth blitting?
-Luctus
-Luctus