Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force SCNView to use OpenGL

When using Xcode 7 and creating a new SceneKit OS X project, it seems to default to using Metal for the SCNView.

If I try to do this after creating a new Game project in Xcode 7:

var context = gameView.context

The result is nil. The view is using Metal and not OpenGL.

However, creating the same in Xcode 6.4, the context exists like expected.

How can I force my SCNView to use OpenGL and not Metal?

like image 411
Oskar Avatar asked Nov 20 '25 14:11

Oskar


1 Answers

When creating an SCNView, you have an option to set the renderer in the initialiser:

https://developer.apple.com/library/prerelease/ios/documentation/SceneKit/Reference/SCNView_Class/index.html#//apple_ref/occ/instm/SCNView/initWithFrame:options:

These are the options you have available, Metal or OpenGL ES 2.0 (3.0 will likely come later):

https://developer.apple.com/library/prerelease/ios/documentation/SceneKit/Reference/SCNSceneRenderer_Protocol/index.html#//apple_ref/c/tdef/SCNRenderingAPI

So setting to SCNRenderingAPIOpenGLES2 will get you what you want, a forcibly OpenGL ES 2.0 rendered SceneKit View

like image 57
Confused Avatar answered Nov 23 '25 09:11

Confused



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!