Código Yin&Yang Diana Vargas

#include <windows.h>
#include <math.h>
#ifdef _APPLE_
#else
#include <GL/glut.h>
#include <math.h>
#define PI 3.1415926
#endif
float x,y;
float radio=0;
float cx=0;
float cy=0;
float dx, dy;

void medcirculo (float radio, float r, float g, float b){
    glColor3f(r,g,b);
    glBegin(GL_POLYGON);
    for(float i = 0; i<=3.1415926; i+=0.01){
        dx = radio*cos(i)+cx;
        dy = radio*sin(i)+cy;
        glVertex2f(dy,dx);
    }
    glEnd();
}

void circulo (float radio, float r, float g, float b){
    glColor3f(r,g,b);
    glBegin(GL_LINE_STRIP);
    for(float i = 0; i<=2*3.1415926; i+=0.01){
        dx = radio*cos(i)+cx;
        dy = radio*sin(i)+cy;
        glVertex2f(dx,dy);
    }
    glEnd();
}

void circulito (float radio, float r, float g, float b){
    glColor3f(r,g,b);
    glBegin(GL_POLYGON);
    for(float i = 0; i<=2*3.1415926; i+=0.01){
        dx = radio*cos(i)+cx;
        dy = radio*sin(i)+cy;
        glVertex2f(dx,dy);
    }
    glEnd();
}

void display(void){

    glClear(GL_COLOR_BUFFER_BIT);
    circulo(10,0,0,0);
    medcirculo(10,1,1,1);
    medcirculo(-10,0,0,0);
    glTranslatef(0,-5,0);
    medcirculo(5,0,0,0);
    glTranslatef(0,10,0);
    medcirculo(-5,1,1,1);
    glTranslatef(-1,-9,0);
    circulito(1.5,1,1,1);
    glTranslatef(1,9,0);
    circulito(1.5,0,0,0);

    glFlush();
}

int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
    glutInitWindowPosition(200,100);
    glutInitWindowSize(400, 400);
    glutCreateWindow("YIN & YANG | DIANA VARGAS B");

    gluOrtho2D(-12, 12, -12, 12);

    glLineWidth(5);
    //glPointSize(5);
    glClearColor(1.0,1.0,1.0,0);

    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}


Comentarios

Entradas populares de este blog

Código Capitán América Diana Vargas

Reflejo | Diana Vargas

Cámara | Israel González de la Peña