Documentos de Académico
Documentos de Profesional
Documentos de Cultura
PASO 1:
Código:
//PASO 1:
//ORIGINAL LIBRERIA
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
//ACTUAL LIBRERIA
#include <math.h>
for(angulo=0;angulo<=360; angulo++)
{
glVertex2f(x + sin(angulo) * radio, y + cos(angulo) * radio);
}
glEnd();
}
glVertex2f(x, y);
void dibuja(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);//esto
glColor3f(1.0, 0.0, 0.0);
circulo(500 + sin(ang) * 0, 500 + cos(ang) * 0, 50); //funcion circulo
glColor3f(1.0, 1.0, 1.0);
circuloc(500, 500, 1, 100);
circuloc(500, 500, 1, 150);
circuloc(500, 500, 1, 200);
circuloc(500, 500, 1, 250);
circuloc(500, 500, 1, 300);
circuloc(500, 500, 1, 350);
circuloc(500, 500, 1, 400);
circuloc(500, 500, 1, 450);
Resultado:
PASO 2:
Código:
//PASO 2:
//ORIGINAL LIBRERIA
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
//ACTUAL LIBRERIA
#include <math.h>
glVertex2f(x, y);
void dibuja(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);//esto
glColor3f(1.0, 0.0, 0.0);
circulo(500 + sin(ang) * 0, 500 + cos(ang) * 0, 50); //funcion circulo
glColor3f(1.0, 1.0, 1.0);
circuloc(500, 500, 1, 100);
circuloc(500, 500, 1, 150);
circuloc(500, 500, 1, 200);
circuloc(500, 500, 1, 250);
circuloc(500, 500, 1, 300);
circuloc(500, 500, 1, 350);
circuloc(500, 500, 1, 400);
circuloc(500, 500, 1, 450);
Resultado:
PASO 3:
Código:
//PASO 3:
//ORIGINAL LIBRERIA
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
//ACTUAL LIBRERIA
#include <math.h>
glBegin(GL_POINTS);
glVertex2f(x, y);
glColor3f(0.0f, 1.0f, 0.0f); //CAMBIANDO A COLOR VERDE
for (double angulo = 0.0; angulo <= 360; angulo +=0.01)//LOS PUNTOS QUE SEA
FINA Y TAMBIEN LA VELOCIDAD BAJA
{
glVertex2f(x + sin(angulo) * radio, y + cos(angulo) * radio);
}
glEnd();
}
void dibuja(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);//esto
glColor3f(1.0, 0.0, 0.0);
circulo(500 + sin(ang) * 0, 500 + cos(ang) * 0, 50); //funcion circulo
glColor3f(1.0, 1.0, 1.0);
circuloc(500, 500, 1, 100);
circuloc(500, 500, 1, 150);
circuloc(500, 500, 1, 200);
circuloc(500, 500, 1, 250);
circuloc(500, 500, 1, 300);
circuloc(500, 500, 1, 350);
circuloc(500, 500, 1, 400);
circuloc(500, 500, 1, 450);
Resultado:
PASO 4:
Código:
//PASO 4:
//ORIGINAL LIBRERIA
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
//ACTUAL LIBRERIA
#include <math.h>
glBegin(GL_POINTS);
glVertex2f(x, y);
//glColor3f(0.0f, 1.0f, 0.0f); //CAMBIANDO A COLOR VERDE
for (double angulo = 0.0; angulo <= 360; angulo += 0.01)//LOS PUNTOS QUE SEA
FINA Y TAMBIEN LA VELOCIDAD BAJA
{
glVertex2f(x + sin(angulo) * radio, y + cos(angulo) * radio);
}
glEnd();
}
void dibuja(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);//esto
Resultado:
PASO 5:
Código:
//PASO 5:
//ORIGINAL LIBRERIA
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
//ACTUAL LIBRERIA
#include<math.h>
#define PI 3.14
GLfloat sx = 0.2;
GLfloat sy = 0.2;
GLfloat sz = 0.2;
void iluminacionInicial()
{
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT7);
void inicializa()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glPointSize(1.0);
glLineWidth(2.0);
}
void fondo()
{
glBegin(GL_QUADS);
glColor3f(0.0, 0.00, 0.00);
glVertex3f(-01.00, 01.00, 1);
glColor3f(.20, 0.0, 0.70);
glVertex3f(01.00, 1.00, 1);
glColor3f(0, 0.0, 0.0);
glVertex3f(1.00, -1.00, 1);
glColor3f(.70, .10, .20);
glVertex3f(-1.00, -1.00, 1);
glEnd();
}
void orbita()
{
glColor3f(0.5, 0.5, 0.5);
int i = 0;
for (i = 0; i < 8; i++)
{
glPushMatrix();
if (i == 5) { glRotatef(45, 1.0, 0.0, 0.0); }
else
{
glRotatef(63, 1.0, 0.0, 0.0);
}
void dibuja(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
fondo();
orbita();
glLoadIdentity();
glPushMatrix();
glEnable(GL_DEPTH_TEST);
glEnable(GL_COLOR_MATERIAL);
glPushMatrix();
glColor3f(0.7, 0.5, 0.0);
glScalef(sx, sy, sz);
glLightfv(GL_LIGHT7, GL_POSITION, qPosicion);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Amarillo);
glutSolidSphere(1, 50, 50);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Negro);
glPopMatrix();
glScalef(0.2, 0.2, 0.2);
glPushMatrix();
glRotatef(anguloMercurio, 0.0, 1.0, -0.5);
glTranslatef(1.5, 0.0, 0.0);
glColor3f(1.0, 0.9, 0.0);
glScalef(0.08, 0.08, 0.08);
glutSolidSphere(1, 50, 50);
glPopMatrix();
glPushMatrix();
glRotatef(anguloVenus, 0.0, 1.0, -0.5);
glTranslatef(2.0, 0.0, 0.0);
glColor3f(0.9, 0.1, 0.0);
glScalef(0.1, 0.1, 0.1);
glutSolidSphere(1, 50, 50);
glPopMatrix();
glPushMatrix();
glRotatef(anguloTierra, 0.0, 1.0, -0.5);
glTranslatef(2.5, 0.0, 0.0);
glColor3f(0.0, 0.1, 0.7);
glScalef(0.23, 0.23, 0.23);
glutSolidSphere(1, 50, 50);
glPushMatrix();
glRotatef(anguloLuna, 0.0, 0.1, 0.05);
glTranslatef(1.3, 0.0, 0.0);
glColor3f(1.0, 1.0, 1.0);
glScalef(0.5, 0.5, 0.5);
glutSolidSphere(0.5, 50, 50);
glPopMatrix();//HECHO QUEQUEÑA LUNA
glPopMatrix();//HECHO TIERRA
glPushMatrix();
glRotatef(anguloMarte, 0.0, 1.0, -0.5);
glTranslatef(-3.0, 0.0, 0.0);
glColor3f(0.05, 0.05, 0.01);
glScalef(0.17, 0.17, 0.17);
glutSolidSphere(1, 50, 50);
glPopMatrix();
glPushMatrix();
glColor3f(3.30, 3.30, 3.30);
glRotatef(63, 1.0, 0.0, 0.0);
int j = 0, i = 0, div = 90; float siz = 2;
float scl[4] = { 3.3,3.4,3.35,3.2 };
glPopMatrix();//HECHO ASTEROIDE
glPushMatrix();
glRotatef(anguloJupiter, 0.0, 1.0, -0.5);
glTranslatef(-4.0, 0.0, 0.0);
glColor3f(0.4, 0.2, 0.0);
glScalef(0.5, 0.5, 0.5);
glutSolidSphere(1, 50, 50);
glPushMatrix();
glRotatef(anguloLuna, 1.0, -0.5, 0.0);
glTranslatef(0.0, 0, 1.1);
glColor3f(1.0, 1.0, 1.0);
glScalef(0.1, 0.1, 0.1);
glutSolidSphere(0.5, 50, 50);
glPopMatrix();//HECHO LUNA PEQUEÑA
glPopMatrix();
glPushMatrix();
glRotatef(anguloSaturno, 0.0, 1.0, -1.0);
glTranslatef(-5.0, 0.0, 0.0);
glColor3f(0.9, 0.0, 0.0);
glScalef(0.4, 0.4, 0.4);
glutSolidSphere(1, 50, 50);
glPushMatrix();
glRotatef(45, 1.0, 0.0, 0.0);
glPointSize(3);
glColor3f(5.0, 3.0, 1.0);
glScalef(1.2, 1.2, 1.2);
glBegin(GL_POINTS);
double ang1 = 0.0;
i = 0;
for (i = 0; i < 50; i++)
{
glVertex2d(cos(ang1), sin(ang1));
ang1 += angular;
}
glEnd();
glPointSize(2);
glPopMatrix();//ANILLO HECHO
glPopMatrix();
glPushMatrix();
glRotatef(anguloUrano, 0.0, 1.0, -0.5);
glTranslatef(5.2, 0.0, 0.0);
glColor3f(0.0, 0.5, 0.9);
glScalef(0.23, 0.23, 0.23);
glutSolidSphere(1, 50, 50);
glPopMatrix();
glPushMatrix();
glRotatef(anguloNeptuno, 0.0, 1.0, -0.5);
glTranslatef(-5.7, 0.0, 0.0);
glColor3f(0.0, 0.0, 0.9);
glScalef(0.2, 0.2, 0.2);
glutSolidSphere(1, 50, 50);
glPopMatrix();
glPopMatrix();
glFlush();
}
anguloLuna += 2;
if (anguloLuna > 360)
{
anguloLuna -= 360;
}
anguloTierra += 0.7;
if (anguloTierra > 360)
{
anguloTierra -= 360;
}
anguloMercurio += 2;
if (anguloMercurio > 360)
{
anguloMercurio -= 360;
}
anguloVenus += 0.9;
if (anguloVenus > 360)
{
anguloVenus -= 360;
}
anguloMarte += 0.5;
if (anguloMarte > 360)
{
anguloMarte -= 360;
}
anguloJupiter += 0.2;
if (anguloJupiter > 360)
{
anguloJupiter -= 360;
}
anguloSaturno += 0.1;
if (anguloSaturno > 360)
{
anguloSaturno -= 360;
}
anguloUrano += 0.05;
if (anguloUrano > 360)
{
anguloUrano -= 360;
}
anguloNeptuno += 0.02;
if (anguloNeptuno > 360)
{
anguloNeptuno -= 360;
}
glutPostRedisplay();
glutTimerFunc(20, actualizar, 0);
}
Resultado: