From 616c060c090a798f4292033d12b6e0835989e534 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Wed, 12 Jan 2022 15:31:41 -0500 Subject: [PATCH 1/2] ENH: Use modern OpenGL for everything --- expyfun/_experiment_controller.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/expyfun/_experiment_controller.py b/expyfun/_experiment_controller.py index 17872ac4..4707220e 100644 --- a/expyfun/_experiment_controller.py +++ b/expyfun/_experiment_controller.py @@ -953,21 +953,15 @@ def _setup_window(self, window_size, exp_name, full_screen, screen): # set the viewport size gl.glViewport(0, 0, int(self.window_size_pix[0]), int(self.window_size_pix[1])) - # set the projection matrix - gl.glMatrixMode(gl.GL_PROJECTION) - gl.glLoadIdentity() - gl.gluOrtho2D(-1, 1, -1, 1) - # set the model matrix - gl.glMatrixMode(gl.GL_MODELVIEW) - gl.glLoadIdentity() # disable depth testing gl.glDisable(gl.GL_DEPTH_TEST) # enable blending gl.glEnable(gl.GL_BLEND) gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA) - gl.glShadeModel(gl.GL_SMOOTH) gl.glClear(gl.GL_COLOR_BUFFER_BIT) v_ = False if os.getenv('_EXPYFUN_WIN_INVISIBLE') == 'true' else True + self._flip_rect = Rectangle(self, (0, 0, 1, 1), units='pix', + fill_color=(0., 0., 0., 0.)) self.set_visible(v_) # this is when we set fullscreen # ensure we got the correct window size got_size = win.get_size() @@ -1023,10 +1017,7 @@ def flip(self, when=None): self._win.flip() # this waits until everything is called, including last draw gl.glClear(gl.GL_COLOR_BUFFER_BIT) - gl.glBegin(gl.GL_POINTS) - gl.glColor4f(0, 0, 0, 0) - gl.glVertex2i(10, 10) - gl.glEnd() + self._flip_rect.draw() if self.safe_flipping: gl.glFinish() flip_time = self.get_time() From a5845157a1c60caa2d154625680533398383692a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 20:03:46 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- expyfun/_experiment_controller.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/expyfun/_experiment_controller.py b/expyfun/_experiment_controller.py index 0f7f8dff..a445d0c6 100644 --- a/expyfun/_experiment_controller.py +++ b/expyfun/_experiment_controller.py @@ -1096,9 +1096,10 @@ def _setup_window(self, window_size, exp_name, full_screen, screen): gl.glClear(gl.GL_COLOR_BUFFER_BIT) v_ = False if os.getenv("_EXPYFUN_WIN_INVISIBLE") == "true" else True self._flip_rect = Rectangle( - self, (0, 0, 1, 1), - units='pix', - fill_color=(0., 0., 0., 0.), + self, + (0, 0, 1, 1), + units="pix", + fill_color=(0.0, 0.0, 0.0, 0.0), ) self.set_visible(v_) # this is when we set fullscreen # ensure we got the correct window size