Skip to content

Commit

Permalink
mac patch
Browse files Browse the repository at this point in the history
patches Intel HD Graphics 5000 (OS X 10.10.3) issue where OpenGL
version 2.4 is parsed as 1.0

makes win32api only import if platform is win32 (other platforms don’t
have it and won’t use it)
  • Loading branch information
iJunkie22 committed Jun 11, 2015
1 parent 3c56b0f commit 9e822f6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mcedit2/util/directories.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import os
import sys
import win32api

try:
assert sys.platform == "win32"
# If sys.platform is "win32", win32api is needed and expected
import win32api
except AssertionError as _ae:
# If sys.platform is not "win32", do not try to import win32api
win32api = None

def getUserFilesDirectory():
if sys.platform == "win32":
Expand Down
11 changes: 11 additions & 0 deletions src/mcedit2/util/qglcontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from OpenGL import GL
from PySide import QtOpenGL, QtGui
import logging
from sys import platform

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -37,6 +38,16 @@ def validateQGLContext(context):
actualFormat = context.format()
""":type : QtOpenGL.QGLFormat"""

def getmajor():
return int(str(GL.glGetString(GL.GL_VERSION)).split()[0].partition(".")[0])

def getminor():
return int(str(GL.glGetString(GL.GL_VERSION)).split()[0].partition(".")[2])

if platform == 'darwin':
actualFormat.majorVersion = getmajor
actualFormat.minorVersion = getminor

detailedText = "Obtained a GL context with this format:\n"
detailedText += "Valid: %s\n" % (context.isValid(),)
detailedText += "Version: %s.%s\n" % (actualFormat.majorVersion(), actualFormat.minorVersion())
Expand Down

0 comments on commit 9e822f6

Please sign in to comment.