Hello,
what i basically want to do is saving and restoring my depth buffer.
My first (very stupid) approach for testing my algorithm was: copying the depth buffer via readpixels to RAM and afterwards write it back to the depthbuffer via Drawpixels.
Now as you all can imagine this is pretty slow with increasing viewport size (pixels).
so i thought: yeah, why copying the stuff to the cpu, lets leave it on the graphics card.
Yeah so i initialized a PBO and did all that with PBO (code follows).
My algorithm still works, but it is as slow as before, so no real performance boost although I am using PBOs.
Code:
initializing PBO:
glGenBuffers(1, &pbo);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER,pbo);
glBufferData(GL_PIXEL_UNPACK_BUFFER, window_wwindow_hsizeof(float), 0 , GL_DYNAMIC_DRAW);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER,0);
Read from Depth Buffer:
glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo);
glReadPixels(0,0,window_w,window_h,GL_DEPTH_COMPONENT, GL_FLOAT, (GLvoid*)0);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
Write it back:
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo);
glDrawPixels(window_w, window_h, GL_DEPTH_COMPONENT,GL_FLOAT, (GLvoid*)0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
So my question is:
Why is there no performance boost?
Am I forgetting something?
Thanks in advance for all your replies!