cs602 Code Assignment 2
cs602 Code Assignment 2
#include <GL/glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <cmath>
enum CubeState
STATE_LEFT,
STATE_MIDDLE,
STATE_RIGHT,
STATE_STOP
};
void init()
void drawTeapot()
if (cubeState == STATE_LEFT)
glutSolidTeapot(1.0);
{
elapsedTime += 0.01f; // Update the elapsed time
if (cubeState == STATE_LEFT)
if (cubeState != STATE_STOP)
rotationAngle -= 360.0f;
if (cubeState != STATE_STOP)
if (height == 0)
height = 1; // Prevent division by zero
glViewport(0, 0, width, height); // Set the viewport to cover the entire window
void display()
drawTeapot();
glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
glutCreateWindow("SaMu");
return 0;