Skip to content

Commit ea8f5e5

Browse files
authored
Add files via upload
Adds support for HiDPI (Retina Macs)
1 parent 43cdaad commit ea8f5e5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,10 +779,11 @@ def set_2d(self):
779779
"""
780780
width, height = self.get_size()
781781
glDisable(GL_DEPTH_TEST)
782-
glViewport(0, 0, width, height)
782+
viewport = self.get_viewport_size()
783+
glViewport(0, 0, max(1, viewport[0]), max(1, viewport[1]))
783784
glMatrixMode(GL_PROJECTION)
784785
glLoadIdentity()
785-
glOrtho(0, width, 0, height, -1, 1)
786+
glOrtho(0, max(1, width), 0, max(1, height), -1, 1)
786787
glMatrixMode(GL_MODELVIEW)
787788
glLoadIdentity()
788789

@@ -792,7 +793,8 @@ def set_3d(self):
792793
"""
793794
width, height = self.get_size()
794795
glEnable(GL_DEPTH_TEST)
795-
glViewport(0, 0, width, height)
796+
viewport = self.get_viewport_size()
797+
glViewport(0, 0, max(1, viewport[0]), max(1, viewport[1]))
796798
glMatrixMode(GL_PROJECTION)
797799
glLoadIdentity()
798800
gluPerspective(65.0, width / float(height), 0.1, 60.0)

0 commit comments

Comments
 (0)