Skip to content

Instantly share code, notes, and snippets.

@ndbroadbent
Created December 27, 2018 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ndbroadbent/503f0dc32077a53d32f70673c40df4c7 to your computer and use it in GitHub Desktop.
Save ndbroadbent/503f0dc32077a53d32f70673c40df4c7 to your computer and use it in GitHub Desktop.
Fix OpenGL rendering on MacOS Mojave for Mittsu
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