Skip to content

Commit ef41788

Browse files
committed
[RM-1107][Scenario] set openGLContext to fix crash in OpenGL functions on OSX 10.12
TODO : Looks like it does not load a texture on OSX 10.12 properly
1 parent 805e112 commit ef41788

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

osx/Scenario/app/scene_controller.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ def loadView
1212
view.scene = SCNScene.sceneWithURL url, options:nil, error:nil
1313
end
1414
end
15+
16+
attributes = [
17+
NSOpenGLPFAAccelerated,
18+
NSOpenGLPFAColorSize, 32,
19+
NSOpenGLPFADepthSize, 24,
20+
]
21+
22+
attributes_pointer = Pointer.new("I", attributes.size)
23+
attributes.each_with_index do |v, i|
24+
attributes_pointer[i] = v
25+
end
26+
27+
self.view.pixelFormat = NSOpenGLPixelFormat.alloc.initWithAttributes(attributes_pointer)
28+
self.view.openGLContext = NSOpenGLContext.alloc.initWithFormat(self.view.pixelFormat, shareContext:nil)
29+
1530
Dispatch::Queue.current.after(0.1) { configure }
1631
end
1732

0 commit comments

Comments
 (0)