Forums > Jitter

unable to bind GLSL uniform param

June 25, 2013 | 9:34 am

Hi -

I’m a newbie to writing shaders and getting an error reporting

‘Unable to bind GLSL uniform param…’

on all 3 of my supposedly exposed parameters from a simple shader.

I’ve included a test patch I’m using and both the frag and vert shaders as well as the JXS file as I’m honestly not sure where to look for the issue.

The shader behavior doesn’t seem to be as expected either but I’ll cross that bridge when I get the parameters exposed…

Thanks in advance,

N

<code>

– Pasted Max Patch, click to expand. –

</code>


June 25, 2013 | 9:37 am

Ah crap shows what a newbie I am … can’t attach the GLSL files so bodies copied below.

VS:

varying vec4 vertexPosition;
varying vec4 circleColor;
varying float intensity;
varying float circleSizeModifier;

void main()
{
intensity = 1.65;
circleColor = vec4(0.0,0.3,1.0,1.0);
circleSizeModifier = 4.0;

gl_Position = ftransform();
vertexPosition = gl_Position;

}

FS

varying vec4 vertexPosition;
varying vec4 circleColor;
varying float intensity;
varying float circleSizeModifier;

void main()
{
// gl_FragColor = gl_Color;
vec4 center = vec4(0.0,0.0,0.0,0.0);
float convertedHeight = vertexPosition.y * 0.5;

vec4 position = vec4(vertexPosition.x, convertedHeight, vertexPosition.z, vertexPosition.a);
float alpha =distance(position.xy, center.xy);
alpha = alpha * circleSizeModifier;
alpha = pow(alpha , intensity);

alpha = pow(alpha ,-1.0);

gl_FragColor = vec4(circleColor.x, circleColor.y, circleColor.z, alpha* circleColor.a);

}

JXS

<jittershader name="gradShader">
<param name="circleColor" type="vec4" default="0.0 0.3 1.0 1.0" />
<param name="intensity" type="float" default="1.65" />
<param name="circleSizeModifier" type="float" default="4.0" />
<language name="glsl" version="1.0">
<bind param="circleColor" program="fp" />
<bind param="intensity" program="fp" />
<bind param="circleSizeModifier" program="fp" />
<program name="vp" type="vertex" source="gradShader.vs.glsl" />
<program name="fp" type="fragment" source="gradShader.fs.glsl" />
</language>
</jittershader>


June 25, 2013 | 11:18 am

you’ve declared 3 parameters in your JXS, and have bound them to your fragment program.
those need to be declared as "uniform" in your glsl code, not "varying", and should only be declared in the program you bound them to (fp – fragment program in your case).


June 27, 2013 | 8:06 am

Thank you so much, Rob – you got me on the right track and the shader is now running without errors.

Now as to the other bit about getting it to behave as expected, gonna start a new thread.


Viewing 4 posts - 1 through 4 (of 4 total)