#include
void Display()
{
// Membuat plot titik - titik dengan persamaan y=x^2+10
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POINTS);
glColor3f(0,1,0);
glVertex2f(1,1);
glVertex2f(3,3);
glVertex2f(5,6);
glVertex2f(7,9);
glVertex2f(9,12);
glVertex2f(10,15);
glVertex2f(11,20);
glVertex2f(12,30);
glVertex2f(13,40);
glVertex2f(14,50);
glVertex2f(15,60);
glVertex2f(16,70);
glVertex2f(17,80);
glVertex2f(18,90);
glVertex2f(19,100);
glVertex2f(20,110);
glVertex2f(21,120);
glEnd();
glFlush();
}
void reshape(int x,int y)
{
glViewport(0,0,(GLsizei)x,(GLsizei)y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0,160,0,120);
}
void init()
{
glClearColor(0,0,0,0);
glPointSize(5);
}
int main(int args,char* argv[])
{
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowSize(240,240);
glutCreateWindow("Habibul Hakim [12111042]");
init();
glutDisplayFunc(Display);
glutReshapeFunc(reshape);
glutMainLoop();
}
Post a Comment
1. Jangan lupa tinggalkan Likenya ya
2. Berkomentarlah dengan baik dan sopan