#include "demo.h"

/// DECLARA AQUI LAS VARIABLES GLOBALES
/// SIN EL 'extern'
GLuint texture[MAX_TEXTURES];
P_TEXTURE_IMAGE tex_data[MAX_TEXTURES];

int smile1active = FALSE;
int smile2active = FALSE;
int smile3active = FALSE;
int smile4active = FALSE;
int smile5active = FALSE;
int smile6active = FALSE;
int smile7active = FALSE;
int smile8active = FALSE;
int smile9active = FALSE;
int smile10active = FALSE;
int smile11active = FALSE;
int smile12active = FALSE;

int flashblanco = FALSE;
int flashsmile = FALSE;

int s1rotateLeft = FALSE;
int flascolor=FALSE;
int titulo=FALSE;
int todos=FALSE;

	
	GLfloat	xrot;				// Angle For The Quad ( NEW )
	GLfloat yrot;
	GLfloat zrot;

int i = 1;

void InitGL(GLvoid)
{    
	int i;
	/// Reservamos memoria para las texturas
	for(i=0;i<MAX_TEXTURES;i++)
		tex_data[i] = AllocateTextureBuffer(256, 256);

	/// Activamos el uso de texturas en OGL
	glEnable(GL_TEXTURE_2D);									// Enable Texture Mapping

	/// Inicializamos OGL
	/// ESTO LO PODEIS CAMBIAR A COMO DESEEIS
	glShadeModel(GL_SMOOTH);									// Enables Smooth Color Shading
	glClearColor(1.0f, 1.0f, 1.0f, 0.0f);						// This Will Clear The Background Color To Black
	glClearDepth(1.0);											// Enables Clearing Of The Depth Buffer
	glEnable(GL_DEPTH_TEST);									// Enables Depth Testing
	glDepthFunc(GL_LESS);										// The Type Of Depth Test To Do
	/// Generamos las texturas en OGL
	glGenTextures(MAX_TEXTURES, texture);
	/// Cargamos las texturas
	InitTextures();

	/// INICIALIZAR MAS COSAS SI HACEN FALTA.....
	/// .........................................
	/// .........................................

}

GLvoid ReSizeGLScene(GLsizei width, GLsizei height)
{
	if (height==0)					// Prevent A Divide By Zero By
		height=1;				// Making Height Equal One

	glViewport(0,0,width,height);			// Reset The Current Viewport

	glMatrixMode(GL_PROJECTION);			// Select The Projection Matrix
	glLoadIdentity();				// Reset The Projection Matrix

	// Calculate The Aspect Ratio Of The Window
	gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);
	glMatrixMode(GL_MODELVIEW);			// Select The Modelview Matrix
	glLoadIdentity();				// Reset The Modelview Matrix
}


/// LA DEMO

	/// METER AQUI EL CODIGO DE TU DEMO

void smile1()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;
	static float ang = 0;


	glLoadIdentity();
	
	glTranslatef(-3,4,-13.0f);
		
	if (s1rotateLeft == TRUE){
		glRotatef(ang, 0.0f, 0.0f, 1.0f);
		ang=ang + 3;
		//if (ang > 360) ang = 0;
	}


	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile1]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);


	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();


	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}

void smile2()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(0,4,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile2]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}

void smile3()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(3,4,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile3]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}

void smile4()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(6,4,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile4]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}

void smile5()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(-3,0.5,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile5]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}


void smile6()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(0,0.5,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile6]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face

	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}


void smile7()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(3,0.5,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile7]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}


void smile8()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(6,0.5,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile8]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}


void smile9()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(-3,-3,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile9]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}


void smile10()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(0,-3,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile10]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}

void smile11()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(3,-3,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile11]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}

void smile12()
{

	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(6,-3,-13.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile12]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}

void flashblanco1()
{

	glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	//glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	flashblanco = FALSE;

}

void flashsmile1()
{
	smile1();
	smile2();
	smile3();
	smile4();
	smile5();
	smile6();
	smile7();
	smile8();
	smile9();
	smile10();
	smile11();
	smile12();

	flashblanco1();

}

