12.07.2015 Views

4D Volume Rendering - Nvidia

4D Volume Rendering - Nvidia

4D Volume Rendering - Nvidia

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PBO Implementation- DrawDraw – app->pbo & pbo->tex transferm_curTimeStep ++;m_curTimeStep %= m_p<strong>Volume</strong>.size();static unsigned int curPBO = 0;glBindTexture(GL_TEXTURE_3D,texId);glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_nPBOIds[curPBO]); //bind pbo//Copy pixels from pbo to texture objectglTexSubImage3D(GL_TEXTURE_3D,0,0,0,0,xdim,ydim,zdim,GL_LUMINANCE,GL_UNSIGNED_BYTE,0);PBO to Texture//bind next pbo for app->pbo transferglBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_nPBOIds[1-curPBO]); //bind pbo//to prevent sync issue in case GPU is till working with the dataglBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, xdim*ydim*zdim*sizeof(GLubyte), 0, GL_STREAM_DRAW_ARB);GLubyte* ptr = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB);assert(ptr);memcpy(ptr,m_p<strong>Volume</strong>[m_curTimeStep],m_w*m_h*m_d);glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);App to PBOglBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB,0);curPBO = 1-curPBO;//TODO – Call drawing code here

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!