Sarah W
Sarah W

Reputation: 909

On iPad, to keep a bitmap of the current main view, how is Core Graphics compared with cocos2D and OpenGL ES?

I heard that for a single view app, it is best to keep the current main view's content in a bitmap, and we paint extra things on this bitmap, and when it is time to do drawRect (when called by iOS), then we just display the bitmap.

Is it true that Core Graphics is quite capable of handling it? But since both cocos2D and OpenGL ES are said to be super fast when handling graphics, is using one of them good for the situation above, making it more smooth or is it not that different from using Core Graphics?

(Or maybe it matters for type of application, such as a simple drawing program, versus a game that refreshes 30fps or 60fps?)

Upvotes: 0

Views: 130

Answers (1)

johnbakers
johnbakers

Reputation: 24750

It depends if you need to draw every frame and have your drawings change.

Check out the AccelerometerGraph sample code provided by Apple. This is one way of using Core Animation layers and Core Graphics (Quartz drawing) together to do continuous drawings across many frames without redrawing what has already been drawn.

Cocos2D is less for drawing and more for sprite-based animations where your sprites are pre-rendered images that you have imported (png, etc). It's very very fast at handling multiple images simultaneously and offers batch nodes for consolidating all images to just one single Open GL call.

Quartz (Core Graphics) by itself is not usually the best option for continuous drawing, but is better for generating static images once that you then move around, if necessary.

Upvotes: 1

Related Questions