pango
03-11-2008, 06:51 AM
the dowload(glReadPixels()) performance is the key to my program,so I think out 3 ways to do it:
method1 :
void RenderFunc()
{
glReadPixels();
RenderScene();
}
method2 :
void RenderFunc()
{
RenderScene();
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo0);
glReadPixels();
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo1);
BYTE * pMapBuffer = glMapBuffer();
copyBuffer(pDstBuffer,pMapBuffer);
glUnmapBuffer();
}
method3 :
void RenderFunc()
{
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo0);
glReadPixels();
RenderScene();
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo0);
BYTE * pMapBuffer = glMapBuffer();
copyBuffer(pDstBuffer,pMapBuffer);
glUnmapBuffer();
}
method2 and method3 use PBO to do asynchronous download,so I think they are better than method1(my test also prove it),but between method2 & method3,which is the best?
method1 :
void RenderFunc()
{
glReadPixels();
RenderScene();
}
method2 :
void RenderFunc()
{
RenderScene();
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo0);
glReadPixels();
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo1);
BYTE * pMapBuffer = glMapBuffer();
copyBuffer(pDstBuffer,pMapBuffer);
glUnmapBuffer();
}
method3 :
void RenderFunc()
{
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo0);
glReadPixels();
RenderScene();
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB,pbo0);
BYTE * pMapBuffer = glMapBuffer();
copyBuffer(pDstBuffer,pMapBuffer);
glUnmapBuffer();
}
method2 and method3 use PBO to do asynchronous download,so I think they are better than method1(my test also prove it),but between method2 & method3,which is the best?