Merge pull request #847 from Amulet-Team/fix-macos

Fix macos
This commit is contained in:
gentlegiantJGC 2022-12-21 14:04:42 +00:00 committed by GitHub
commit 641afed0a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,6 @@
from typing import Optional
import logging
import sys
import wx
from wx import glcanvas
@ -48,7 +49,16 @@ class BaseCanvas(glcanvas.GLCanvas):
style=wx.WANTS_CHARS,
)
self._context = glcanvas.GLContext(self)
if sys.platform == "linux":
# setup the OpenGL context. This apparently fixes Amulet-Team/Amulet-Map-Editor#84
self._context = glcanvas.GLContext(self)
else:
# This is required for MacOS. Amulet-Team/Amulet-Map-Editor#597
context_attributes = wx.glcanvas.GLContextAttrs()
context_attributes.CoreProfile().Robust().ResetIsolation().EndList()
self._context = glcanvas.GLContext(
self, ctxAttrs=context_attributes
) # setup the OpenGL context
if not self._context.IsOK():
raise Exception(f"Failed setting up context")

View File

@ -18,7 +18,8 @@ install_requires =
wxPython==4.1.1
numpy~=1.17
pyopengl~=3.0
pyopengl-accelerate~=3.0
; pyopengl-accelerate does not work for M1 Macs. Amulet-Team/Amulet-Map-Editor#597
pyopengl-accelerate~=3.0; sys_platform!="darwin" or (sys_platform=="darwin" and platform_machine!="arm")
packaging
amulet-core~=1.9
amulet-nbt~=2.0