Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void renderScene(void)
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glRectf(-25.0f,25.0f,25.0f,-25.0f);
- glFlush();
- }
- void changeSize(int w, int h)
- {
- if (h == 0)
- h=1;
- glViewport(0,0,w,h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- float ratio = w/h;
- if (w<=h)
- glOrtho (-100,100,-100/ratio, 100/ratio, 1,-1);
- else
- glOrtho (-100*ratio,100*ratio, -100,100,1,-1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- }
- int main (void)
- {
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
- glutInitWindowPosition(100,100);
- glutInitWindowSize(500,500);
- glutCreateWindow("he");
- glutDisplayFunc(renderScene);
- glutReshapeFunc(changeSize);
- glClearColor(0,0,1,1);
- glutMainLoop();
- return 0;
- }
Add Comment
Please, Sign In to add comment