Salon.c



// TEXTURAS EN EL SALON


#include <GL/glut.h>
#include <unistd.h>


float DIM = 18, Vc=18;

void Piso()
{
	int y=0, x=0;
	
	//glColor3f(1, 1, 0);
	for(y=Vc; y>-Vc; y--)
		for(x=-Vc; x<Vc; x++)
		{
			glBegin(GL_QUADS);
				glVertex3f(x,   y,   0);
				glVertex3f(x,   y-2, 0);
				glVertex3f(x+2, y-2, 0);
				glVertex3f(x+2, y,   0);
			glEnd();
		}
}

void display(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	Piso(); 
	glutSwapBuffers();
}

void Inicio(void)
{
	glClearColor(0.0,0.0,0.0,0.0);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(-DIM-5, DIM+5, -DIM-5, DIM+5, -DIM-5, DIM+5);
	glMatrixMode(GL_MODELVIEW);
	gluLookAt(-1,-1,1,  2,2,-1,  0,0,1);
	glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glClearDepth(1.0);
}

int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
	glutInitWindowSize (800, 600);
	glutInitWindowPosition (100, 100);
	glutCreateWindow ("Control de las luces ... ");
	Inicio();
	glutDisplayFunc(display);
	glutMainLoop();
	return 0;
}