Membuat Lingkaran

#include
#include
#define PI 3.1415926


void Display()
{
     GLint circle_points=100;
     GLint radius1=25;
     GLint radius2=25;
     GLint i;
     GLdouble theta;
     glClear(GL_COLOR_BUFFER_BIT);
     // glBegin(GL_POLYGON);
     glBegin(GL_LINES);
     for(i=0;i     {
       theta = 2*PI*i/circle_points;
       glVertex2f(80+radius1*cos(theta),60+radius2*sin(theta));
       }
     glEnd();
     glFlush();
     }
void reshape(int w,int h)
{
     glViewport(0,0,(GLsizei)w,(GLsizei)h);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     gluOrtho2D(0,160,0,120);
     }
void init()
{
     glClearColor(0,0,0,1);
     }
int main(int args,char* argv[])
{
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowSize(360,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

[blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget