glCopyTexImage2D and clipping

james_the_bard
Unregistered
 
Post: #1
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!
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #2
Stupid question, but are you sure you're redrawing the scene after changing the viewport?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
Why not copy 640x480 pixels? Surely that's the easier thing to do?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL & SGE Clipping Problems merrill541 1 2,319 Sep 12, 2009 10:27 PM
Last Post: merrill541
  SDL Clipping Issue Talyn 14 4,692 Jul 15, 2008 11:20 AM
Last Post: Talyn
  2D clipping problem McSebi 4 4,199 Feb 22, 2005 11:37 PM
Last Post: McSebi
  wierd...light clipping...or something [edited] ghettotek 2 2,656 Feb 11, 2003 07:10 AM
Last Post: ghettotek