Hi,
I'm having a little trouble understanding the documentation here:
https://www.airplaysdk.com/docs.php?url=/api/api/group__IwGxShaderTechnique.html
What's the "components" part of a custom parameter? I was trying to define a custom fixed-size vector uniform parameter, say, 'uniform mediump vec3 lightVectors[4]'. Assuming components meant array size, I defined my parameter as such: 'param "lightVectors" vec4 4 no_default'. When I do this, Airplay fires the following assertion:
Expression: type == m_Type
Message: Changing type of shader parameter 'lightVectors'
The data was set using the following code:
if(lightsParam) {
float val[12] = { 1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
1.0, 1.0, 0.0,
1.0, 0.0, 1.0 };
lightsParam->Set(CIwGxShaderUniform::VEC3, 0, val);
}
No doubt I'm going about this the wrong way, but I'm afraid the documentation doesn't help me here. Any help would be greatly appreciated.
EDIT:
Sorry - turns out I'd actually made a typo in the shader code and put lightVectors as vec4 in one place.
Now it's *mostly* working. I can set the values and the shader compiles and runs, but I get only 0-vectors when I try to access any array element other than the first one.












Hi Morre,
The problem is that the Set function only sets one member of the array.
You need to do:
if(lightsParam) {
float val[12] = { 1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
1.0, 1.0, 0.0,
1.0, 0.0, 1.0 };
for(int i = 0; i < 4; i++) {
lightsParam->Set(CIwGxShaderUniform::VEC3, i, val+i*3);
}
}
I'll clarify that in the docs.
Mark.
Thanks, that did the trick. :)