I'm novice in OpenGL. And I try to move screen picture to the left by some pixels. I don't want to redraw full screen and move camera. How can I do it? Can I use ReadPixels and DrawPixels functions? Can anybody show me some examples?
Posted Thursday, 4 February, 2010 - 16:16 by the Fiddler
Redrawing the whole scene will be faster than any pixel operation (*significantly* faster in most cases). The correct approach would be to use a framebuffer object but that's even more complex than redrawing the whole scene.
In any case, you might be able to achieve a screen-to-screen copy using RasterPos (to set the offset) and CopyPixels. Frankly, I have no idea whether this is hardware accelerated in modern GPUs and whether this can be used on double-buffered contexts. The code would look something like this:
Note that RasterPos is affected by your current modelview and projection matrix, so make sure both are setup correctly. Moreover, rectangle should not be larger than your current viewport.
Anyway, I'd strongly suggest moving the camera and redrawing the whole scene but give this a try if you feel it's worth it.
Posted Thursday, 4 February, 2010 - 21:38 by zahirtezcan
The fastest way i know of is including framebuffer with BlitFramebuffer function. But, as Fiddler said it's rather complicated. Just to point out, moving picture some pixels is not same with moving the camera if you are using perspective projection.
Comments
Re: Moving screen picture
Redrawing the whole scene will be faster than any pixel operation (*significantly* faster in most cases). The correct approach would be to use a framebuffer object but that's even more complex than redrawing the whole scene.
In any case, you might be able to achieve a screen-to-screen copy using RasterPos (to set the offset) and CopyPixels. Frankly, I have no idea whether this is hardware accelerated in modern GPUs and whether this can be used on double-buffered contexts. The code would look something like this:
Note that
RasterPosis affected by your current modelview and projection matrix, so make sure both are setup correctly. Moreover, rectangle should not be larger than your current viewport.Anyway, I'd strongly suggest moving the camera and redrawing the whole scene but give this a try if you feel it's worth it.
Re: Moving screen picture
The fastest way i know of is including framebuffer with BlitFramebuffer function. But, as Fiddler said it's rather complicated. Just to point out, moving picture some pixels is not same with moving the camera if you are using perspective projection.