From: Brian P. <br...@vm...> - 2009-09-14 16:52:39
|
Wei Fang wrote: > > hi, all > > using osmesa to do off screen render, i noticed that glReadPixels > and OSMesaGetDepthBuffer can both get the depth buffer. so what's the > difference between those two functions. is OSMesaGetDepthBuffer faster? glReadPixels is a standard GL function while OSMesaGetDepthBuffer is specific to Mesa's off-screen interface. The former copies pixels ou to of the color/depth buffer into your own buffer while later returns a pointer to the actually depth buffer memory. > and another question: how to convert the data getting from > OSMesaGetDepthBuffer to float? according to osmesa.h, it's 16bit float. > how to convert it to 32bit float? It's not 16-bit float. It's either 2 or 4-byte unsigned int (see the bytesPerValue parameter). You could convert a 16-bit ushort to float by dividing by 65535.0 -Brian |