Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revive the ReloadableProgram #84

Open
mahroni-14 opened this issue May 9, 2020 · 9 comments
Open

Revive the ReloadableProgram #84

mahroni-14 opened this issue May 9, 2020 · 9 comments

Comments

@mahroni-14
Copy link

I have created a Custom Window Context with GLFW, where I have needed to create a single file shader program with below code:

resources.programs.load(ProgramDescription(path = shader_path, reloadable = True))

I am unable to understand the behavior of the code. Does it suppose to reload the shader program auto magically or I am missing something?

@einarf
Copy link
Member

einarf commented May 9, 2020

That one is lingering from the my original project this one is based on. It was a bit more frameworky so there was a default R key mapped in debug mode that would reload all programs marked as reloadable. This will only work if you are rendering with VAO instances.

I had completely forgotten about this and it might be possible to salvage it. It's a very useful feature to be able to reload programs while running.

@mahroni-14
Copy link
Author

Thank you, for your quick answer.

So, for the default R key behavior do I need to use the Default camera?
If so, how can I use this behavior from my code. Is there any utility method?
You see I am trying to make a ShaderToy like system but whenever a glsl file change,
I need it to be re-create the program.

@einarf
Copy link
Member

einarf commented May 9, 2020

The reload stuff is not really working well, so I would abandone using the reloadable=True system for now. We should keep this one open as a reminder to fix this issue.

In the meantime you can look at : https://github.com/einarf/shadertoy

@mahroni-14
Copy link
Author

What you have made it already?? :D

@einarf
Copy link
Member

einarf commented May 9, 2020

Of course. It's not perfect, but it works 😄

@mahroni-14
Copy link
Author

Do you use any kind of file watcher?

@einarf
Copy link
Member

einarf commented May 9, 2020

Nope. It just stats the files in intervals. A bit lazy, but I needed it to work cross platform. There was some bug with a library I was using for it and I just took the simple path for now.

@mahroni-14
Copy link
Author

Thank you.

So, do you have any future plan about ReloadableProgram support with watchdog or something like that for moderngl-window?

@einarf
Copy link
Member

einarf commented May 9, 2020

It's an immensely useful feature, so the plan is definitely to add it when there is time. This issue can be a reminder that it needs to be done.

@einarf einarf changed the title What is the behavior of ReloadableProgram? Revive the ReloadableProgram May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants