Hi, I’m trying to write a shader to perform a water/ocean reflection effect. I’m in Win32 using dev-cpp with glut. I keep running into a problem that i have previously run into while trying to write shaders. It seems like maybe I have run out of instructions or something, The compiler error i get is this:
Fragment info
(15) : error C0000: syntax error, unexpected ‘)’ at token “)”
(15) : error C0501: type name expected at token “)”
But the 15th line of the program is simply the closing bracket ( ‘}’ ) of my main function. And theres nothing after it. My fragment shader looks like this:
varying vec4 eVec;
uniform float texseed;
uniform sampler2D normMap1, normMap2;
uniform samplerCube cubeMap;
void main( )
{
float dp;
vec4 nVec1 = texture2D( normMap1, gl_TexCoord[ 0 ].st ) * 2.0 - 1.0;
vec4 nVec2 = texture2D( normMap2, gl_TexCoord[ 0 ].st ) * 2.0 - 1.0;
vec4 nVec = mix( nVec1, nVec2, texseed );
dp = clamp( dot( normalize( eVec ), nVec ) * 2.0 + 1.0, 0.0, 1.0 );
gl_FragColor = mix( vec4( 0.0, 0.3, 0.35, 1.0 ), textureCube( cubeMap, vec3( reflect( eVec, nVec ) ) ), dp );
}
if anyone counted, at 15, you end up at }. So anyway, to remove the error i deleted the clamp at line 13. So one might think clamp is giving me a problem, but i replaced ‘vec4 nVec = mix( nVec1, nVec2, texseed );’ with
‘vec4 nVec = nVec1;’ and put the clamp back in, and it once again compiled fine. If i am really using too many instructions it seems like there aren’t enough…
Thanks,
-Steve