Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef __APPLE__
- #include <GLUT/glut.h>
- #else
- #include <GL/glut.h>
- #endif
- #include <stdlib.h>
- int angle = 0;
- void display(void)
- {
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glRotatef(90, 0, 0, 1);
- glScalef(0.5f,0.5f,0.5f);
- glLineWidth(4.0);
- glBegin(GL_LINE_STRIP);
- glColor3f(1.0f,0.0f,1.0f);
- glVertex3i(0,0,0);
- glVertex3i(2,0,0);
- glVertex3i(0,2,0);
- glVertex3i(2,2,0);
- glEnd();
- glLoadIdentity();
- glutSwapBuffers();
- }
- void mouse(int button, int state, int x, int y) {
- switch (button) {
- case GLUT_LEFT_BUTTON:
- if (state == GLUT_DOWN)
- exit(0);
- break;
- }
- }
- void keyboard(unsigned char key, int x,int y)
- {}
- static void idle(void)
- {
- glutPostRedisplay();
- }
- int main(int argc, char *argv[])
- {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(900, 900);
- glutInitWindowPosition (100, 100);
- glutCreateWindow("Assignment 1");
- glutDisplayFunc(display);
- glutMouseFunc(mouse);
- glutKeyboardFunc(keyboard);
- glutIdleFunc(idle);
- glutMainLoop();
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment