Código Fuente
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/gl.h>
#include <GL/glut.h>
#endif
#include <stdlib.h>
static void display(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glClear(GL_COLOR_BUFFER_BIT);
glPointSize(10);
glLineWidth(5);
glColor3f(1.0,0.0,0.0);
glBegin(GL_TRIANGLES);
for(double i=1;i>0.1;i-=0.1)
{
glColor3f(-i,i,-i);
glVertex2f(-i,-i);
glVertex2f(i,-i);
glVertex2f(0,i);
}
glEnd();
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(200,200);
glutInitWindowPosition(0,0);
glutCreateWindow("Triangulos");
glutDisplayFunc(display);
glutMainLoop();
}
Resultado
No hay comentarios:
Publicar un comentario