View Full Version : ortho+perspective : depth problems

01-07-2004, 09:33 AM
i have a scene where my terrain is being generated and being displayed as a 2d textue of the framebuffer, which i display in a ortho mode. then sometimes i need to draw a 3d grid in perspective. everythin works fine. the 2d image is at the back and my 3d grid comes up, but now the problem is that the 3d grid is appearing over the 2dimage. i want a part of the grid over the image and the remaining at the back(hidden), but this is not possible with what i have right now. is there anyway i can do it?

01-07-2004, 10:33 AM

If you also generate a depth buffer for your terrain you could try writing it into video memory with glDrawPixels, but it'll be very slow.

A better idea could be drawing the grid in software too as it's propably pretty fast and then you could maybe get it occluded by the terrain.

But in the end... Is it really worth it to draw the terrain the way you're drawing? It'll propably keep causing unnecessary problems. Voxels were impressive back in the 90's, but today you can get at least as good quality with polygons, without the limitations and problems. The classic voxel algorithm (if that's even what you're doing) can be mapped to hardware which would solve your problem too, but it'll still be limited.


01-07-2004, 01:32 PM
does this statement write the data into the depthbuffer?
glDrawPixels intWidth, intHeight, pfDepthComponent, pxlFloat, sngDepthBuffer(0)