/*
 * ShowBMP.C
 *
 * Displays the input image file in a window.
 *
 * Usage: ShowBMP <inputBMPfilename>
 */

#include "pixmap.h"

RGBpixmap myPicture;

void display(void)
{	
  glClear(GL_COLOR_BUFFER_BIT);
  myPicture.draw();	
} 

void myInit(char *filename)
{   
  glClearColor(0.9f, 0.9f, 0.9f, 0.5f);  // background is greenish 
  glColor3f(0.0f,0.0f,0.3f);

  string BMPFile = filename;
  myPicture.readBMPFile(BMPFile);
}

int main(int argc, char **argv)
{
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  glutInitWindowSize(512, 512);
  glutInitWindowPosition(100,100);
  glutCreateWindow("Show BMP file");
  myInit(argv[1]);
  glutDisplayFunc(display);
  glutMainLoop();
  return 0;
}
