Pi = 3.1415926

Hi @all,
is the constant Pi (3.1415926…) defined in GLSL?
chao
jlukas

No, you’ll have to define it yourself

#define M_PI 3.1415926535897932384626433832795

Thanx!

Hi,

Can anyone help me with this please; I like to draw a hexagon in OpenGL (Java language).

What I did is:

double M_PI = 3.14159265358;glBegin(GL_POLYGON);
for(int i = 0; i < 6; ++i) {
glVertex2d(sin(i/6.02M_PI),
cos(i/6.02M_PI));
}
glEnd();

But the it comes an error that sin and cos have not been declare?

have you included your maths library?
Also, check if your sin / cos functions take degrees or radians as their angle argument.

Same question, as M_PI is normally defined in math.h

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.