Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Motion Blur at 30 fps



Hi,
when I export my OpenGL animation to a QT movie at 60 FPS, everything works
very well. Now I would like to get a QT movie at 30 FPS and as I have been
told, I have created such a motion blur. In the QT I export, the resulting
movement is pretty good, but the colors of the QT frame-image look like
multiplied too much. They have been altered. The final image looks like
8-bit style, with stripes of colors instead of the original smooth blend.

May you please tell me what I do wrong?

-----------
I stretch my GL animation along the time, so if the original duration was
120 frames = 2 seconds at 60 FPS, now it is 240 frames (120 x 2). If I play
it now at 60 FPS, it runs slowly and smoothly. So I go to export this GL
animation.

I get 4 GL frames per each QT frame, so at the end 240 / 4 = 60 QT frames,
therefore again 2 seconds at 30 FPS. Well.
The great problem is how to mix these 4 GL frames. I use the accumulation
buffer. I init the glView with
-----------
    NSOpenGLPFAAccumSize, 32,
    ...
    glClearAccum(0.0, 0.0, 0.0, 0.0);
    glClear(GL_ACCUM_BUFFER_BIT);
    gMotionBlurFrames = 4;
-----------
Then in the drawRect loop I do:
-----------
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    [objManager drawObjects];
    [[self openGLContext] flushBuffer];
    
    int xFrame = currentFrame % gMotionBlurFrames;

    if(xFrame == 0) // first frame of 4
        glAccum(GL_LOAD, (float)1.0f / gMotionBlurFrames);
    else
        glAccum(GL_ACCUM, 1.0f / gMotionBlurFrames);

    if(xFrame != (gMotionBlurFrames - 1)){
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    }
    else{
        // last frame of 4
        // at the 4th image taken, I get the accum buffer
        // and I save it to a QT frame
        
        glAccum(GL_RETURN, 1.0);
        [self putOpenGLBufferToQTGWorld];
    }
-----------

What do I miss?


Best Regards
-- 
Lorenzo
email: email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.