Multiple windows?

103 views
Skip to first unread message

tommct

unread,
Jun 6, 2012, 5:48:08 PM6/6/12
to glumpy-users
I am trying to make multiple windows with glumpy. Is this possible?
I've tried new threads and simply making multiple figures, but it only
crashes.

Nicolas Rougier

unread,
Jun 7, 2012, 2:15:42 AM6/7/12
to glumpy...@googlegroups.com

OpenGL must be in the main thread, that may be the cause of your crashes.
As for multiple windows, it depends on your GLUT implementation. The easiest would be to have a better toolkit like gtk or KDE.  It requires to write a backend_gtk.py or backend_kde.py.


Nicolas

mib...@gmail.com

unread,
Aug 17, 2016, 7:32:24 AM8/17/16
to glumpy-users
Same problem here. Is there no way to have multiple windows? The app-two-windows example works, but it does not draw anything.

Nicolas Rougier

unread,
Aug 17, 2016, 7:34:54 AM8/17/16
to glumpy...@googlegroups.com


The app-two-windows.py example show how to have two windows. If you want to draw something, you'll have to populate the on_draw functions with something.

Nicolas
> --
> You received this message because you are subscribed to the Google Groups "glumpy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to glumpy-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

mib...@gmail.com

unread,
Aug 17, 2016, 8:32:30 AM8/17/16
to glumpy-users
That's what I do. But then it crashes constantly. So I think I'll need something additional to be able to have multiple windows, but I don't know what. I will try to create a minimum example that causes the crash.

mib...@gmail.com

unread,
Aug 17, 2016, 8:39:07 AM8/17/16
to glumpy-users
So for example the example gloo-triangular-grid. I just doubled everything, and I get the following error:

[i] HiDPI detected, fixing window size
[i] Using GLFW (GL 2.1)
[i] HiDPI detected, fixing window size
[i] Using GLFW (GL 2.1)
[i] Running at 60 frames/second
Traceback (most recent call last):
  File "/Users/michael/software/glumpy/examples/gloo-triangular-grid-2-windows.py", line 55, in <module>
    app.run()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glumpy/app/__init__.py", line 343, in run
    run(duration, framecount)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glumpy/app/__init__.py", line 329, in run
    count = __backend__.process(dt)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glumpy/app/window/backends/backend_glfw.py", line 408, in process
    window.dispatch_event('on_draw', dt)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glumpy/app/window/event.py", line 384, in dispatch_event
    if handler(*args):
  File "/Users/michael/software/glumpy/examples/gloo-triangular-grid-2-windows.py", line 45, in on_draw
    program1.draw(gl.GL_TRIANGLES, indices.reshape(-1).astype(np.uint32).view(gloo.IndexBuffer))
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glumpy/gloo/program.py", line 592, in draw
    self.activate()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glumpy/gloo/globject.py", line 89, in activate
    self._activate()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glumpy/gloo/program.py", line 377, in _activate
    gl.glUseProgram(self.handle)
  File "errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src/errorchecker.c:1218)
OpenGL.error.GLError: GLError(
err = 1281,
description = b'invalid value',
baseOperation = glUseProgram,
cArguments = (1,)
)
gloo-triangular-grid-2-windows.py

Nicolas Rougier

unread,
Aug 17, 2016, 9:31:51 AM8/17/16
to glumpy...@googlegroups.com

Got the same error. It's a problem with context when you're creating your program.
Here is a corrected version, you'll need latest github glumpy (I've made a few changes).

gloo-triangular-grid-2-windows.py

mib...@gmail.com

unread,
Aug 18, 2016, 9:18:47 AM8/18/16
to glumpy-users
I just tested the fix. It works! Now I'll try to incorporate it into my application, let's see...

Thank's a lot Nicolas for that very quick fix. So far it's been a real pleasure to work with glumpy :-)

Michael

mib...@gmail.com

unread,
Aug 18, 2016, 10:49:29 AM8/18/16
to glumpy-users
Unfortunately, it does not work properly. Seems that at least the point size is now ignored for the second window...

I added a code to reproduce the problem. The blue point is just a very small dot, while the red one is displayed properly.
app-two-programs-two-windows.py

Nicolas Rougier

unread,
Aug 18, 2016, 11:30:03 AM8/18/16
to glumpy...@googlegroups.com
Could you open an issue on github please ?
> --
> You received this message because you are subscribed to the Google Groups "glumpy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to glumpy-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <app-two-programs-two-windows.py>

mib...@gmail.com

unread,
Aug 18, 2016, 11:32:29 AM8/18/16
to glumpy-users
I'll do that as soon as possible.
Reply all
Reply to author
Forward
0 new messages