Esempio n. 1
0
void Display(void){
	
glOrtho(-2.0,2.0,-2.0,2.0,2.0,-2.0); // El cubo que veo
glMatrixMode(GL_PROJECTION) ; // Activa matriz de proyeccion
glLoadIdentity() ; // Se pone a 1
/* PERSPECTIVA CABALLERA */
glPushMatrix();
glViewport(100,100,200,200) ; // lo que ocupa el viewport
caballera(45.0f);
ejes(2);
glColor3f(1.0f, 1.0f, 0.0f);
glutWireCube(1.0);
glPopMatrix();

/*PERSPECTIVA CABINET */

glPushMatrix();
glViewport(100,250,200,200) ; // lo que ocupa el viewport
caballera(63.4f);
ejes(2);
glColor3f(1.0f, 1.0f, 0.0f);
glutWireCube(1.0);
glPopMatrix();


glutSwapBuffers() ;  
}
Esempio n. 2
0
void Display(void){
/* CUBO EN PERSPECTIVA CÓNICA CON 2 PUNTOS DE FUGA*/ 
 glMatrixMode(GL_PROJECTION) ; // Activa matriz de proyeccion 
 glLoadIdentity() ; // Se pone a 1  
 glViewport(125,250,100,100) ; // lo que ocupa el viewport 
 gluPerspective(60.0, 1.0,1.0,20.0) ; 
 glTranslatef(0.0,0.0,-4.0) ;
 ejes(3.0f);
 glColor3f(1.0f, 1.0f, 0.0f);
 glutWireCube(2.0); 
 
/* CUBO EN PERSPECTIVA CÓNICA CON 1 PUNTO DE FUGA*/ 
glMatrixMode(GL_PROJECTION) ; 
glLoadIdentity() ; 
glViewport(100,100,100,100) ; 
gluPerspective(65.0, 1,0.0,30.0) ; 
glTranslatef(0.0,0.0,-4.0) ;
ejes(3.0f);
gluLookAt(0.0,1,0, 1,0,1, 0,1,0);
glColor3f(1.0f, 1.0f, 0.0f);
glutWireCube(2.0); 

/* CUBO EN PERSPECTIVA CÓNICA CON 3 PUNTOS DE FUGA*/

glMatrixMode(GL_PROJECTION) ; 
glLoadIdentity() ; 
glViewport(250,100,100,100) ; 
gluPerspective(60.0, 1.0,1.0,20.0) ;
glTranslatef(0.0,0.0,-4.0) ;
ejes(3.0f);
gluLookAt(0.0,0,0, 1,0,1, 0,1,0);
glColor3f(1.0f, 1.0f, 0.0f);
glutWireCube(2.0); 

glutSwapBuffers() ;  
}
Esempio n. 3
0
File: main.cpp Progetto: Pinkii-/IDI
void refresh(void) {
    glClearColor(r,g,b,a);
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    if (sferaVisible) {
    glPushMatrix();
        glColor3f(0,0,0);
        glTranslated(s.centro.x,s.centro.y,s.centro.z);
        glutWireSphere(s.radio,30,30);
    glPopMatrix(); }
    glPushMatrix();
        glColor3f(0.1,0.9,0.9);
        drawGround(Vector3f(0,0,0), Vector3f(1,0,1), 10);
    glPopMatrix();
    ejes();
    if (wallVisible) {drawWall(Vector3f(0,0,-4.9),Vector3f(10,1.5,0.2));
                      drawWall(Vector3f(1.5,0,2.5),Vector3f(0.2,1.5,4));}
    drawMonigotes();
    glPushMatrix(); //patricio serialKiller
        glTranslated(patricio1.posFinal.x,patricio1.posFinal.y,patricio1.posFinal.z);
        glRotated(direccionPatricio,0,1,0);
        daModelIsReal(patricio1);
    glPopMatrix();
    glPushMatrix(); //patricio 2
        glTranslated(patricio2.posFinal.x,patricio2.posFinal.y,patricio2.posFinal.z);
        daModelIsReal(patricio2);
    glPopMatrix();
    for (uint i = 0; i < balas.size();++i) {
        glPushMatrix();
        glTranslated(balas[i].pos.x,balas[i].pos.y,balas[i].pos.z);
        glRotated(balas[i].dir,0,1,0);
        glTranslated(0.25,0.2,0.32);
        balas[i].draw();
        glPopMatrix();
    }
    glPushMatrix();
        writeOnWindow();
    glPopMatrix();
    glutPostRedisplay();
    glutSwapBuffers();
}
Esempio n. 4
0
void display()
{
	// Funcion que atiende al evento de display (render)

	// Color de borrado (1er paso para pintar)
	glClearColor(1.0,1.0,1.0,1.0); //RGBA, 30% azul
	// Borra la pantalla y buffer de profundidad
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// Inicializa matriz compuesta de la MV
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	// Situo y oriento la camara
	gluLookAt(1,3,5, 0,0,0, 0,1,0);// miramos al origen de coordenadas con la vertical eje y

	ejes(); // ver ejes

	glRotatef(girox, 1, 0, 0);
	glRotatef(giroy, 0, 1, 0);

	if(modo == ALAMBRICO){
		glColor3f(1,1,0);
		glutWireTeapot(0.51);
	}
	else if (modo == SOLIDO){
		glColor3f(1,0,0);
		glutSolidTeapot(0.5);
	}
	else{
		glColor3f(1,0,0);
		glutSolidTeapot(0.5);
		glColor3f(1,1,0);
		glutWireTeapot(0.51);
	}

	// Intercambio los buffers
	glutSwapBuffers();
}