PDA

View Full Version : glReadPixel and volume rendering - SLOW!!



02-23-2006, 01:35 AM
Hi, i have a code at hand that was written by someone else, its written for volume rendering using volume renderer terarecons volumepro1000.

The problem is that when rendering polygon using opengl, a glReadpixels for depth data is needed to read from opengl buffers into the volume rendering buffers inorder to have depth test btween the polygan and the volume, and its this Readpixels that causes significant amt of slowdown. disabling the readpixels has no problems with slowdowns but there will be no depth test btween volume and opengl. There must be somewhere wrong with the codes and definately not hardware limitations since the demo program provided by volumepro1000 does render smoothly in both worlds. I simply can't figure out the source of problem by comparing both codes since iam not proficient in both volume and opengl rendering. PLS help anyone.THANKS!!!


glutWireCube(m_dCubeSize);
// Read back the OpenGL buffers //SLOW
glReadPixels(0, 0, m_nWndWidth, m_nWndHeight, GL_DEPTH_COMPONENT, GL_FLOAT, m_pOpenglDepth);

//convert the depth value in DepthData to m_pOpenglDepth;
//for the max value allowed in DepthBuffer is 0xffffff, a comparison must be made
//between the deptdata and 0xffffff.

for (int i = 0; i < m_nWndWidth * m_nWndHeight; ++i){
m_pOpenglDepth[i] = VMin((VLIuint32)(DepthData[i]*16777215), 0xFFFFFFUL);
}