PROGRAMA DE OBJETOS 3D WIRE (ALAMBRE)
           #include<GL/glut.h>
           #include <GL/gl.h>

           voidinicializa(void){
           glClearColor(1.0,1.0,1.0,0.0);
           }
           voiddibuja(void){
           glClear(GL_COLOR_BUFFER_BIT);
           glColor3f(1.0,0.0,0.0); // el color de nuestra figura
           gluLookAt(5.0,5.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
           glPushMatrix();
           glScalef(1.0,1.0,1.0);
           glRotatef(10.0,1.0,0.0,0.0);
           glTranslatef(2.0,0.0,0.0);
           glutWireCube(1.0);
           glPopMatrix();

           glFlush();
           }

           voidReshapeFun(int w, int h){
           glViewport(0,0,w,h);
           glMatrixMode(GL_PROJECTION);
           glFrustum(-4.0,4.0,-4.0,4.0,4.0,40.0);
           glMatrixMode(GL_MODELVIEW);
           glClear(GL_COLOR_BUFFER_BIT);
           }

           int main (intargc, char** argv)
           {
           glutInit(&argc, argv);
           glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
           glutInitWindowPosition(1,1);
           glutInitWindowSize(1000,700);
           glutCreateWindow("Objetos 3D");
           inicializa();
           glutDisplayFunc(dibuja);
           glutReshapeFunc(ReshapeFun);
           glutMainLoop();
           return 0;
           }

          Utilizar las siguientes instrucciones
glutWireCube(tamaño);                                              glutWireCone(radio, alt, reph, repv);
glutWireTeapot(tamaño);                                            glutWireTorus(radio,radcentro,reph, repv);
glutWireDodecahedron();                                            glutWireOctahedron();
glutWireSphere(radio,reph,repv);                                   glutWireTetrahedron();

Programa de objetos 3 d wire

  • 1.
    PROGRAMA DE OBJETOS3D WIRE (ALAMBRE) #include<GL/glut.h> #include <GL/gl.h> voidinicializa(void){ glClearColor(1.0,1.0,1.0,0.0); } voiddibuja(void){ glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,0.0,0.0); // el color de nuestra figura gluLookAt(5.0,5.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0); glPushMatrix(); glScalef(1.0,1.0,1.0); glRotatef(10.0,1.0,0.0,0.0); glTranslatef(2.0,0.0,0.0); glutWireCube(1.0); glPopMatrix(); glFlush(); } voidReshapeFun(int w, int h){ glViewport(0,0,w,h); glMatrixMode(GL_PROJECTION); glFrustum(-4.0,4.0,-4.0,4.0,4.0,40.0); glMatrixMode(GL_MODELVIEW); glClear(GL_COLOR_BUFFER_BIT); } int main (intargc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition(1,1); glutInitWindowSize(1000,700); glutCreateWindow("Objetos 3D"); inicializa(); glutDisplayFunc(dibuja); glutReshapeFunc(ReshapeFun); glutMainLoop(); return 0; } Utilizar las siguientes instrucciones glutWireCube(tamaño); glutWireCone(radio, alt, reph, repv); glutWireTeapot(tamaño); glutWireTorus(radio,radcentro,reph, repv); glutWireDodecahedron(); glutWireOctahedron(); glutWireSphere(radio,reph,repv); glutWireTetrahedron();