View Full Version : Fast depth&stencil buffer displaying...?
10-26-2000, 01:59 PM
I've tried several algo's to display fast on screen the depth buffer and the stencil buffer. I used glReadPixels and glDrawPixels, but it's extremely slow. I also thought about fogging the scene to emulate the z-buffer, but it's quite difficult to implement when i have complicated rendering techniques going on there. So the idea remains to display the actual depth&stencil buffer.
Anyone knows a fast way of doing this?
10-26-2000, 03:04 PM
Eh, to draw the stencil buffer, you could use um, 256 passes for an 8 bit stencil buffer. Each pass drawing a full screen quad of a given color, while using a stencil test to see if the stencil value is equivalent to the pass index. This would not exactly be fast however. Would it be faster than glReadPixels and glDrawPixels? I have no idea. Drawing the contents of the depth buffer would be quite a bit of a pain using this same type of method however. http://www.opengl.org/discussion_boards/ubb/tongue.gif
10-26-2000, 06:19 PM
What card is this?
On a GeForce, doing a ReadPixels of the depth or stencil buffer, followed by a DrawPixels of the same data into color, should go at a decent speed. Use a fixed-point type for best results, i.e. read back the depth as GL_UNSIGNED_BYTE and draw as GL_LUMINANCE, GL_UNSIGNED_BYTE. (Same for unsigned short or int, but the color buffer is only 8 bits per component, so there's no reason to use a larger buffer.)
10-28-2000, 01:04 PM
My card is not so popular, because it's very cheap. It's a nVidia Riva TNT2 Vanta. It's a classical TNT2 chipset with some modifications regarding cpu&mem speed, some functions, etc. It's not very fast, but using glDrawPixels and glReadPixels it's a real pain in the ass. Anyway, i don't intend to use it but for debuging/developing rendering techniques. Thanks for your suggestions, i'll try to give it a shot. http://www.opengl.org/discussion_boards/ubb/smile.gif
10-28-2000, 02:23 PM
Well, on 6.xx drivers, the ReadPixels of the stencil buffer should run at a "reasonable" speed even on a Vanta (not quite as fast as a GF, but not that much slower either). The DrawPixels may be slow, though.
A suggestion: use ReadPixels on the stencil buffer, and then draw a point for every pixel in the buffer with the appropriate color.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.