iDevGames Forums
glCopyTexImage2D and clipping - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: glCopyTexImage2D and clipping (/thread-4798.html)



glCopyTexImage2D and clipping - james_the_bard - Nov 14, 2005 10:48 AM

Hey, I'm having this problem with a current GLUT based project of mine. I'm implementing simple full screen motion blur by placing a textured box over the whole scene with a faded version of the previous frame as the texture. My problem is that in order to get the texture large enough to contain the entire previous frame, I have to use glViewport to set the viewport to something like 1024x1024 (large enough to represent a 640x480 screen), then I call glCopyTexImage2D and use that as my bases for the next frame.

However, my problem is that it only copies the bottom left 640x480 pixels of the viewport (as if glViewport does not have the desired effect), so I only end up with a small portion of the required image. I'm guessing this is because the dimensions of the draw buffer are set by the windowing system (GLUT for now, but I may want to place this in an NSOpenGLView at some point), and pixel transfers for glCopyTexImage2D are undefined outside the drawing buffer's dimensions.

Has anyone else had this problem, and know of a solution, or perhaps an even better way of implementing full scene motion blur (preferably not the accumulation buffer since that is not hardware accelerated)?

Thanks in advance!


glCopyTexImage2D and clipping - akb825 - Nov 14, 2005 12:01 PM

Stupid question, but are you sure you're redrawing the scene after changing the viewport?


glCopyTexImage2D and clipping - OneSadCookie - Nov 14, 2005 12:34 PM

Why not copy 640x480 pixels? Surely that's the easier thing to do?


glCopyTexImage2D and clipping - Skorche - Nov 14, 2005 03:16 PM

You can't render to a texture larger than the current buffer using glCopyTexImage2D, because you can't draw more than 640x480 pixels in a 640x480 buffer.

Only render and copy the portion you want.