Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/gl.h>
- #include <GL/glut.h>
- #include <stdlib.h>
- #include <stdio.h>
- void display(void)
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glBegin(GL_LINES);
- glColor3f(0.0, 1.0, 1.0);
- glVertex2f(10, 10);
- glVertex2f(40, 20);
- glEnd();
- glutSwapBuffers();
- }
- void init(void)
- {
- glClearColor(0.0, 0.0, 0.0, 0.0); /* select clearing (background) color */
- glMatrixMode(GL_PROJECTION); /* initialize viewing values */
- glLoadIdentity();
- glOrtho(0.0, 200.0, 0.0, 200.0, -200.0, 200.0);
- }
- int main(int argc, char **argv)
- {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize(300, 300);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("hello");
- init();
- glutDisplayFunc(display);
- glutMainLoop();
- return 0; /* ISO C requires main to return int. */
- }
Advertisement
Add Comment
Please, Sign In to add comment