// Compiled as :
// cl /FIwindows.h sample.cpp uglyfont.cpp kernel32.lib user32.lib gdi32.lib advapi32.lib opengl32.lib glu32.lib glaux.lib

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glaux.h>

#include "uglyfont.h"

int main(int ac,char *av[])
{
	auxInitDisplayMode(AUX_SINGLE|AUX_RGB);
	auxInitPosition(0,0,400,400);
	auxInitWindow(NULL);


	glViewport(0,0,400,400);
	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);


    glClearColor(0.0F,0.0F,0.0F,1.0F);
    glClearDepth(1.0F);

	glEnable(GL_DEPTH_TEST);

    glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
    gluPerspective(45.0F,1.0,0.5,17.0F);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glTranslated(0.0,0.0,-12.0);
	glRotated( 20.0,1.0,0.0,0.0);
	glRotated(-45.0,0.0,1.0,0.0);

	glShadeModel(GL_FLAT);



	glDisable(GL_LIGHTING);
	glColor3f(0,0,1.0);

	glPushMatrix();
	glTranslated(3.0,3.0,0.0);
	YsDrawUglyFont("(3,3,0)",0);
	glPopMatrix();

	glPushMatrix();
	glTranslated(0.0,0.0,3.0);
	YsDrawUglyFont("(0,0,3)",1);
	glPopMatrix();

	YsDrawUglyFont("Center",1);



	glColor3f(0,1.0,0);

	// Setting up 2D Drawing as:
	// (0,0)+-----------+
	//      |           |
	//      |           |
	//      |           |
	//      |           |
	//      +-----------+(viewport[2],viewport[3])
	// To draw letters upright, -1 must be multiplied to the Y coordinate,
	// because the positive-Y direction is down.

	int viewport[4];
	glGetIntegerv(GL_VIEWPORT,viewport);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0.0,(double)viewport[2],(double)viewport[3],0.0,-1.0,1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	glDisable(GL_DEPTH_TEST);


	glPushMatrix();
	glTranslatef(0,40,0);
	glScalef(12.0,-24.0,1.0);
	YsDrawUglyFont("UPRIGHT",0);
	glPopMatrix();


	glPushMatrix();
	glTranslatef(96,16,0);
	glScalef(12.0,24.0,1.0); 
	YsDrawUglyFont("UPSIDE-DOWN",0);
	glPopMatrix();


	glPushMatrix();
	glTranslatef(100,100,0);
	glScalef(12.0,-24.0,1.0); 
	YsDrawUglyFont("CENTERING",1);
	glPopMatrix();

	glBegin(GL_LINES);
	glVertex2i(50,100);
	glVertex2i(150,100);
	glVertex2i(100,50);
	glVertex2i(100,150);
	glEnd();

	glFlush();

	Sleep(15000);


	return 0;
}
