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

(question) Is there a way to render to texture? #244

Closed
pedroqueiroga opened this issue May 17, 2020 · 2 comments
Closed

(question) Is there a way to render to texture? #244

pedroqueiroga opened this issue May 17, 2020 · 2 comments

Comments

@pedroqueiroga
Copy link

I am trying to port the following shadertoy to gl-react: https://www.shadertoy.com/view/4sG3WV

I can't make those iChannels work. It would be simple if I could render to texture and then pass it as the required iChannels, it doesn't seem like simply stacking would be possible (couldn't make it work), as the examples in the docs show.

How could I proceed?

@gre
Copy link
Owner

gre commented May 18, 2020

component composition: when you have nested GL components that's essentially what's happening.

https://gl-react-cookbook.surge.sh/diamondhello

HelloBlue is being rendered in a framebuffer that is being passed as a texture to DiamondCrop.

@gre gre closed this as completed May 18, 2020
@pedroqueiroga
Copy link
Author

pedroqueiroga commented May 18, 2020

I know that we can stack, but what that shader requires is something a bit different, is it not? Sorry if I am missing a point, I am new to shaders.
To me it looks like gl-react can implement shaders of the type:
A[i]->A[i+1]->B[i]->B[i+1]->C[i]...

What that effect uses is something like:
A[i](A[i-1], B[i-1])->A[i+1];
B[i](B[i-1])->B[i+1];
C[i](A[i],B[i])

I'm trying to represent the inputs and outputs where i = frame number.

At a certain pass, A needs the texture rendered by it in the previous pass, and the texture rendered by B in the previous pass. How could I represent that with gl-react?

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