rendered paste body// lab2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdlib.h>
#include <GL/glut.h>
#include "Lego.h"
static const unsigned int fps = 60; // used by timer and to start timer off
int windowWidth;
int windowHeight;
void mouse(int button, int state, int x, int y)
{
//nothing
}
void reshape(int w, int h)
{
windowWidth = w;
windowHeight = h;
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(0.0, (GLdouble) w, 0.0, (GLdouble) h, -150.0, 100.0);
}
static void display(void)
{
static Lego myLego;
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(windowWidth/2.0 + myLego.lengthUnit/2.0, windowHeight/2.0 + myLego.heightUnit/2.0, 10);
glRotatef(90, 0.5, 0.5, 0.5);
myLego.brick("yellow");
glPopMatrix();
glutSwapBuffers();
}
void init()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
//glMatrixMode(GL_PROJECTION);
//glLoadIdentity();
//glFrustum(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowPosition(100,100);
glutInitWindowSize(400,400);
glutCreateWindow("Lab 2: phillijw");
init();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMouseFunc(mouse);
glutMainLoop();
return 0;
}