ios - Redraw Scenes Only When the Scene Data Changes -


i read page on tuning opengl es app :

redraw scenes when scene data changes : app should wait until in scene changes before rendering new frame. core animation caches last image presented user , continues display until new frame presented.

even when data changes, not necessary render frames @ speed hardware processes commands. slower fixed frame rate appears smoother user fast variable frame rate. fixed frame rate of 30 frames per second sufficient animation , helps reduce power consumption.

from understand, there event loop keeps on running , re-rendering scene. override ondrawframe method , put our rendering code there. don't have control on when method gets called. how can "redraw scenes when scene data changes" ?

in case, there change in scene when user interacts (click, pinch etc.). ideally not render when user not interacting scene, function getting called continuously. confused.

at lowest exposed level, there opengl-containing type of coreanimation layer, caeagllayer. can supply colour buffer usable construct framebuffer object, can draw , when wish, presenting , when wish. that's full extent of process opengl in ios: draw when want, present when want.

the layer has pixel copy of scene. normal core animation rules apply you're never autonomously asked redraw. full composition, transitions, core animation animations, etc, can occur without work on part.

it common practice connect timer, cadisplaylink, either manually or taking advantage of 1 of glkit constructs. in case you're trying produce 1 frame per timer tick. apple suggesting running timer @ half refresh rate acceptable and, if wake perform draw , realise you'd drawing same frame did last time, not bothering draw @ all. ideally stopping timer if have sufficient foresight.

as per comment, ondrawframe isn't worded objective-c or swift method , isn't provided apple-supplied library. whomever posting — presumably try familiar android authors — needs take responsibility appropriate behaviour.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -