Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gl/glut.h>
- void Draw()
- { float s[6][2];
- s[0][0]=-0.3; s[0][1]=-0.2; /* initialize Matrix */
- s[1][0]=0.3; s[1][1]=-0.2;
- s[2][0]=0.3; s[2][1]=0.0;
- s[3][0]=-0.3; s[3][1]=0.0;
- s[4][0]=-0.3; s[4][1]=0.2;
- s[5][0]=0.3; s[5][1]=0.2;
- int nrPoints=6;
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(1.0, 0.0, 0.0);
- glBegin(GL_LINES);
- for(int i=0;i<nrPoints-1;i++){
- glVertex2f(s[i][0],s[i][1]);
- glVertex2f(s[i+1][0],s[i+1][1]);
- }
- glEnd();
- glFlush();
- }
- void Initialize()
- {
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(1.0, 1.0, 0.0, 1.0, -1.0, 1.0);
- }
- int main(int iArgc, char** cppArgv)
- {
- glutInit(&iArgc, cppArgv);
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
- glutInitWindowSize(200, 200);
- glutInitWindowPosition(200, 200);
- glutCreateWindow("UIST Line");
- Initialize();
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement