GLSL Buffer A again please

Hi, me again.
I’m back on track of taming GLSL.

I think the instructions found in this page are not complete or incorrect. At least the part on buffers. (it should work out of box so people can understand)

nvoid.gitbooks.io/introduction- … ertoy.html
last section about buffers

I tried couple of times following instruction on convert shaders with buffers and it never works despite applying everything mentioned on this tutorial. Or I might have forgotten something.
in any case please help me out!

I have tried comparing with that ‘‘purple diffusion shader’’ kindly converter by David (the only working shader with buffer available) But all is quite messy to understand, I’m now lost.
example not woking.2.toe (5.56 KB)

If you look at the errors in the Info DAT they can help sort out the issue.

The first thing is to delete line 14. In TouchDesigner the sTD2DInputs is already declared behind scenes, so you dont need that line at all, it causes a conflict.

Once you delete that, it says the next error is on live 107, which says index out of bounds. The only thing in that line with an index is sTD2DInputs[1]. Which would mean it’s trying to grab the 2nd plugged in texture, but there’s only 1 texture plugged in. If you plug in anything into the GLSL TOP’s input (so that there’s 2) the error goes away.

Can you send a link to the original shadertoy(or other site) you’re working from? Curious to look at the original. Also any recommendations you have to make the section of the book easier, by all means let us know.

Thx Elburz, I know I’m slow student.
once I 'll manage that one I can analyse and manage much more.
I’ll try your corrections today.

shadertoy.com/view/4tV3Wd

its the shader form example last one about buffers. I have tried the whole process few times and was loosing the plot here.

nvoid.gitbooks.io/introduction- … ertoy.html

is the most precious info about shaders in TD for sure, everything worked fine except last one.
THX a lot

No problem, let me know if you’re able to get it working with my last post. If you figure out some things we can add, let us know.

I think the issue with what you were trying now that I look at the shadertoy is that you tried to copy and paste the whole “shader input” section into the top of your GLSL shader. Is that correct? That would be explain the declaration of a the sampler2D at the top which wasn’t necessary. I find it faster and much more convenient to only declare the uniforms you need for that shader, and when you’re doing so you wouldn’t include the sampler2D since it’s already declared by TouchDesigner.

Hello, So I tried your corrections here, but there must be something i’m missing.
I might have copied the whole shader input as you said, can remember exactly.
I think I followed instruction to the letter. But maybe I mixed up.
Text port works good, I have already started as list of things that can go wrong in a conversion.
success rate is going up. But that one! I’ll print the pages to attach to my wall once converted properly.
example not woking3.toe (5.56 KB)

In the Buf_A shader you forgot to add all the necessary uniforms to the Vectors page of the GLSL TOP. So in the shader you’ve declared all the things like iResolution, iGlobalTime, etc etc. But in the GLSL TOP you only actually gave a value to iResolution, iGlobalTime, and iMouse. Once I added iFrame, it started doing stuff, I’d recommend adding all the rest if you need them in the code. I didn’t look at the Image shader but I’d bet it’s a similar issue because you don’t have anything on the Vectors page and I see 2 uniforms declared in the code.

Annoying if as long as your code is ok (uniform defined correctly in the shader) you won’t get an error if you dont correctly define them in the GLSL TOPs Vectors page, you just have a not working shader.

great thx for that fine explanation,thx for your time.
I’ll analyze all that and try to apply to next one.
Probably got mixed up with that converter that puts pixel and shader in one.

working fanastic! thx

I found a channel on youtube that could serve many people interested by shaders like me.
first time I found that detailed so clearly.

youtube.com/watch?v=u5HAYVHsasc

:smiley: