Documentos de Académico
Documentos de Profesional
Documentos de Cultura
h>
#include <cmath>
// polar to cartesian
float x = r * cos( theta );
float y = r * sin( theta );
glVertex2f( x - sz, y - sz );
glVertex2f( x + sz, y - sz );
glVertex2f( x + sz, y + sz );
glVertex2f( x - sz, y + sz );
}
glEnd();
}
size_t win_w = 0;
size_t win_h = 0;
double aspect_ratio = 0;
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-100*aspect_ratio, 100*aspect_ratio, -100, 100, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glFlush();
glutSwapBuffers();
}
glutInitWindowSize(800,600);
glutCreateWindow("Spiral");
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}