1

I'm trying to show a 3D image (a sphere) with a texture that contains some information. I need to rotate and zoom in/out the image.

I just came up using glumply and I saw some examples that are very helpful (especially the Earth rendering example at https://github.com/glumpy/glumpy/blob/master/examples/earth.py).

However, so far I haven't been able to find any example at all that zooms in/out the image. Does anybody know whether that's possible or not? I'm starting to think that it is not possible, but that's somehow hard to believe. I would really appreciate any example of how to do it (or somebody who knows about it telling me that it's impossible). I just discovered glumpy yesterday night, so the more complete the example, the better.

Thanks a lot!

EDIT: As far as I have seen, both the Trackball and Arcball classes (which I use for the 3D sphere) have an on_mouse_scroll method which should already zoom in/out when the mouse wheel is turned. However, that method is never called when I turn the wheel. I'm not sure whether this has something to do with a message I get in the console when I execute the program:

[w] Backend (<module 'glumpy.app.window.backends.backend_glfw' from 'C:\\Python37\\lib\\site-packages\\glumpy\\app\\window\\backends\\backend_glfw.py'>) not available
[w] Backend (<module 'glumpy.app.window.backends.backend_pyglet' from 'C:\\Python37\\lib\\site-packages\\glumpy\\app\\window\\backends\\backend_pyglet.py'>) not available

Any ideas? I'm using Windows 10 and Python 3.7.

ivansiiito
  • 133
  • 2
  • 10
  • 1
    There is a `transform.zoom` at the end of the example you link that seems like what you're after... – jdehesa Aug 05 '19 at 13:59
  • Yes, that definitely has something to do with my question. However, changing that value I can modify the initial value of the zoom. I don't know yet how to use, for example, the mouse wheel to modify that value. Thanks! – ivansiiito Aug 05 '19 at 14:14
  • 1
    Actually I just run the example you posted and zooming with the scroll wheel seems to work out of the box (Win 10). The code doing it seems to be in [`Arcball`](https://github.com/glumpy/glumpy/blob/1.1.0/glumpy/transforms/arcball.py). Interestingly, I can change `transform.zoom` to arbitrary values in `on_draw` and it changes the zoom, but I cannot read its value, so I can do `transform.zoom = ` but `transform.zoom += 1` crashes. – jdehesa Aug 05 '19 at 15:48
  • I just wrote about that. However, in my case, that method is never called :-/. Do you get any error at startup similar to the ones I posted in the edited question. Thanks a lot! – ivansiiito Aug 05 '19 at 15:52
  • 1
    I don't get those messages, have you followed the guide [Step-by-step install for x64 bit Windows 7,8, and 10](https://glumpy.readthedocs.io/en/latest/installation.html#step-by-step-install-for-x64-bit-windows-7-8-and-10)? Among other things, you need to copy the GLFW DLL to your Python directory (C:\Python37\). – jdehesa Aug 05 '19 at 16:11
  • I had followed some other instructions and I had not copied that library. Now it works. Thanks a lot! ¡Muchas gracias! – ivansiiito Aug 05 '19 at 16:37

1 Answers1

1

The problem was that I was lacking the GLFW DLL library. I could create the sphere and rotate it, but I couldn't zoom in/out. I didn't pay much attention to a couple of warnings/errors that I got when I executed the application as it somehow seemed to work alright.

As jdehesa pointed out in his comments, I had not properly followed the installation steps shown in Step-by-step install for x64 bit Windows 7,8, and 10.

Now it works. Thanks jdehesa!

ivansiiito
  • 133
  • 2
  • 10