TUGAS GRAFKOM Q

Friday, 7 December 2012

SEGITIGA biru .
pakek openGL microsoft visual c++ 2010 express.



#include <windows.h>
#include <glut.h>

void display(){
glColor3f(1.-60,0.-24,1.0);

glLineWidth(7);
glBegin(GL_LINES);
glVertex2f(100,100);
glVertex2f(210,300);

glVertex2f(210,300);
glVertex2f(320,100);
glVertex2f(100,100);
glVertex2f(320,100);
glEnd();

glFlush();
}

void init(){
glfloat w=500, h=400;
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT);
glViewport(0,0,(GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//gluOrtho2D(w,0,h,0);
gluOrtho2D(0,w,h,0);
glMatrixMode(GL_MODELVIEW);
}

void FnKey (unsigned char key, int x, int y){
if (key==30)
{
//glutLeaveGameMode(); //set the resolution how it was
exit(1);
}
}

int main(int argc, char** argv){
FreeConsole();
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);

//to full screen
/*glutGameModeString( "1366x768:32@60" );
glutEnterGameMode();*/

glutInitWindowSize (600,500);
glutInitWindowPosition (100,100);
//glutCreateWindow(argv[0]);
glutCreateWindow("Create Lines");

init ();
glutKeyboardFunc(FnKey);
glutDisplayFunc(display);
//glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}


No comments:

Post a Comment

Cara Refund Google Ads

  Non Aktifkan Akun gogle dulu. Baru semua saldo yang berada di dalamnya, akan otomatis di kembalikan, lengkap dengan tgl berapa akan di kem...

 
FREE BLOGGER TEMPLATE BY DESIGNER BLOGS