Berikut Screenshot dari progam baling-baling
Selamat mencobaaaaaaa...!! Baca Selengkapnya...
Jumat, Desember 09, 2011 | 0 Comments
#include "stdlib.h" #include "gl/glut.h" int x=1; int a=4; void Triangles(){ glBegin(GL_TRIANGLES); glColor3f(0.5,0.5,0.5); glVertex2f (0.,0.); glVertex2f(10.,30.); glVertex2f(-10.,30.); glColor3f(0,0,0); glVertex2f (0.,0.); glVertex2f(-10.,-30.); glVertex2f(10.,-30.); glEnd(); } void renderScene(void){ glClear(GL_COLOR_BUFFER_BIT); glClearColor(1,1,1,1); glRotatef(a,0,0,1);//sudut Triangles(); glFlush(); } void myKeyboard(unsigned char key,int x1,int y){ if(key == 'k'){ x=1; glRotatef(-4,0,0,1); } else if(key =='l') { x=2; glRotatef(4,0,0,1); } } void timer(int value){ if (x==1) { a=4; } else if(x==2) { a=-4; } glutPostRedisplay(); glutTimerFunc(50,timer,0); } void main(int argc,char **argv){ glutInit(&argc,argv); glutInitWindowPosition(100,100); glutInitWindowSize(400,400); glutCreateWindow("Baling-baling"); gluOrtho2D(-50.,50.,-50.,50.); glutDisplayFunc(renderScene); glutTimerFunc(1,timer,0); glutKeyboardFunc(myKeyboard); glutMainLoop(); }
Mengalahkan orang lain itu hebat, tapi lebih hebat orang yang mengalahkan dirinya sendiri.
Copyright © 2008 Liphoe . All Rights Reserved.
Design by Padd IT Solutions - Blogger Notes Template by Blogger Templates
Tidak ada komentar:
Posting Komentar