Render an animation in a bitmap file (CARenderer)

  • Hi,

    I'd like to render a CALayer animation in a series of bitmap files
    rather that in an NSView.

    I've succeeded  in rendering 1 frame in a bitmap file by :
    - creating a NSOpenGLContext
    - creating a CARenderer (named renderer)
    - calling the following code:

    [renderer beginFrameAtTime:0.0 timeStamp:NULL];
    [renderer addUpdateRect:CGRectMake(0.0, 0.0, _width, _height)];
    [renderer render];
    [renderer endFrame];

    - saving the content of the context in a bitmap file

    Now I'd like to do the same thing for each frame of an animation. But
    I have absolutely no idea on how to do this...
    - at what point in the code should I add the animation to the layer?
    - I've tried different values for the first argument of
    beginFrameAtTime:timeStamp:, but only the 1st frame is rendered?
    - why does [renderer nextFrameTime] always return "inf"?

    Thanks,
    -Martin
previous month march 2008 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today