Closed einarf closed 5 years ago
I think moving the example window to a new module would be great for all the purposes you mentioned. It would also let the examples in the subfolders work better. (currently they use a hacky import to get the window imported :) I had a similar module in the past, but I never had time to finish it properly. You can add it to PyPI. You can add it to the moderngl organization as well. I will move moderngl some day to the moderngl organization. I was just postponing it to the next major release.
Transferring ownership of a repo is easy, issues, PR-s all remain untouched. The problem will probably be with recent forks and CIs using the github the current link.
Consider it done 😄
I'll make a package on PyPI moderngl-window
to match the other packages. The python package and repo will be called moderngl_window
. I'll create it in the ModernGL Organization (to make it a bit more "official") and will add you with owner status for the PyPI repo as well (see: Bus Factor).
I'll merge the best parts of the windows from moderngl/examples/window
and demosys/context
and will be moving to strictly using this new package for all my projects to increase the reasons to keep improving and maintaining it.
Closing this when the repo is ready, the first release is out and examples are here are updated.
Initial empty repo: https://github.com/moderngl/moderngl_window with MIT License to match ModernGL
Quite a bit of progress so far on moderngl_window
. If anyone wants to provide input for the initial version, go over at https://github.com/moderngl/moderngl_window and create issue(s) or voice your opinion in our Discord server.
Huge thanks for all your work on moderngl. I'm just getting started, but loving it.
Just in case my 'beginners perspective' is informative:
I've been getting started using moderngl the last couple of weeks. I haven't done any OpenGL for a few years, and then I was using the old fixed pipeline stuff, so it's a bit of a learning curve for me. I found the examples very useful indeed to browse around the source of the different features moderngl exposes, and run them to see them render. But when it came time to start coding my own application, I found it suboptimal to pick apart the examples from the windowing classes, to extract just the lines of code I needed for a minimal pyglet/moderngl application.
I ended up grepping around the source and found /examples/old-examples/snippets/mgl_new_example_pyglet.py
, which (understandably) didn't quite still work with moderngl 5.5, but with a couple of fixes, was exactly the start I needed to build upon.
So I guess I'm saying: If you're revamping the examples, then be aware that for some users, there's still huge value in a fairly minimal 'hello world' app, hardcoded to run on a particular windowing system.
I could make a directory for minimal window setups (ONE module) with examples for PyQt5, glfw, sdl2 and pyglet, but I do think moderngl_window
can help out here as well. Right now having all the current window stuff inside the example directory is a whole lot to deal with, I agree 😄 (It will disappear soon!)
To get a basic example working, soon you should only need to pip install moderngl_window
and..
import moderngl_window as mglw
class Test(mglw.WindowConfig):
gl_version = (3, 3)
def __init__(self, **kwargs):
super().__init__(**kwargs)
def render(self, time, frametime):
self.ctx.clear(1.0, 0.0, 0.0, 0.0)
mglw.run_window_config(Test)
The main challenge is providing something that works on all platforms out of the box. Using the moderngl_window
package will also automatically make the user's project platform and window library independent.
(Also providing basic texture, shader and object/scene loading)
Looks like moderngl_window
is almost complete now. Got a couple more things to do and I think a 0.9 release is possible. That project exploded into something much bigger. 360 commits so far and a fairly big test suite that covers 85% of the codebase.
Some points:
moderngl_window
docs or examples, not in this repo. I think most people will just use the built in windows anyway.Example
class that extends moderngl_window.WindowConfig
.Now on PyPI : https://pypi.org/project/moderngl-window/
I guess we can close this one once examples + READMEs are updated.
Got a bit more to do with examples tomorrow and I'll close this
Finally closing this one after 5 months+
Move all the window types into a separate package: https://github.com/cprogrammer1994/ModernGL/tree/master/examples/window
This would of course require some changes and tweaking, but what we have now actually works surprisingly well. This means users of ModernGL can also get started easily without disecting the window examples and copy paste over snippets to get their own projects running.
I saw a need for this when trying to add ModernGL to a couple of other projects as well. If I can just install a window package instead of re-inventing a new window every time, life would be a lot easier making ModernGL almost as simple to get started with as for example pyglet.
I can take responsebility for creating and maintaining this repo. The question is where to create it. I see you have a ModernGL Organization, but sice the main repo is not even there it might not even matter at this point. We can always move repos around in the future (owernship transfer works really smooth here on github).
What do you think?