   Accumulation Buffer Problem
  Hey guys, im trying to do a simple motion blurring effect on a moving/spinning square. Here is an excerpt of the code:glClear(...); // clear color, depth, and accum bufferfor(int i = 0; i < AMT; i++){   box->move(0, 0 ,amt);   box->angle += 3;   box->draw();glAccum(GL_MULT, 0.5); // 0.5 is the decay factor}glAccum(GL_RETURN, 1.0);// flip screenHowever, no matter what the decay factor is (even 0) it resembles 1.0! I mean, this is basically all the code for the motion blurring of this one little box.And because you guys like pictures:
  Can you give a bit more info?  What happens when you call glAccum just once with glAccum(GL_MULT, 1.0) (ie, accum buffer should exactly match the color buffer), and then return?Even better, clear the color buffer before the return just so you know exactly what the RETURN is doing.  The color buffer should obviously not change much.   ;  Alright, so I cleared the color buffer right before drawing the accumulation buffer, and now... there is nothing - so am I just forgetting to enable something?I did a glGetError()Its returning the code for GL_INVALID_OPERATIONand according to my reference guide, this means 1 of 2 things - 1) GL_INVALID_OPERATION is generated if there is no accumulation bufferor2) "" is generated if glAccum is executed between the execution of glBegin and the corresponding execution of glEnd.Its not between a glBegin, that much is obvious - so there is no accumulation buffer? Did I not enable it? DO I have to enable it? I have a Radeon 9600....   ;  Im using SDL... does this count for anything?   ;  So I was scowering the SDL docs for details, came upon setting the accumulation buffer bit size - I mimicked the setting of setting the color buffers bit size    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );and so I have that and:SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE, 5);SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE, 5);SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE, 5);as well.Now, all I get is a big black screen.Even when I try to draw the entire scene to the accum buffer -   ;  Alright, so it seems I have misinterpreted the purpose of the GL_MULT.It doesnt actually accumulate anything to the buffer, it just multiplies its contents by the number. Anyways, after figuring this out - it is a very slow way to do this, and I probably wont be doing it this way anyways. Its just a good learning lesson :)So my new code does this:Draws the scene to the accumulation bufferMultiplies that by .5Draws the scene again after moving the objectsMultiplies that by .5draws the scene again with the accumulation bufferflips.Thats just two motion blurs as well.FPS drops big time.;  I think you should only be drawing the scene to the accumulation buffer once, and just dont clear it ever. As you keep multiplying by .5, the image will eventualy decay to ~0. I think your trying to draw the whole blur trail each frame, instead of actualy allowing it to "accumulate". I have not experimented with this effect yet, but that is my assumption.   