opengl-intro: sinus_2.c

File sinus_2.c, 450 bytes (added by msitar, 15 years ago)

Skaliranje koordinat

Line 
1#include <GL/glut.h>
2#include <math.h>
3
4float x;
5float y;
6
7void display()
8{
9  glClear(GL_COLOR_BUFFER_BIT);
10  glBegin(GL_LINE_STRIP);
11  for(x=-3.14;x<=3.14;x+=0.6)
12  {
13    y=sin(x);
14    glVertex2f(x/3.14, y/3.14);
15  }
16  glEnd();
17  glFlush();
18}
19
20
21int main(int argc, char *argv[])
22{
23  glutInit(&argc,argv);
24  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
25  glutCreateWindow("C GLUT program");
26  glutDisplayFunc(display);
27  glutMainLoop();
28  return 0;
29}