void flascolorR()
{
	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(1.0f, 0.0f, 0.0f, 0.0f);

}

void flascolorG()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
}
void flascolorB()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0.0f, 0.0f, 1.0f, 0.0f);
}	

void flascolorN()
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}

void titulo1()
{
	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								

	glTranslatef(1.5,0.5,-4.0f);
	glDisable(GL_DEPTH_TEST);

	glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_titulo1]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glBegin(GL_QUADS);
	// Front Face
	
	glTexCoord2f(0.0f, 0.0f); glVertex3f(-2.5f, -1.5f,  1.0f);	// Bottom Left Of The Texture and Quad
	glTexCoord2f(1.0f, 0.0f); glVertex3f(-0.5f, -1.5f,  1.0f);	// Bottom Right Of The Texture and Quad
	glTexCoord2f(1.0f, 1.0f); glVertex3f(-0.5f,  0.5f,  1.0f);	// Top Right Of The Texture and Quad
	glTexCoord2f(0.0f, 1.0f); glVertex3f(-2.5f,  0.5f,  1.0f);	// Top Left Of The Texture and Quad
	glEnd();
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
}


void todos1()
{
	static float R  = 1;
	static float G  = 1;
	static float B  = 1;


	glLoadIdentity();								
	glTranslatef(0.0f,0.0f,-2.0f);
	
	glEnable(GL_DEPTH_TEST);

	//glBindTexture(GL_TEXTURE_2D, texture[TEXTURA_smile4]);
	
	glEnable(GL_BLEND);
	glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
	glColor3f(R,G,B);

	glTranslatef(0.0f,0.0f,-5.0f);

	glRotatef(xrot,1.0f,0.0f,0.0f);
	glRotatef(yrot,0.0f,1.0f,0.0f);
	glRotatef(zrot,0.0f,0.0f,1.0f);

	glBindTexture(GL_TEXTURE_2D, texture[13]);

	glBegin(GL_QUADS);
		// Front Face
		glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
		glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
		glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
		glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
		// Back Face
		glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
		glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
		glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
		glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
		// Top Face
		glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
		glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
		glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
		glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
		// Bottom Face
		glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
		glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
		glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
		glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
		// Right face
		glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
		glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f,  1.0f, -1.0f);
		glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,  1.0f,  1.0f);
		glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f,  1.0f);
		// Left Face
		glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
		glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f,  1.0f);
		glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f,  1.0f,  1.0f);
		glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f,  1.0f, -1.0f);
	glEnd();

	xrot+=0.6f;
	yrot+=0.4f;
	zrot+=0.8f;

	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);
	
}


void s1rotaderecha1()
{


}


void srotaizquierda1()
{
}


/// Esta funcion es la que dibuja las cosas
GLvoid DrawGLScene(GLvoid)
{
	DWORD t0 = 0;

	t0 = GetTickCount();

	glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);

	if (smile1active == TRUE) smile1();
	if (smile2active == TRUE) smile2();	
	if (smile3active == TRUE) smile3();	
	if (smile4active == TRUE) smile4();
	if (smile5active == TRUE) smile5();
	if (smile6active == TRUE) smile6();
	if (smile7active == TRUE) smile7();
	if (smile8active == TRUE) smile8();
	if (smile9active == TRUE) smile9();
	if (smile10active == TRUE) smile10();
	if (smile11active == TRUE) smile11();
	if (smile12active == TRUE) smile12();

	if (flashblanco == TRUE) {
		flashblanco1();
	
	}
	if (flashsmile == TRUE){
		flashsmile1();
		flashsmile = FALSE;
	}

	if (flascolor == TRUE){

		if (i == 1){
			flascolorN();
			i++;
		}

	}

	if (titulo == TRUE)
	{
		titulo1();
	}

	if (todos == TRUE)
	{
		todos1();
	}

	/// Este bucle es para sincronizar la velocidad de la demo
	while(GetTickCount()-t0 < MAX_SPEED_TIME);
}
