Hey guys i trying to build a function plotter and here it is my code so far....Iam geting an error in line 72 "glutInit(&argc;argc, argv);"
1>c:\users\alb\documents\projects\laba8\eeee\eeee\ee.cpp(72): error C2065: 'amp' : undeclared identifier
1>c:\users\alb\documents\projects\laba8\eeee\eeee\ee.cpp(72): error C2143: syntax error : missing ')' before ';'
1>c:\users\alb\documents\projects\laba8\eeee\eeee\ee.cpp(72): error C2059: syntax error : ')'
line 72:glutInit(&argc, argv);
Any idea how to fix it? this is my code so far!!
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
float func(float x)
{
return x*x;
}
void draw(float (* func)(float x), float x1, float x2, float y1, float y2, int N)
{
float x, dx = 1.0/N;
glPushMatrix();
glScalef(1.0 / (x2 - x1), 1.0 / (y2 - y1), 1.0);
glTranslatef(-x1, -y1, 0.0);
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINE_STRIP);
for(x = x1; x < x2; x += dx)
{
glVertex2f(x, func(x));
}
glEnd();
glPopMatrix();
};
void redraw(void)
{
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
draw(func, -3, 3, 0, 10, 10);
glutSwapBuffers();
};
void idle(void)
{
glutPostRedisplay();
};
void key(unsigned char c, int x, int y)
{
if(c == 27) exit(0);
};
void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, 1, 0, 1, -1, 1);
glMatrixMode(GL_MODELVIEW);
};
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Graph plotter");
glutDisplayFunc(redraw);
glutKeyboardFunc(key);
glutReshapeFunc(reshape);
glutIdleFunc(idle);
glLineWidth(1.0);
glutMainLoop();
return 0;
}