From 0d92fd8f02fcb0a66abd432aefac6bcd555f55d8 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 12 Dec 2022 11:53:05 +0000 Subject: [PATCH 1/2] Disable pyopengl-accelerate on M1 macs --- setup.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 39011ca8..7965069f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 From 7de65e423f80110fe87beec8bf5c1018997b8cda Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 12 Dec 2022 11:55:06 +0000 Subject: [PATCH 2/2] Fixed opengl issue on MacOS --- amulet_map_editor/api/opengl/canvas/canvas.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/amulet_map_editor/api/opengl/canvas/canvas.py b/amulet_map_editor/api/opengl/canvas/canvas.py index d8110a33..b79a062e 100644 --- a/amulet_map_editor/api/opengl/canvas/canvas.py +++ b/amulet_map_editor/api/opengl/canvas/canvas.py @@ -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")