pywavefront / PyWavefront

Python library for importing Wavefront .obj files
BSD 3-Clause "New" or "Revised" License
300 stars 80 forks source link

Consider updating visualization #80

Open einarf opened 5 years ago

einarf commented 5 years ago

Consider updating the visualization code to something more modern. Pyglet is pretty much locked to OpenGL 2.1 released in 2006. Today OpenGL 4.6 is the stable version. I would suggest using OpenGL 3.3 so we an at least visualize all different vertex formats. Most hardware today support his; even 5 year old onboard Intels.

I would suggest using ModernGL (https://github.com/cprogrammer1994/ModernGL) with PyQt5 as this also will align closer to users of this library (mainly coming from the Scientific Computing community).

greenmoss commented 5 years ago

Would upgrading to a newer OpenGL require us to deprecate Pyglet support?

einarf commented 5 years ago

Yep. It would mean replacing pyglet with something else. Pyglet doesn't support core profiles and are stuck on OpenGL 2.1 also using fixed pipeline. They are not planning to change this until pyglet version 2.x, that may never happen.

I have no idea if this causes any issues for anyone.

Replacement in packages would be

pip install PyQt5
pip install moderngl

.. instead of pyglet.

greenmoss commented 5 years ago

That's unfortunate. So Pyglet is basically holding us back then 😢

I am guessing supporting both Pyglet and ModernGL would be extremely complex. Is this correct?

einarf commented 5 years ago

I am guessing supporting both Pyglet and ModernGL would be extremely complex. Is this correct?

I don't think it's that hard to support both. Are there good reasons to keep the pyglet support?

greenmoss commented 5 years ago

The only downside I can think of switching is forcing existing Pyglet users to make changes. Is that likely?

einarf commented 5 years ago

We can just introduce a new module modern_visualization. In 3.0 we separated visualization into its own module visualization, so I guess this is pretty straight forward.

greenmoss commented 5 years ago

That sounds like a good solution to me.

einarf commented 5 years ago

The moderngl_window project is slowly shaping up. Will add new visualization module here when this is done. https://github.com/moderngl/moderngl_window

einarf commented 5 years ago

Pyglet 1.4 is ready soon that will solve a lot of the limitations in 1.3. We'll probably still stick with pyglet backend for moderngl_window. It does support using pyglet directly or moderngl. This way we can support both 😄

einarf commented 5 years ago

Note : Pyglet is moving from BitBucket to GitHub when 1.4 is released : https://github.com/pyglet/pyglet

einarf commented 4 years ago

We also have pyglet2 coming in the near future using the programmable pipeline. That adds more complications because it's not compatible with pyglet 1.x