SebKuzminsky / pycam

Other
340 stars 98 forks source link

Attempt to use OpenGL compatibility profile by default. #140

Closed lava closed 5 years ago

lava commented 5 years ago

PyCAM's rendering code relies on the OpenGL fixed function pipeline, which was removed from the OpenGL 3.2 Core profile.

Sadly, that is the default version used by Gdk, and the public API of GLArea and GLContext does not allow switching the profile or using a version < 3.2, therefore we have to attempt to change Gdk behaviour through environment variables.

Ironically, setting `GDK_GL=legacy' will usually result in a more modern OpenGL version being used, e.g. switching from 3.2 Core to 4.6 Compatibility on my machine.

ebo commented 5 years ago

Maybe it is time to use something other than OpenGL. What is used from OpenGL and do we have anything that is known to replace those functionality?

EBo --

On Mar 30 2019 8:02 PM, Benno Evers wrote:

PyCAM's rendering code relies on the OpenGL fixed function pipeline, which was removed from the OpenGL 3.2 Core profile.

Sadly, that is the default version used by Gdk, and the public API of GLArea and GLContext does not allow switching the profile or using a version < 3.2, therefore we have to attempt to change Gdk behaviour through environment variables.

Ironically, setting `GDK_GL=legacy' will usually result in a more modern OpenGL version being used, e.g. switching from 3.2 Core to 4.6 Compatibility on my machine. You can view, comment on, or merge this pull request online at:

https://github.com/SebKuzminsky/pycam/pull/140

-- Commit Summary --

  • Attempt to use OpenGL compatibility profile by default.

-- File Changes --

M pycam/Plugins/__init__.py (7)

-- Patch Links --

https://github.com/SebKuzminsky/pycam/pull/140.patch https://github.com/SebKuzminsky/pycam/pull/140.diff

lava commented 5 years ago

Well, for the amount of OpenGL code being used, judge for yourself:

~/src/pycam/pycam$ find . -name '*OpenGL*' | xargs wc -l
  113 ./Plugins/OpenGLViewGrid.py
   76 ./Plugins/OpenGLViewDimension.py
   73 ./Plugins/OpenGLViewSupportModelPreview.py
  192 ./Plugins/OpenGLViewModel.py
   94 ./Plugins/OpenGLViewBounds.py
   77 ./Plugins/OpenGLViewAxes.py
  948 ./Plugins/OpenGLWindow.py
   49 ./Plugins/OpenGLViewTool.py
  158 ./Plugins/OpenGLViewToolpath.py
   84 ./Gui/OpenGLTools.py
 1864 total
~/src/pycam/pycam$ grep gl[A-Z] . -r | wc -l
242

So I'd personally recommend against re-implementing that, since it's probably going to take 100+ hours just to get back to the state that's currently working, but of course you're free to spend your time as you see fit.

Until that replacement is finished, though, I think it would be better to have the OpenGL version not be broken by default on most modern systems.

ebo commented 5 years ago

Another option besides reimplementing is to strip the old version of the these functions as a modified version of the dependencies, or possibly installing in /opt/pycam as version pinned dependency install.

On Mar 31 2019 5:28 AM, Benno Evers wrote:

Well, for the amount of OpenGL code being used, judge for yourself:

~/src/pycam/pycam$ find . -name '*OpenGL*' | xargs wc -l
  113 ./Plugins/OpenGLViewGrid.py
   76 ./Plugins/OpenGLViewDimension.py
   73 ./Plugins/OpenGLViewSupportModelPreview.py
  192 ./Plugins/OpenGLViewModel.py
   94 ./Plugins/OpenGLViewBounds.py
   77 ./Plugins/OpenGLViewAxes.py
  948 ./Plugins/OpenGLWindow.py
   49 ./Plugins/OpenGLViewTool.py
  158 ./Plugins/OpenGLViewToolpath.py
   84 ./Gui/OpenGLTools.py
 1864 total
~/src/pycam/pycam$ grep gl[A-Z] . -r | wc -l
242

So I'd personally recommend against re-implementing that, since it's probably going to take 100+ hours just to get back to the state that's currently working, but of course you're free to spend your time as you see fit.

Until that replacement is finished, though, I think it would be better to have the OpenGL version not be broken by default on most modern systems.

sumpfralle commented 5 years ago

Indeed the above is surely an improvement of the current state - so I will just merge it. Thank you!

Regarding the replacement: it is almost there (as usual): https://github.com/SebKuzminsky/pycam/issues/135#issuecomment-448865196 (see branch replace-opengl-with-x3d)

The usability of the new 3D visualization is still a bit painful. I will use my next chunk of pycam-dedicated time for fixing and releasing it.

valeriob01 commented 5 years ago

Indeed the above is surely an improvement of the current state - so I will just merge it. Thank you!

Regarding the replacement: it is almost there (as usual): #135 (comment) (see branch replace-opengl-with-x3d)

The usability of the new 3D visualization is still a bit painful. I will use my next chunk of pycam-dedicated time for fixing and releasing it.

Incredibly the last update is working better. The buttons on the visualization canvas now work.