Tuesday, 27 August 2013

opngl program to display sample dots

#include<GL/glut.h>
#include<stdlib.h>

void myInit()
{
     glClearColor(0.0,1.0,0.0,0.0);
     glColor3f(1.0,0.0,0.0);
     glPointSize(10.0);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     gluOrtho2D(0.0,1200.0,0.0,700.0);
     }
    
     void myDisplay()
     {
          glClear(GL_COLOR_BUFFER_BIT);
          glBegin(GL_POINTS);
                             glVertex2i(100,100);
                             glVertex2i(150,100);
                            
          glEnd();
          glFlush();
          }
         
         
          void main(int argc ,char **argv)
          {
               glutInit(&argc,argv);
               glutInitDisplayMode(GLUT_SINGLE| GLUT_RGB );
               glutInitWindowSize(1200,700);
               //glutInitWindowPosition(200,200);
               glutCreateWindow("sample");
               glutDisplayFunc(myDisplay);
               myInit();
               glutMainLoop();
               }

No comments:

Post a Comment