Created
December 27, 2018 20:59
-
-
Save ndbroadbent/503f0dc32077a53d32f70673c40df4c7 to your computer and use it in GitHub Desktop.
Fix OpenGL rendering on MacOS Mojave for Mittsu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fixed_opengl = false | |
start_time = Time.now | |
renderer.window.run do | |
renderer.render(@scene, @camera) | |
if !fixed_opengl && Time.now - start_time > 0.5 | |
# Workaround for OpenGL bug on MacOS Mojave | |
# Have to slightly move the window to start the rendering, | |
# otherwise it stays black. | |
# See: https://stackoverflow.com/a/52915794/304706 | |
fixed_opengl = true | |
glfw_handle = renderer.window.instance_variable_get('@handle') | |
x = ' ' * 8 | |
y = ' ' * 8 | |
glfwGetWindowPos(glfw_handle, x, y) | |
x = x.unpack1('L') | |
y = y.unpack1('L') | |
glfwSetWindowPos(glfw_handle, x + 1, y) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment