Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force SCNView to render a new frame?

Tags:

ios

scenekit

Is there a way to force SCNView to render a new frame on demand if there is no animation inside the scene? If the scene is static SCNView renders exactly once and then only after something changes.

Usually this makes sense, but I am working together with the Vuforia augmented reality framework which requires me to render a new frame every time it processed a new video frame from the camera. I worked around this issue by creating my own UIView with a CAEAGLLayer which renders the SceneKit content using an SCNRenderer. This works great, but I am curious if there is a way to do this with SCNView so I can avoid directly touching OpenGL ES.

like image 699
Sven Avatar asked Nov 04 '14 22:11

Sven


2 Answers

Update

As of iOS 11.0 and macOS 10.13 the rendersContinuously property on SCNView is the preferred way to force the view to continuously render frames.


Previous answer

you can set its playing property to YES

like image 109
mnuages Avatar answered Oct 04 '22 18:10

mnuages


You can increment the sceneTime like so:

sceneView.sceneTime += 1

It will then render a single frame.

like image 31
Remco Poelstra Avatar answered Oct 04 '22 20:10

Remco Poelstra