Search code examples
pythonzoomingglumpy

How to zoom in/out a 3D image using glumpy?


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.


Solution

  • 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!