Geri Borbás
Geri Borbás

Reputation: 16598

GLSL pow function?

I have this:

    float xExponential = pow(xPingPong, 5);

And is not working, claiming:

ERROR: 0:53: No matching overload for call to function 'pow'

Am I doin' something wrong? Developing for iOS with OpenGL ES 2.0.

Upvotes: 18

Views: 31305

Answers (3)

Mayank Kumar Chaudhari
Mayank Kumar Chaudhari

Reputation: 18538

Although accurate answers are provided, it is good to explain why those answers work.

float xExponential = pow(xPingPong, 5.0);

GLSL is strongly typed. 1, 2, 3, etc. are considered int. GLSL pow function expects a float value. Thus, you need to convert your power to float. 1., 1.0, 1.f, 1.0f, etc. are treated as float values.

Hope this helps.

Upvotes: 0

Neeleshwar Kumar
Neeleshwar Kumar

Reputation: 375

Your code is fine just syntax error

Write upto decimal digit

 float xExponential = pow(xPingPong, 5.0);

or

 float xExponential = pow(xPingPong, 5.);

Upvotes: 2

Mennan
Mennan

Reputation: 4497

Can you try this ?

float xExponential = pow(xPingPong, 5.0);

Upvotes: 55

Related Questions