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

Load shader as a external file #86

Open
joaodafonseca opened this issue Mar 27, 2023 · 1 comment
Open

Load shader as a external file #86

joaodafonseca opened this issue Mar 27, 2023 · 1 comment

Comments

@joaodafonseca
Copy link

Hello,

is it possible to load a shader in a external file? any example on how to do that?

thanks,
J

@raaaahman
Copy link

raaaahman commented Sep 18, 2023

Hello, would the following code fit your use case?

        const sandbox = new GlslCanvas(document.querySelector('#app'))

        fetch('/path/to/shader.frag')
        .then(response => {
          return response.text()
        })
        .then(fragment => {
          sandbox.load(fragment)
        })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants