PDA

View Full Version : Motion blur/swipe trails with accumulation buffer



ChucklesDarling
08-20-2014, 08:20 AM
Hi, I have a simple animation of a ball bouncing continuously around a 500-500 window and was wondering how do I use the accumulation buffer to make my point look like it has swipe trails/motion blur? I've done some research on accumulation buffers but I didn't fully understand the examples I came across.
Thank you in advance!

ChucklesDarling
08-20-2014, 10:20 AM
void renderScene()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear(GL_ACCUM_BUFFER_BIT);

glClearColor(0, 0, 0, 1);
glAccum(GL_RETURN, 1.0);
glAccum(GL_MULT, 0.5 );


glPointSize(10);
glBegin(GL_POINTS);

glColor3f( 1.0f, 1.0f, 1.0f );
glVertex2f( xpos, ypos );

xpos = xpos + xvel;
ypos = ypos + yvel;


if(xpos >= 500)
{
xvel = -xvel;
}
if(xpos <= -500)
{
xvel = -xvel;
}

if(ypos >= 500)
{
yvel = -yvel;
}
if(ypos <= -500)
{
yvel = -yvel;
}

glEnd();

glAccum(GL_ACCUM, 1.0);
glutSwapBuffers();

}