Membuat Garis Dengan Antialisting

#include
#include
void Display()
{
  
     glClear(GL_COLOR_BUFFER_BIT);
     glBegin(GL_LINES);
     glColor3f(0,1,0);
     glVertex2f(10,10);
     glVertex2f(150,110);
     glEnd();
     glFlush();
}

void reshape(int w,int h)

     {
         glViewport(0,0,(GLsizei)w,(GLsizei)h);
         glLoadIdentity();
         gluOrtho2D(0,320,0,240);
     }
    
     void init()
     {
         glEnable (GL_LINE_SMOOTH);
         glEnable (GL_BLEND);
         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
         glHint(GL_LINE_SMOOTH_HINT | GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE);
         glClearColor(0,0,0,0);
         glLineWidth(3);
     }
     int main(int args,char* argv[])
     {
         glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
         glutInitWindowSize(320,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