Script latihan kom grafik:
Latihan 1
membuat point titik
# include <GL/GLUT.H>
Void Userdraw()
{
static int tick=0;
void drawline(intxl, int yl, int x2, int y2);
glBegin(GL_POINTS);
glVertex2i(100,50);
glVertex2i(100,130);
glVertex2i(150,130);
glEnd();
}
void display (void)
{
//clear screen
glClear (GL_COLOR_BUFFER_BIT) ;
userdraw() ;
glutSwapBuffers () ;
}
int main(int argc, char**argv)
{
glutInit(&argc,argv);//Inisialisasi Tolkit
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB0;
glutInitWindowPosition(100,100);
glutInitWindowSize(640,480);
glutCreateWindow("Gambar Garis");
glClearColor(1.0,1.0,1.0,0.0);
gluOrtho2D(0.,640.,-240.,240.);
glutdleFunc(display);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
latihan 2
Tidak ada komentar:
Posting Komentar