Skip to content

Commit 67a272d

Browse files
author
Tom De Smedt
committed
Do Canvas._window.switch_to() before gl calls in Canvas._setup().
1 parent 474a5a4 commit 67a272d

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

nodebox/graphics/context.py

+19-16
Original file line numberDiff line numberDiff line change
@@ -3812,26 +3812,29 @@ def draw_overlay(self):
38123812
draw_over = draw_overlay
38133813

38143814
def _setup(self):
3815-
# Set the window color, this will be transparent in saved images.
3816-
glClearColor(VERY_LIGHT_GREY, VERY_LIGHT_GREY, VERY_LIGHT_GREY, 0)
3817-
# Reset the transformation state.
3818-
# Most of this is already taken care of in Pyglet.
3819-
#glMatrixMode(GL_PROJECTION)
3820-
#glLoadIdentity()
3821-
#glOrtho(0, self.width, 0, self.height, -1, 1)
3822-
#glMatrixMode(GL_MODELVIEW)
3823-
glLoadIdentity()
3824-
# Enable line anti-aliasing.
3825-
glEnable(GL_LINE_SMOOTH)
3826-
# Enable alpha transparency.
3827-
glEnable(GL_BLEND)
3828-
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
3829-
#glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
3815+
""" Initializes the application window and resets the state.
3816+
Clears the canvas and calls Canvas.setup().
3817+
"""
38303818
# Start the application (if not already running).
38313819
if not self._active:
38323820
self._window.switch_to()
3821+
# Set the window color, this will be transparent in saved images.
3822+
glClearColor(VERY_LIGHT_GREY, VERY_LIGHT_GREY, VERY_LIGHT_GREY, 0)
3823+
# Reset the transformation state.
3824+
# Most of this is already taken care of in Pyglet.
3825+
#glMatrixMode(GL_PROJECTION)
3826+
#glLoadIdentity()
3827+
#glOrtho(0, self.width, 0, self.height, -1, 1)
3828+
#glMatrixMode(GL_MODELVIEW)
3829+
glLoadIdentity()
3830+
# Enable line anti-aliasing.
3831+
glEnable(GL_LINE_SMOOTH)
3832+
# Enable alpha transparency.
3833+
glEnable(GL_BLEND)
3834+
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
3835+
#glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
38333836
self._window.dispatch_events()
3834-
self._window.set_visible()
3837+
self._window.set_visible(True)
38353838
self._active = True
38363839
self.clear()
38373840
self.setup()

0 commit comments

Comments
 (0)