Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Use modern OpenGL everywhere #440

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions expyfun/_experiment_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,21 +1088,19 @@ def _setup_window(self, window_size, exp_name, full_screen, screen):
gl.glClearDepth(1.0) # clear value for the depth buffer
# 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, 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()
Expand Down Expand Up @@ -1162,10 +1160,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()
Expand Down
Loading