1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include <Gl\glut.h>
#include <GL\glew.h>
void render(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glColor3f (1.0,1.0,1.0);
//Square Number 1
glBegin (GL_POLYGON);
glVertex3f (20.0, 20.0, 0.0);
glVertex3f (80.0, 20.0, 0.0);
glVertex3f (80.0, 80.0, 0.0);
glVertex3f (20.0, 80.0, 0.0);
glEnd ();
glFlush ();
}
int main (int argc, char **argv)
{
glutInit (&argc, argv);
glutInitDisplayMode ( GLUT_DEPTH| GLUT_SINGLE | GLUT_RGBA);
glutInitWindowPosition (100, 100);
glutInitWindowSize (500, 500);
glutCreateWindow ("Sample");
glClearColor (0.0, 0.0, 0.0, 0.0);
glOrtho (0.0, 100.0, 0.0, 100.0, -1.0, 1.0);
glutDisplayFunc(render);
glutMainLoop ();
return 0;
}
|