Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glut.h>
- #include <windows.h>
- GLfloat xangle=0.0, yangle=0.0;
- void init (void) {
- glClearColor (1.0, 1.0, 1.0, 0.0);
- glLineWidth(1.0);
- glMatrixMode (GL_PROJECTION);
- glLoadIdentity ();
- glOrtho(-6,6,-6,6,-6,6);
- }
- void display (void) {
- glClear (GL_COLOR_BUFFER_BIT);
- glPushMatrix();
- glColor3f (1.0, 0.0, 0.0);
- glBegin (GL_POLYGON);
- glVertex2f (-4.0, -5.0);
- glVertex2f (-1.0, -5.0);
- glVertex2f (-1.0, -1.0);
- glVertex2f (-4.0, -1.0);
- glEnd ();
- glPopMatrix ();
- glutSwapBuffers ();
- glFlush ();
- }
- void KeyboardAssign (GLubyte key, GLint x, GLint y) { switch (key) {
- case 'd':
- glScalef (2.0, 1.0, 0.0);
- glutPostRedisplay ();
- break;
- }
- }
- int main (int argc, char** argv) {
- glutInit (&argc, argv);
- glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); glutInitWindowPosition (0, 0); glutInitWindowSize (1500, 1500); glutCreateWindow ("MODUL 6 Transformasi"); init ();
- glutDisplayFunc (display);
- glutKeyboardFunc (KeyboardAssign);
- glutMainLoop ();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement