Matteo_

07-16-2016, 01:56 AM

I'm coding a shader in GLSL and I need to use sine and cosine functions.

The problem is that I obtain this error compiling the shader:

error(#202) No matching overloaded function found: cos

I look on the web and I found that there exists these definitions:

float cos(float angle)

vec2 cos(vec2 angle)

vec3 cos(vec3 angle)

vec4 cos(vec4 angle)

I want to use the scalar one, and this is the code that generate the error:

#version 450

[...]

layout (location = 6) uniform float angleY;

[...]

void main()

{

[...]

float cosangY = cos(angleY);

[...]

}

I also tried to compute the cosine on a constant value (instead of a uniform variable) but the same error is generated.

#version 450

[...]

void main()

{

[...]

float XXX= cos(0.0);

[...]

}

I'm a beginner in both shading and OpenGL, what I'm doing wrong in my code? Thanks

The problem is that I obtain this error compiling the shader:

error(#202) No matching overloaded function found: cos

I look on the web and I found that there exists these definitions:

float cos(float angle)

vec2 cos(vec2 angle)

vec3 cos(vec3 angle)

vec4 cos(vec4 angle)

I want to use the scalar one, and this is the code that generate the error:

#version 450

[...]

layout (location = 6) uniform float angleY;

[...]

void main()

{

[...]

float cosangY = cos(angleY);

[...]

}

I also tried to compute the cosine on a constant value (instead of a uniform variable) but the same error is generated.

#version 450

[...]

void main()

{

[...]

float XXX= cos(0.0);

[...]

}

I'm a beginner in both shading and OpenGL, what I'm doing wrong in my code? Thanks