error C7505: OpenGL does not allowe

Hello TD Community,

at the moment Im learning to convert shaders from Shadertoy and I cant seem to fix this one. The nVoid guide doesnt help and i have watched all of Vincet Houze Tuts on Youtube. Still cant fix it.

Found a thread on Khronos but cant wrap my head around it.
forums.khronos.org/showthread.php/75821

Its clear Im new to this but I dont want to give up.
If someone could spare a minute and look over this.I would be very thankfull.

Im fighting w/ this one:
shadertoy.com/view/4s23DG

My results:

Vertex Shader Compile Results:
Compiled Successfully

Pixel Shader Compile Results:
0(113) : error C7505: OpenGL does not allow swizzles on scalar expressions
0(113) : error C1031: swizzle mask element not present in operand “xy”

=============

Program Link Results:
Fragment info

0(113) : error C7505: OpenGL does not allow swizzles on scalar expressions
0(113) : error C1031: swizzle mask element not present in operand “xy”
(0) : error C2003: incompatible options for link

Kind regards

Simon
2D Vector Field Flow.9.toe (5.69 KB)

Hi HZB,

So you’ve got a vec2 called iChannelResolution that you’re passing in as a uniform to your shader - which is great, but it’s only a single vec2, not an array. so while something like sTD2DInputs needs an index position to indicate which input you might be using, you don’t need that same indicator on your uniform as is (that’s different if you were passing in an array of values). Long story short, it’s the little square brackets and the index that are throwing this error. Does that make sense?

original line 113:

return 2.0 * texture(iChannel0, (pos + vec2(iTime * 100.0, 0.0)) / iChannelResolution[0].xy).xy - 1.0;

corrected line 113:

return 2.0 * texture(iChannel0, (pos + vec2(iTime * 100.0, 0.0)) / iChannelResolution.xy).xy - 1.0;

Good evening Matthew,

yes it makes sense. Guess I have to lern more about the type of data Iam working with and how to handle it.

Thank you very much :smiley:
You helped me big time