Entradas

Mostrando entradas de abril, 2018

TEAPOTS | Diana Vargas

Imagen
#include <windows.h> #include <GL/glut.h> float ang=0.1, rotar=0, rotar1=0, rotar2=0; void iluminacion (int encendido){     if(encendido==1){         const GLfloat pos[4]={10, 10, 10};//poner afuera         glEnable(GL_LIGHTING);         glEnable(GL_LIGHT0);         glLightfv(GL_LIGHT0, GL_POSITION, pos);     }     else{         glDisable(GL_LIGHTING);     } } void aplicarMaterial(int encendido){     if(encendido==1) {         GLfloat mat_red_ambient[] = {0.1745f, 0.01175f, 0.01175f, 0.55f};         GLfloat mat_red_diffuse[] = {0.61424f, 0.04136f, 0.04136f, 0.55f};         GLfloat mat_specular[] = {0.727811f, 0.626959f, 0.626959f, 0.55f};         //GLfloat mat_emission[] = { 0.0,0.2,0.0,0};         //...

CUBEMAP | Diana Vargas

Imagen
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <windows.h> #include <GL/glut.h> //int alto=512,ancho=512;//dim imagen int alto=500,ancho=500; float angulo=0; GLfloat angle = 0; GLfloat angle2 = 0; int moving, startx, starty; // moving=booleana unsigned char * textura; unsigned char * textura1; unsigned char * textura2; unsigned char * textura3; unsigned char * textura4; unsigned char * textura5; //CARA TOP CIELO int leerImagen(){     FILE *imagen;     imagen=fopen("C:\\Users\\hp\\Documents\\7 SEMESTRE\\CARA TOP.raw","r");     textura=(unsigned char*)malloc(ancho*alto*3);     if(imagen==NULL){         printf("Error: No imagen");         return 0;     }     fread(textura,ancho*alto*3,1,imagen);     fclose(imagen);     return 1; } void usarTextura(void) { ...

Teapots | Israel González de la Peña

Imagen
#include <windows.h> #include <GL/glut.h> float ang=0.1, rotar=0, rotar1=0, rotar2=0; void iluminacion (int encendido){     if(encendido==1){         const GLfloat pos[4]={10, 10, 10};//poner afuera         glEnable(GL_LIGHTING);         glEnable(GL_LIGHT0);         glLightfv(GL_LIGHT0, GL_POSITION, pos);     }     else{         glDisable(GL_LIGHTING);     } } void aplicarMaterial(int encendido){     if(encendido==1) {         GLfloat mat_green_ambient[] = { 0.0215,0.1745,0.0215,0.5};         GLfloat mat_green_diffuse[] = { 0.07568,0.61424,0.07568,0.5};         GLfloat mat_specular[] = { 0.8,0.8,0.8,0};         GLfloat mat_emission[] = { 0.0,0.2,0.0,0};         GLfloat mat_shininess[] = {10};//Valor ...

CubeMap | Israel González de la Peña

Imagen
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <windows.h> #include <GL/glut.h> //#include <GLut/gutil.h> //#include <GLut/glut.h> //#include <Opengl/gl.h> //int alto=512,ancho=512;//dim imagen int alto=200,ancho=200; GLfloat angle = 0; GLfloat angle2 = 0; int moving, startx, starty; // moving=booleana unsigned char * textura; unsigned char * textura1; unsigned char * textura2; unsigned char * textura3; unsigned char * textura4; unsigned char * textura5; //CARA ARRIBA CIELO int leerImagen(){     FILE *imagen;     imagen=fopen("C:\\Users\\Imagenes\\CARA-ARRIBA.raw","r");     textura=(unsigned char*)malloc(ancho*alto*3);     if(imagen==NULL){         printf("Error: No imagen");         return 0;     }     fread(textura,ancho*alto*3,1,imagen);     fclose(...

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

Imagen
#include <windows.h> #include <GL/glut.h> GLfloat ang1 = 0,ang2 = 0; int moviendo, startx, starty; float angulo = 0; static GLdouble tamanio = 10.0; GLUquadric *figura; void dibujaObjeto(){     gluQuadricDrawStyle(figura, GLU_FILL);     glClear( GL_COLOR_BUFFER_BIT );     glColor3f(0.0, 0.0, 0.0);     glPushMatrix();     glRotatef(angulo+2, 0, 1, 0);     //Cabeza     glPushMatrix();     glTranslatef(0,2,0);     glRotatef(90,1,0,0);     glScalef(1.5,0.7,1);     glutSolidSphere(0.6,30,30);     glPopMatrix();     //Cuerpo     glPushMatrix();     glTranslatef(0,1,0);     glRotatef(90,1,0,0);     glScalef(1.5,0.7,1);     glutSolidTorus(0.5,0.5,30,30);     glPopMatrix();     //Cuerpo     glPushMatrix();     glTranslatef(0,0,0...

Camera | Diana Vargas

Imagen
#include <windows.h> #include <GL/glut.h> GLfloat ang1 = 0,ang2 = 0; int moviendo, startx, starty; static GLdouble tamanio = 10.0; GLUquadric *figura; void dibujaObjeto(){     gluQuadricDrawStyle(figura, GLU_FILL);     //gluSphere(figura,10,32,32);     //gluCylinder(figura,10,10,20,32,32);     //gluDisk(figura,3,1,32,32);     //gluPartialDisk(figura,5,10,32,32,0,180);     glClear( GL_COLOR_BUFFER_BIT );     glColor3f(1.0, 1.0, 1.0);     glPushMatrix();     //glRotatef(angulo+2, 0, 1, 0);     //HEAD     glPushMatrix();     glTranslatef(0,1.8,0);     glScalef(1.1,0.7,1);     //glutWireSphere(1,20,20);     glutSolidSphere(1,20,20);     glPopMatrix();     //BODY     glPushMatrix();     glTranslatef(0,-1.2,0);     glScalef(2,1.5,1.5);     ...