=====codigo===========
#include <windows.h>
#ifdef __APPLE__
#else
#include <GL/glut.h>
#endif
#include <stdlib.h>
static void display(void)
{
glClearColor(0,0,0,0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glShadeModel (GL_SMOOTH);
//I1
glBegin(GL_QUADS);
glColor3f(1.0,0.0,0.0);
glVertex2f(-0.8,-0.8);
glColor3f(0.0,1.0,0.0);
glVertex2f(-0.8,0.8);
glColor3f(0.0,0.0,1.0);
glVertex2f(-0.4,0.8);
glColor3f(1.0,0.0,0.0);
glVertex2f(-0.4,-0.8);
glEnd();
//I2
glBegin(GL_QUADS);
glColor3f(1.0,0.2,0.0);
glVertex2f(-0.2,-0.8);
glColor3f(0.0,1.0,0.0);
glVertex2f(-0.2,0.8);
glColor3f(0.0,0.0,1.0);
glVertex2f(0.2,0.8);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.2,-0.8);
glEnd();
//S
//barra horizontal arriba
glBegin(GL_QUADS);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.4,0.8);
glColor3f(0.0,1.0,0.0);
glVertex2f(0.8,0.8);
glColor3f(0.0,0.0,1.0);
glVertex2f(0.8,0.6);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.4,0.6);
glEnd();
glBegin(GL_QUADS);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.4,0.6);
glColor3f(0.0,1.0,0.0);
glVertex2f(0.6,0.6);
glColor3f(0.0,0.0,1.0);
glVertex2f(0.6,0.0);
glColor3f(1.0,0.0,1.0);
glVertex2f(0.4,0.0);
glEnd();
glBegin(GL_QUADS);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.6,0.0);
glColor3f(0.0,1.0,0.0);
glVertex2f(0.8,0.0);
glColor3f(0.0,0.0,1.0);
glVertex2f(0.8,-0.6);
glColor3f(1.0,0.0,1.0);
glVertex2f(0.6,-0.6);
glEnd();
//barra horizontal debajo
glBegin(GL_QUADS);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.4,-0.8);
glColor3f(0.0,1.0,0.0);
glVertex2f(0.4,-0.6);
glColor3f(0.0,0.0,1.0);
glVertex2f(0.8,-0.6);
glColor3f(1.0,0.0,1.0);
glVertex2f(0.8,-0.8);
glEnd();
//barra del centro
glBegin(GL_QUADS);
glColor3f(1.0,0.0,0.0);
glVertex2f(0.4,0.1);
glColor3f(0.0,1.0,0.0);
glVertex2f(0.4,-0.1);
glColor3f(0.0,0.0,1.0);
glVertex2f(0.8,-0.1);
glColor3f(1.0,0.0,1.0);
glVertex2f(0.8,0.1);
glEnd();
glutSwapBuffers();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(640,480);
glutInitWindowPosition(10,10);
glutCreateWindow("Cubo");
//glutReshapeFunc(resize);
glutDisplayFunc(display);
glutMainLoop();
return EXIT_SUCCESS;
}
0 comentarios:
Publicar un comentario