¡Descarga Examen t1 programación dev lenguaje c++ y más Exámenes en PDF de Computación Gráfica solo en Docsity! #include <Gl/glut.h> void examen(){ glClearColor(0.0f,0.0f,0.0f,1.0f); glClear(GL_COLOR_BUFFER_BIT); glLoadIdentity(); //nuve1combinada glOrtho(320,0,320,0,-1,1); glRotatef(50,0,0,1);//50=grados glScalef(0.5f,0.5f,1.0f);//50 porciento glTranslatef(300,-316,0); glBegin(GL_POLYGON); glColor3f(0.3f,0.3f,0.3f); glVertex2d(300,20); glVertex2d(320,20); glVertex2d(320,0); glVertex2d(300,0); glVertex2d(300,40); glVertex2d(280,40); glVertex2d(280,20); glEnd(); glLoadIdentity(); //nuve2 glOrtho(320,0,320,0,-1,1); glRotatef(50,0,0,1);//50=grados glScalef(0.5f,0.5f,1.0f);//50 porciento glTranslatef(300,-316,0); glBegin(GL_POLYGON); glColor3f(0.3f,0.3f,0.3f); glVertex2d(260,0); glVertex2d(240,0); glVertex2d(240,20); glVertex2d(260,20); glEnd(); glLoadIdentity(); //nuve3 glOrtho(320,0,320,0,-1,1); glRotatef(50,0,0,1);//50=grados glScalef(0.5f,0.5f,1.0f);//50 porciento glTranslatef(300,-316,0); glBegin(GL_POLYGON); glColor3f(0.3f,0.3f,0.3f); glVertex2d(260,40); glVertex2d(240,40); glVertex2d(240,60); glVertex2d(260,60); glEnd(); glLoadIdentity(); //nuve4 glOrtho(320,0,320,0,-1,1); //Rombo glOrtho(320,0,320,0,-1,1); glRotatef(50,0,0,1);//50=grados glScalef(0.5f,0.5f,1.0f);//50 porciento glTranslatef(300,-316,0); glBegin(GL_POLYGON); glColor3f(0.7f,0.7f,0.7f); glVertex2d(100,260); glVertex2d(80,280); glVertex2d(100,300); glVertex2d(120,280); glEnd(); glLoadIdentity(); //ventana glOrtho(320,0,320,0,-1,1); glRotatef(50,0,0,1);//50=grados glScalef(0.5f,0.5f,1.0f);//50 porciento glTranslatef(300,-316,0); glBegin(GL_POLYGON); glColor3f(0.8f,0.8f,0.8f); glVertex2d(260,120); glVertex2d(220,120); glVertex2d(220,180); glVertex2d(260,180); glEnd(); glLoadIdentity(); //tren glOrtho(320,0,320,0,-1,1); glRotatef(50,0,0,1);//50=grados glScalef(0.5f,0.5f,1.0f);//50 porciento glTranslatef(300,-316,0); glBegin(GL_LINE_LOOP); glColor3f(0.8f,0.8f,0.8f); glVertex2d(0,300); glVertex2d(40,240); glVertex2d(60,240); glVertex2d(60,220); glVertex2d(40,220); glVertex2d(40,180); glVertex2d(60,180); glVertex2d(60,160); glVertex2d(80,160); glVertex2d(80,120); glVertex2d(60,120); glVertex2d(60,80); glVertex2d(80,60); glVertex2d(120,60); glVertex2d(140,80); glVertex2d(140,120); glVertex2d(120,120); glVertex2d(120,160); glVertex2d(140,160); glVertex2d(140,140); glVertex2d(180,140); glVertex2d(180,160); glVertex2d(200,160); glVertex2d(200,80); glVertex2d(320,80); glVertex2d(320,120); glVertex2d(280,120); glVertex2d(280,180); glVertex2d(300,180); glVertex2d(300,200); glVertex2d(320,200); glVertex2d(320,240); glVertex2d(280,240); glVertex2d(260,220); glVertex2d(240,220); glVertex2d(220,240); glVertex2d(200,240); glVertex2d(180,220); glVertex2d(160,220); glVertex2d(120,260); glVertex2d(60,260); glVertex2d(60,300); glEnd(); glLoadIdentity(); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitWindowSize(320,320); glutInitWindowPosition(100,100); glutCreateWindow("Examen_tren"); glutDisplayFunc(examen); glutMainLoop(); return 0; }