1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <iostream>
using namespace std;
#define HEIGHT 500
#define WIDTH 500
void triangle()
{
glBegin(GL_TRIANGLES);
glVertex2f(400, -300);
glVertex2f(0, 400);
glVertex2f(-400, -300);
glEnd();
}
void drawshit()
{
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glTranslatef(0, 50, 0);
glColor3f(2, 5, 5);
triangle();
glPopMatrix();
glPushMatrix();
glTranslatef(0, -50, 0);
glColor3f(0, 0, 0);
glRotatef(180.0, 0, 0, 0);
triangle();
glPopMatrix();
glFlush();
}
int main(int argc, char* argv[ ])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(WIDTH, HEIGHT);
glutCreateWindow("The Star of David");
glutDisplayFunc(drawshit);
gluOrtho2D(-WIDTH, WIDTH, -HEIGHT, HEIGHT);
glClearColor(1, 1, 1, 0);
glutMainLoop();
return 0;
}
|