OpenGL-ES Puzzle game - making drawing battery efficient?
I've got an iPhone game that is basically finished, but I have been spending some time profiling as I want to get the power usage down as low as possible, but I'm a开发者_运维百科n OpenGL ES noob so I'm looking for some pointers.
The game is a fairly simple puzzle game, so 90% of the time the board is redrawing for no reason. At the moment I have a 'dirty' flag and only render anything if it is set, but then I draw everything, when most of the time only a tiny part of board needs updating (ie the timer, or one of the pieces).
Is there a common strategy to use with OpenGL for only updating parts of the screen, or does it assume that you want to redraw everything, all of the time?
Your application should wait until something in the scene changes before rendering a new frame. Core Animation caches the last image presented to the user and continues to display it until a new frame is presented.So you don't need to draw every time , just check for the update, and draw only when there is any update. EDIT: For more details check opengl es programming guide- here's [a link]http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/Performance/Performance.html
精彩评论