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

Using multiple textures in one shader #2

Open
Lomacar opened this issue Apr 9, 2019 · 3 comments
Open

Using multiple textures in one shader #2

Lomacar opened this issue Apr 9, 2019 · 3 comments

Comments

@Lomacar
Copy link

Lomacar commented Apr 9, 2019

Hello. I am trying to convert an old cellular automata simulation I wrote in Processing to WebGL. Your example here was the first/best one that I could find that made use of swapping or pingponging of textures, which is necessary for CA simulations on the GPU. I am trying to just replace your frag shader with mine.

The problem I have is that my CA is complex and requires two separate textures to hold all the information about a cell's state. I am not able to figure out your Igloo API and I know nothing about WebGL. In fact I barely remember what I did in Processing years ago. I am hoping that only a few lines of code need to be changed. I think I will ultimately need two 'front' textures and two 'back' textures or maybe I just need two uniform's like state and state2?

All the guts of my old CA are written in GLSL and at the top I have uniform sampler2D src_tex_unit0, src_tex_unit1; which is how the two textures are passed in. And I have out vec4 outState, outEnergy;, which is the corresponding output values for the shader.

@Lomacar
Copy link
Author

Lomacar commented Apr 10, 2019

I think I will be able to figure out how to do what I want from scratch using P5.js.

@skeeto
Copy link
Owner

skeeto commented Apr 10, 2019 via email

@Lomacar
Copy link
Author

Lomacar commented Apr 12, 2019

Thanks for the reply. I have managed to figure things out with P5. Well, I got a test with multiple textures working. Still hooking up all the wires for my old Processing simulation to work...

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