/* teatex.c 
Bilal Ghalib
Teatexedited!
This version has Texbits 1-6 that holds different 256 pixel bmp's
that are texturized onto a cube's various faces.

*/


#include <stdlib.h>
#include <glut.h>
#include "bitmap.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int square = 0, triangle = 0;
int width = 500, height = 500;

void displaySquare(void){
	glClearColor(0.0, 0.0, 1.0, 1.0);
	glLoadIdentity();
	//get background to contrast
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 0.0, 0.0);	
	//change color for suqare
		
	glBegin(GL_QUADS);			
	//draw square
	glVertex3f(-0.70f,0.70f,0.0f);			
	glVertex3f(.70f,.70f,0.0f);			
	glVertex3f(0.70f,-.70f,0.0f);			
	glVertex3f(-0.70f,-.70f,0.0f);			
	glEnd();				
	
	glFlush();
}

void displayTriangle(void){
	glClearColor(1.0, 0.0, 0.0, 1.0);
	glLoadIdentity();
	//create background color
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(0.0, 0.0, 1.0);		
	//change and contrast the color
	glBegin(GL_TRIANGLES);			
	//draw triangles
	glVertex3f(0.0f,0.70f,0.0f);			
	glVertex3f(-.70f,-.70f,0.0f);			
	glVertex3f(0.70f,-.70f,0.0f);			
	glEnd();
	glFlush();
}

int main(int argc, char **argv)
{
//intitialize
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB);
glutInitWindowSize(width, height);
glutInitWindowPosition(100,100);

//make square window
square = glutCreateWindow("Square");
glutDisplayFunc(displaySquare);
glutInitWindowPosition(625,100);

//make triangle window:
triangle = glutCreateWindow("Triangle");
glutDisplayFunc(displayTriangle);

// Enter Glut Main Loop and wait for events
glutMainLoop();
return 0;
}
