Pages

Sabtu, 12 Mei 2012

GARFIKA PRAKTIKUM 6

#include <windows.h> 
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h>
#include <stdarg.h> 
#include <glut.h>
#include <glu.h>
#include <iostream>

float _angle = 45.0f;

//Draws the 3D scene
void mydisplay() 

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);//Switch to setting
    glLoadIdentity();//Reset the camera
    //glTranslatef(0.0f, 0.6f, 0.0f);
    //glScalef(0.7f, 0.7f, 0.7f);
    //glRotatef(_angle, 0.0f, 0.0f, 1.0f);
    glPushMatrix();//Save the transformations
    glBegin(GL_POLYGON); 
    glVertex3f(-0.1f, -0.1f,0.0f); 
    glVertex3f(-0.1f, 0.1f,0.0f); 
    glVertex3f(0.1f, 0.1f,0.0f); 
    glVertex3f(0.1f, -0.1f,0.0f); 
    glEnd();

    glPopMatrix();//Undo the move to the center of
    glutSwapBuffers();//Send the 3D scene to the
    glFlush(); 
}

void update(int value) {
    _angle += 9.0f;
    if (_angle > 360) {
        _angle -= 360;
    }
   
    glutPostRedisplay();
    glutTimerFunc(25, update, 0);
}
    
int main(int argc, char** argv) 

glutInitWindowSize(400, 400);
printf("Contoh Sederhana Kotak "); 
glutCreateWindow("Praktikum06");
glutDisplayFunc(mydisplay);
glutTimerFunc(25, update, 0);
glutMainLoop(); 
return 0;
}

0 komentar:

Posting Komentar