Hi I tried to convert glsl cord from Shadertoy but these errors occured.

ERROR: /project1/glsl1_pixel:18: ‘assign’ : l-value required “gl_DefaultUniformBlock” (can’t modify a uniform)

Anyone knows what it mean and how to figure out?

Thanks.

Hi I tried to convert glsl cord from Shadertoy but these errors occured.

ERROR: /project1/glsl1_pixel:18: ‘assign’ : l-value required “gl_DefaultUniformBlock” (can’t modify a uniform)

Anyone knows what it mean and how to figure out?

Thanks.

Hi, can you share the code? Otherwise it will be hard to debug this.

For sure. This is a code halfway throuh.

```
uniform vec3 iResolution;
uniform float iTime;
uniform vec4 iMouse;
uniform vec4 iDate;
uniform vec2 I;
uniform float O;
void main()
{
vec3 p, q, r = iResolution;
float i = 1.0, j = i, z;
for (O *= z; i > 0.0; i -= 0.02)
{
z = p.z = sqrt(max(z = i - dot(p = (vec3(I + I, 0) - r) / r.y, p), -z / 1e5)); // fov
p /= 6.0 + z; // smoothness
p.xz *= mat2(cos(iTime + vec4(2, 18, 23, 2))); // shape
vec3 cos_q = cos(q += p);
vec3 sin_q_yzx = sin(q.yzx);
j = cos(j * dot(cos_q, sin_q_yzx) / 0.3);
O += i * pow(z, 0.4) * pow(j + 1.0, 8.0) * (sin(i * 3e1 + vec4(0, 1, 2, 3)) + 1.0) / 2e3; // Brightness
}
O *= O;
}
```

As the error message states, you can’t modify the value of uniforms. But you’re trying that twice with “O”.

In general there are several questionable things about the shader you posted. How familiar are you with glsl? And can you share the link to the shadertoy that you’re trying to convert?

Agree with josefpeltz concerning uniform and errors but maily, you lack a proper output!

With pixel schader, you need output declaration

out vec4 fragColor;

void main()

{

fragColor = vec4(1);

}

Can you post the original shader? It would be easier to help you

Thanks Josef.

This is a link. Appreciate it.

Hello,

The main problem with shadertoy its they use an old version of webglsl.

And propriatary function (iResolution, iTime etc.)

I tried to change some things as to obtain a working shader. Its not the same result, I dont know why and I am not interested to go further.

But you can see where are the points you need to tweek…

uniform float iTime;

uniform vec3 iResolution;out vec4 fragColor;

void main()

{

vec3 p,q,r = iResolution;

float i = 1.0, j = i, z = 0;

vec4 color;

vec2 I = gl_FragCoord.xy;for (color *= z; i > 0.0; i -= 0.02)

{

z = p.z = sqrt(max(z = i - dot(p = (vec3(I + I, 0) - r) / r.y, p), -z / 1e5)); // fov

p /= 6.0 + z; // smoothness

p.xz *= mat2(cos(iTime + vec4(2, 18, 23, 2))); // shape`vec3 cos_q = cos(q += p); vec3 sin_q_yzx = sin(q.yzx); j = cos(j * dot(cos_q, sin_q_yzx) / 0.3); color += i * pow(z, 0.4) * pow(j + 1.0, 8.0) * (sin(i * 3e1 + vec4(0, 1, 2, 3)) + 1.0) / 2e3; // Brightness } color *= color;`

fragColor = TDOutputSwizzle(color);

}

shadertoy to TD.toe (4.4 KB)

1 Like

Thanks for your time!

Oh that’s why it’s a tricky one.

I also wonder why the result is different but keep tweeking it to make it look nicer.

Appreciate it.