hi all.
I am new to OpenGLES2.0. I use PowerVR in my project on win7 platform. Recently I wirte a fragment shader, it has a compile error but I do not know why.
This is my shader code:
<br />
struct STestStruct<br />
{<br />
mediump vec4 kValue;<br />
};<br />
void TestFun( out STestStruct kParam )<br />
{<br />
kParam.kValue = vec4(1,0,0,0);<br />
}<br />
void main ()<br />
{<br />
STestStruct kStruct;<br />
TestFun( kStruct );<br />
gl_FragColor = kStruct.kValue;<br />
};<br />
```<br />
The error message is: "Compile failed. ERROR: 0:1: 'TestFun' : no matching overloaded function found“.<br />
<br />
I do not know, so I change my shader code as below:<br />
struct STestStruct
{
mediump vec4 kValue;
};
STestStruct TestFun()
{
STestStruct kParam;
kParam.kValue = vec4(1,0,0,0);
return kParam;
}
void main ()
{
STestStruct kStruct = TestFun();
gl_FragColor = kStruct.kValue;
};
<br />
But there is also has a error : 'return' : function return is not matching type.<br />
<br />
Is there a problem with my shader code? Wish somebody can help me. Thanks very much!