Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <GL/GL.h>
- #include <GL/GLU.h>
- #include <GL/glut.h>
- #include <iostream>
- using namespace std;
- void reshape(int w, int h)
- {
- glViewport(0, 0, w, h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluOrtho2D(-1, 1, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- }
- float a[2] = {-1.0f, 0.0f};
- float b[2] = {0.5f, 0.0f};
- float c[2] = {0.5f, 1.0f};
- void draw(void)
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(0.0f, 0.0f, 1.0f);
- glBegin(GL_TRIANGLES);
- glVertex2d(a[0],a[1]);
- glVertex2d(b[0],b[1]);
- glVertex2d(c[0],c[1]);
- glEnd();
- glFlush();
- }
- int main(int argc, char *argv[])
- {
- glutInit(&argc, argv);
- glutInitWindowSize(400,300);
- glutInitWindowPosition(100,100);
- glutInitDisplayMode(GLUT_RGB);
- glutCreateWindow("Warsztaty 1");
- glutReshapeFunc(reshape);
- glutDisplayFunc(draw);
- glClearColor(0, 0, 0, 0);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement