-
Notifications
You must be signed in to change notification settings - Fork 34
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
Comments
I think I will be able to figure out how to do what I want from scratch using P5.js. |
In case you hadn't seen it, here's the article I wrote about how it
works:
A GPU Approach to Conway's Game of Life
https://nullprogram.com/blog/2014/06/10/
And in a later project I extended this to a more complex automata that
solves mazes:
A GPU Approach to Path Finding
https://nullprogram.com/blog/2014/06/22/
https://github.com/skeeto/webgl-path-solver
Though that still just uses a single texture. If you need more than
that, you'll have to bind another pair of textures to uniforms. That's
mostly about repeating exactly what is already done with the "front" and
"back" textures.
These days I do wish I hadn't used Igloo for this since it's an extra
layer of abstraction that makes it harder to reuse. I no longer use
Igloo for that reason, and instead use WebGL directly. I originally
wrote and used Igloo as a kind of crutch while I was getting the hang of
OpenGL and WebGL.
|
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
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
andstate2
?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 haveout vec4 outState, outEnergy;
, which is the corresponding output values for the shader.The text was updated successfully, but these errors were encountered: