#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#include <stdlib.h>

#include "PowerPak/powerpak.h"
#include "PowerPak/power3d.h"
#include "PowerPak/powerinput.h"

P3D_Color color;
P3D_Object cube, camera;
int done;

void P3D_Display(void)
{
   int i;

   P3D_SetScreen (SCREENWIDTH3D, SCREENHEIGHT3D, 1.0, 40.0, P3D_NOSPLIT, 1);
   P3D_Clear();
   P3D_ShowCamera(camera);
   P3D_ShowObject(cube);

   cube.rotx += .4;
   cube.roty -= .6;
   cube.rotz += .8;

   P3D_ShowDoubleBuffer();
}



void P3D_Reshape (int w, int h)
{
   P3D_SetScreen (w, h, 1.0, 40.0, P3D_NOSPLIT, 1);
}

void keyboard(unsigned char key, int x, int y)
{
   switch (key) {
      case 27:
         exit(0);
         break;
   }
}

int main(int argc, char** argv)
{
   P3D_Init(argc, argv);
   P3D_SetGFXMode (800, 600, argv[0], 16, 0);
   glutKeyboardFunc(keyboard);

   color = P3D_CreateColor(1.0, .95, 0.70, 0.0);
   cube = P3D_CreateSolidCube(3.0, color);
   cube.posz = -10;
   camera = P3D_CreateCamera();
   camera.roty = 0;

   P3D_MainLoop(P3D_Display, P3D_Reshape);

   exit(0);

   return 0;
}




