====Codigo==========
#include <windows.h>
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include <stdlib.h>
static void display(void)
{
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glShadeModel(GL_FLAT);
glLineStipple(1, 0x00FF);
glEnable(GL_LINE_STIPPLE);
glBegin(GL_LINES);
{
//EJE X ROJO
glColor3f(1.0,0.0,0.0);
glVertex3f(-0.7,0.3,0.0);
glVertex3f(0.7,-0.3,0.0);
//EJE Y VERDE
glColor3f(0.0,1.0,0.0);
glVertex3f(0.0,-0.7,0.0);
glVertex3f(0.0,0.7,0.0);
//EJE Z AZUL
glColor3f(0.0,0.0,1.0);
glVertex3f(-0.7,-0.4,0.0);
glVertex3f(0.7,0.4,0.0);
}
glEnd();
//CUBO SOLIDO
glPushMatrix();
glColor3f(1.0,1.0,0.0);
glRotatef(120.0,9.0,-12.0,0.0);
glutSolidCube(0.3);
glPopMatrix();
//ESFERA VERDE SOLIDO
glPushMatrix();
glColor3f(0.0,1.0,0.0);
glTranslatef(0.0,-0.33,0.0);
glutSolidSphere(0.08,16,16);
glPopMatrix();
//ESFERA ROJO SOLIDO
glPushMatrix();
glColor3f(1.0,0.0,0.0);
glTranslatef(-0.29,0.13,0.0);
glutSolidSphere(0.08,16,16);
glPopMatrix();
//ESFERA AZUL SOLIDO
glPushMatrix();
glColor3f(0.0,0.0,1.0);
glTranslatef(0.28,0.15,0.0);
glutSolidSphere(0.08,16,16);
glPopMatrix();
//TORO VERDE
glPushMatrix();
glColor3f(0.0,1.0,0.0);
glTranslatef(0.009,0.6,0.0);
glRotatef(-60,-0.0001,0.003,0.0);
glutSolidTorus(0.05,0.18,16,16);
glPushMatrix();
//TORO ROJO
glPushMatrix();
glColor3f(1.0,0.0,0.0);
glTranslatef(1.03,-0.81,0.0);
glRotatef(60,0.015,0.009,0.0);
glutSolidTorus(0.05,0.18,16,16);
glPushMatrix();
//TORO AZUL
glPushMatrix();
glColor3f(0.0,0.0,1.0);
glTranslatef(-1.05,0.3,0.0);
glRotatef(-50,-0.00005,0.4,0.0);
glutSolidTorus(0.06,0.14,12,12);
glPushMatrix();
glutSwapBuffers();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(512,512);
glutInitWindowPosition(20,20);
glutCreateWindow("Plano Cartesiano");
glutDisplayFunc(display);
glutMainLoop();
return EXIT_SUCCESS;
}
0 comentarios:
Publicar un comentario