Skip to content

Commit

Permalink
[RM-1107][Scenario] set openGLContext to fix crash in OpenGL function…
Browse files Browse the repository at this point in the history
…s on OSX 10.12

TODO :
  Looks like it does not load a texture on OSX 10.12 properly
  • Loading branch information
Watson1978 committed Sep 23, 2016
1 parent 805e112 commit ef41788
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions osx/Scenario/app/scene_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ def loadView
view.scene = SCNScene.sceneWithURL url, options:nil, error:nil
end
end

attributes = [
NSOpenGLPFAAccelerated,
NSOpenGLPFAColorSize, 32,
NSOpenGLPFADepthSize, 24,
]

attributes_pointer = Pointer.new("I", attributes.size)
attributes.each_with_index do |v, i|
attributes_pointer[i] = v
end

self.view.pixelFormat = NSOpenGLPixelFormat.alloc.initWithAttributes(attributes_pointer)
self.view.openGLContext = NSOpenGLContext.alloc.initWithFormat(self.view.pixelFormat, shareContext:nil)

Dispatch::Queue.current.after(0.1) { configure }
end

Expand Down

0 comments on commit ef41788

Please sign in to comment.