Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<GL\glut.h>
- void init(void)
- {
- glClearColor(0.0, 0.0, 1.0, 0.0);
- glMatrixMode(GL_PROJECTION);
- gluOrtho2D(-2000.0, 2000.0, -2000.0, 2000.0);
- }
- void buildHouse(void)
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(1.0, 0.4, 0.0);
- //glTranslatef(-0.5f, 0.4f, 0.0f);
- glBegin(GL_POLYGON); //start left tree orange
- glVertex2i(-200, 400);
- glVertex2i(0, 600);
- glVertex2i(200, 400);
- glVertex2i(400, 400);
- glVertex2i(200, 200);
- glVertex2i(200, 0);
- glVertex2i(0, 200);
- glVertex2i(-200, 0);
- glVertex2i(-200, 200);
- glVertex2i(-400, 400);
- glVertex2i(-200, 400);
- glEnd(); //end house
- glTranslatef(-0.9f, 0.1f, 0.0f); //2
- glBegin(GL_POLYGON); //start left tree orange
- glVertex2i(200, 0);
- glVertex2i(500, 0);
- glVertex2i(600, 200);
- glVertex2i(800, 0);
- glVertex2i(1000, 0);
- glVertex2i(800, -200);
- glVertex2i(800, -400);
- glVertex2i(600, -200);
- glVertex2i(400, -400);
- glVertex2i(400, -200);
- glEnd(); //end house
- //glTranslatef(-0.5f, 0.4f, 0.0f);
- glBegin(GL_POLYGON); //start left tree orange
- glVertex2i(-200, -400);
- //glVertex2i(0, 600);
- glVertex2i(0, -200);
- glVertex2i(200, -400);
- glVertex2i(400, -400);
- glVertex2i(200, -600);
- glVertex2i(200, -800);
- glVertex2i(0, -600);
- glVertex2i(-200, -800);
- glVertex2i(-200, -600);
- glVertex2i(-400, -400);
- glEnd(); //end house
- glTranslatef(-0.9f, 0.1f, 0.0f); //2
- glBegin(GL_POLYGON); //start left tree orange
- glVertex2i(-200, 0);
- glVertex2i(-400, 0);
- glVertex2i(-600, 200);
- glEnd(); //end house
- glFlush();
- }
- int main(int argc, char** argv)
- {
- glutInit(&argc, argv);
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
- glutInitWindowPosition(50, 50);
- glutInitWindowSize(1900, 1900);
- glutCreateWindow("House Section OpenGL");
- init();
- glutDisplayFunc(buildHouse);
- glutMainLoop();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement