Advertisement
Guest User

RIAN

a guest
Jun 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <GL/glut.h>
  2. #include <windows.h>
  3. GLfloat xangle=0.0, yangle=0.0;
  4. void init (void) {
  5. glClearColor (1.0, 1.0, 1.0, 0.0);
  6. glLineWidth(1.0);
  7. glMatrixMode (GL_PROJECTION);
  8. glLoadIdentity ();
  9. glOrtho(-6,6,-6,6,-6,6);
  10. }
  11.  
  12. void display (void) {
  13. glClear (GL_COLOR_BUFFER_BIT);
  14. glPushMatrix();
  15.  
  16. glColor3f (1.0, 0.0, 0.0);
  17. glBegin (GL_POLYGON);
  18. glVertex2f (-4.0, -5.0);
  19. glVertex2f (-1.0, -5.0);
  20. glVertex2f (-1.0, -1.0);
  21. glVertex2f (-4.0, -1.0);
  22. glEnd ();
  23.  
  24. glPopMatrix ();
  25. glutSwapBuffers ();
  26. glFlush ();
  27. }
  28.  
  29.  
  30. void KeyboardAssign (GLubyte key, GLint x, GLint y) { switch (key) {
  31.  
  32. case 'd':
  33. glScalef (2.0, 1.0, 0.0);
  34. glutPostRedisplay ();
  35. break;
  36. }
  37. }
  38.  
  39. int main (int argc, char** argv) {
  40. glutInit (&argc, argv);
  41. glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); glutInitWindowPosition (0, 0); glutInitWindowSize (1500, 1500); glutCreateWindow ("MODUL 6 Transformasi"); init ();
  42. glutDisplayFunc (display);
  43. glutKeyboardFunc (KeyboardAssign);
  44. glutMainLoop ();
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement