Class

SCNRenderer

A renderer for displaying SceneKit scene in an an existing Metal workflow or OpenGL context.

Overview

Use this class when you want to add content rendered by SceneKit to an app that already renders other content by using Metal or OpenGL or OpenGL ES directly. To provide content for a SceneKit renderer, assign a SCNScene object to its scene property.

For additional important methods and properties for working with SceneKit renderers, see SCNSceneRenderer.

Topics

Creating a Renderer

init(device: MTLDevice?, options: [AnyHashable : Any]? = nil)

Creates a renderer with the specified Metal device.

init(context: EAGLContext?, options: [AnyHashable : Any]? = nil)

Creates a renderer with the specified OpenGL context.

Specifying a Scene

var scene: SCNScene?

The scene to be rendered.

Managing Animation Timing

var nextFrameTime: CFTimeInterval

The timestamp for the next frame to be rendered.

Rendering a Scene Using Metal

func render(atTime: CFTimeInterval, viewport: CGRect, commandBuffer: MTLCommandBuffer, passDescriptor: MTLRenderPassDescriptor)

Renders the scene’s contents at the specified system time in the specified Metal command buffer.

Rendering a Scene Using OpenGL

func render()

Renders the scene’s contents in the renderer’s OpenGL context.

Deprecated
func render(atTime: CFTimeInterval)

Renders the scene’s contents at the specified system time in the renderer’s OpenGL context.

Capturing a Snapshot

func snapshot(atTime: CFTimeInterval, with: CGSize, antialiasingMode: SCNAntialiasingMode)

Creates an image by drawing the renderer’s content at the specified system time.

See Also

Display and Interactivity

protocol SCNSceneRenderer

Methods and properties common to the SCNView, SCNLayer and SCNRenderer classes.

protocol SCNSceneRendererDelegate

Methods your app can implement to participate in SceneKit’s animation loop or perform additional rendering.

class SCNLayer

A Core Animation layer that renders a SceneKit scene as its content.

class SCNHitTestResult

Detailed information about a result from searching for elements of a scene located at a specified point, or along a specified line segment (or ray).