Strange enough, when I removed the call to the external web thread, I no longer have this problem. So note to pyglet devs: creating new threads apparently makes this issue pop up (not re-drawing the window).
Anyway, I've got it working! I used gevent to create a non-blocking WSGI server. Then I call the WSGIServer()._stop_event.wait(timeout) with a very low timeout (0.0001) to activate the event polling. I schedule this callback with pyglet.clock every tick, and now I have only *one thread total * that controls both the cocos director and the flask-based gevent HTTP API server. Browsing to localhost:5000/next/ dispatches the next_slide event and I'm good to go! It's a clean and elegant solution, and I'm happy to be able to use gevent for the first time. It's a beautiful little framework. If anyone is interested I can explain further with more time. I'd like to write up something on how I did it since I don't seem to find any resources online. Blaine On Wed, Oct 24, 2012 at 2:32 PM, claudio canepa <[email protected]> wrote: > > > On Wed, Oct 24, 2012 at 1:42 PM, Blaine <[email protected]> wrote: > >> Thank you. I actually figured out how to do non-threading with flask and >> gevent so I'm exploring that route. I do indeed have cocos in the main >> thread (learned that very quickly). I'll post the full solution here if I >> can get it working. >> >> The idea is to use HTTP to control cocos (no html needed). So if I >> browse to localhost:5000/next/, flask picks up on that, issues a transition >> to the next scene via the director interface, and all is good. >> Unfortunately the main problem with my original solution is that the openGL >> window didn't update. >> >> The main problem here (with the different threads) is that my Cocos >> window / Pyglet Window also does not update if I move a window in front of >> it. >> > > Wait a minute. Theres issue 562 in pyglet [0] about this. > Could you try to add self.schedule(lambda dt: None) in the scene on_enter > ? > That should stop the non redraw with overlapping windows. > > >> That may be a problem with my window manager from what I've read? Im on >> Mint Linux, based on Ubuntu 12.04 (I think). Does anyone else have a >> problem with the window not redrawing when it gets covered by another >> window? I'm even manually calling window.on_expose() but it isn't working. >> >> > [0] http://code.google.com/p/pyglet/issues/detail?id=562 > > > > -- > You received this message because you are subscribed to the Google Groups > "cocos2d discuss" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/cocos-discuss?hl=en. > -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
