-
Notifications
You must be signed in to change notification settings - Fork 120
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
Sketch window stops refreshing on Mac. #10
Comments
Which version of
p5 version: 0.3.0a1 Python version: 3.6 |
Ahhh.. okay. This is interesting. We haven't been able to consistently reproduce this issue (as I use a linux machine for development and only have access to a Windows for testing). I'll see if I can write some debugging code that you can run. |
Were you ever able to test on a mac before the 0.3.0a1 release? I'm having a hard time finding a commit which supports even the simplest sketch on a mac. Trying to see if the bug appeared in a specific commit. |
fwiw, i can recreate this issue. same version of python, macOS, p5py, and pyglet. |
Same issue on OS X; the window updates jerkily a few times, then stops responding. I doubt that it matters, but I'm running the script from within a virtualenv. Test script: from p5 import *
def setup():
size(640, 360)
no_stroke()
background(204)
def draw():
if mouse_is_pressed:
fill(random_uniform(255), random_uniform(127), random_uniform(51), 127)
else:
fill(255, 15)
circle_size = random_uniform(low=10, high=80)
circle((mouse_x, mouse_y), circle_size)
def key_pressed(event):
background(204)
run() Expected behavior: Actual behavior Errors produced (if any): p5 version:
Python version: Operating System:
|
We were facing issues on the Mac even before. I can't remember this exactly, but the v0.1.0dev3 release would be a good place to start. I'll do some digging myself and give you more specific commits to test this weekend. |
I now run my testscript on MacOS X 10.10.5 (Yosemite). I got it running (see screenshot) but when I tried to run the examples I got the same behaviour as described above: After a few steps the animation stops and freezes the window. I run on both machines Anaconda Python 3.5.2 with an actual pyglet (1.2.4). |
A few things I can confirm:
And a few discoveries:
I have a sneaking suspicion that this is a pyglet issue. I wonder if making the switch to QT would solve this... If that is the end goal, transitioning to QT might kill two birds with one stone. |
Yep. Have been thinking about that as well. I've been hanging out on the Pyglet Google group and they are working really hard on upgrading Pyglet's OpenGL integration (esp. adding support for the core profile: https://groups.google.com/forum/#!topic/pyglet-users/oihWLIDH1S4)
I've been playing around with the idea of moving to PyQT for a while, but if we get it working with Pyglet it would be amazing. I'll get to properly work on this in a week or two, and will experiment with the pyglet version that people are working on right now. |
Nice! I’ll keep an eye out for any commits. |
I would like to add that I'm getting the same issue on (Fedora) Linux. My system has 2 OpenGL stacks: when using mesa, the problem arises, but it does not when using nvidia drivers (via optirun). Python stack is the same.
I tried using the double buffering solution reported above, but nothing changes. @marcrleonard I would be interested in seeing the config changes you made. I am currently investigating as well. |
I'm not entirely sure, but this could be connected to the OpenGL version that p5 gets access to. What version of OpenGL do you get for your mesa and nvidia stacks respectively? ( |
mesa:
Nvidia:
EDIT |
I think the problem lies in the |
Just to confirm that I can reproduce the issue on High Sierra (10.13.3) with pyglet-1.3.1 and PyOpenGL-3.1.0 and the current HEAD (e78c4a8). Using the interactive sample sketch by @falquaddoomi above I actually found out that the window doesn't freeze or stop rendering completely, it is just not redrawn as long as it is in the foreground. With the sketch code above, moving the mouse in front of the sketch nothing happens, but when backgrounding and then foregrounding the window again, the drawings triggered by the mouse hovering over the inactive sketch earlier are all there. It is also possible to only cause a redraw of parts of the sketch by partially obscuring the sketch window with another window. @parsoyaarihant what would the working order of config/template/window initialisation be? Just removing line 62 gives me a flickering sketch, same with the version from PR #35 |
I've been playing around with how to best generate a config that works across all platforms (see also #24) but I haven't been able to keep the sketch from stopping to redraw automatically on MacOS. @abhikpal what's the motivation for the two hard-coded config settings? I found out that the Line 48 in e78c4a8
sample_buffers (https://pythonhosted.org/pyglet/api/pyglet.gl.Config-class.html), so I don't think it is actually doing anything? The double_buffer option that fixes things on Raspberry (see #24) also causes the sketch to break (i.e. flicker) on OSX.
|
@kevinstadler , I have tried running the code in virtual environment and still the sketch is running as expected. Here is the configuration:
|
Which code, the one from the repository or your pull request? |
My pull request |
Ok cool I finally got it to work! Simply using
For any value greater than 0 for |
based on the comments by @kevinstadler I haved added double_buffer=1, sample_buffers=1. See: p5py#10 (comment)
Okay, this new configuration works for me too. I have added this change in my PR #35 |
Hey @Manindra29 (and everyone on this thread), thanks to #49, do we consider this issue and #9 fixed? |
Test Script: p5-examples/basics/math/sine.py. The bug affects all sketches.
Expected behavior:
![sine-correct](https://user-images.githubusercontent.com/3626001/29340230-887fad30-823b-11e7-89a8-68eda4be6e99.gif)
Actual behavior The sketch window stops refreshing after a couple of frames are drawn when a newer version of Pyglet (1.3b) is installed.
Errors produced (if any): None
p5 version: 2b96dfc
Python version: 3.6
Operating System: Mac OS
The text was updated successfully, but these errors were encountered: