void display(void)
{
typedef GLfloat point2[2];
point2 vertice[8] = {
{50.0,50.0},
{150.0,50.0},
{150.0,150.0},
{50.0,150.0},
{200.0,100.0},
{200.0,200.0},
{100.0,200.0},
{100.0,100.0}};
glColor3f(1.0,0.0,0.0);
gluOrtho2D(0.0, 500.0, 0.0, 500.0);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glVertex2fv(vertice[0]);
glVertex2fv(vertice[1]);
glVertex2fv(vertice[1]);
glVertex2fv(vertice[2]);
glVertex2fv(vertice[2]);
glVertex2fv(vertice[3]);
glVertex2fv(vertice[3]);
glVertex2fv(vertice[0]);
glVertex2fv(vertice[1]);
glVertex2fv(vertice[4]);
glVertex2fv(vertice[2]);
glVertex2fv(vertice[5]);
glVertex2fv(vertice[5]);
glVertex2fv(vertice[4]);
glVertex2fv(vertice[5]);
glVertex2fv(vertice[6]);
glVertex2fv(vertice[6]);
glVertex2fv(vertice[3]);
glVertex2fv(vertice[0]);
glVertex2fv(vertice[7]);
glVertex2fv(vertice[4]);
glVertex2fv(vertice[7]);
glVertex2fv(vertice[6]);
glVertex2fv(vertice[7]);
glEnd();
glFlush();
}
void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowSize(500, 500);
glutCreateWindow("Cubo en 2D");
glutDisplayFunc(display);
glutMainLoop();
}
{
typedef GLfloat point2[2];
point2 vertice[8] = {
{50.0,50.0},
{150.0,50.0},
{150.0,150.0},
{50.0,150.0},
{200.0,100.0},
{200.0,200.0},
{100.0,200.0},
{100.0,100.0}};
glColor3f(1.0,0.0,0.0);
gluOrtho2D(0.0, 500.0, 0.0, 500.0);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_LINES);
glVertex2fv(vertice[0]);
glVertex2fv(vertice[1]);
glVertex2fv(vertice[1]);
glVertex2fv(vertice[2]);
glVertex2fv(vertice[2]);
glVertex2fv(vertice[3]);
glVertex2fv(vertice[3]);
glVertex2fv(vertice[0]);
glVertex2fv(vertice[1]);
glVertex2fv(vertice[4]);
glVertex2fv(vertice[2]);
glVertex2fv(vertice[5]);
glVertex2fv(vertice[5]);
glVertex2fv(vertice[4]);
glVertex2fv(vertice[5]);
glVertex2fv(vertice[6]);
glVertex2fv(vertice[6]);
glVertex2fv(vertice[3]);
glVertex2fv(vertice[0]);
glVertex2fv(vertice[7]);
glVertex2fv(vertice[4]);
glVertex2fv(vertice[7]);
glVertex2fv(vertice[6]);
glVertex2fv(vertice[7]);
glEnd();
glFlush();
}
void main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowSize(500, 500);
glutCreateWindow("Cubo en 2D");
glutDisplayFunc(display);
glutMainLoop();
}
No hay comentarios:
Publicar un comentario