#include <GL/gl.h>
#include <stdio.h>
#include "loop.h"

CLoop::CLoop(char * f)
{
  FILE *file;
  unsigned int i;
  float data;

  file = fopen(f, "r");
  fscanf(file, "%u", &vertices);

  vertex = new CVector[vertices];

  for(i=0; i<vertices; i++)
    {
      fscanf(file, "%f", &data);
      vertex[i].x = data*1.2*0.01;
      fscanf(file, "%f", &data);
      vertex[i].y = data*1.2*0.01;
      fscanf(file, "%f", &data);
      vertex[i].z = data*1.2*0.01;
    }
  fclose(file);
} 

CLoop::~CLoop()
{
  delete [] vertex;
}

void CLoop::draw(void)
{
  unsigned int i;
  glBegin(GL_LINES);
  for(i=0; i<vertices; i++)
    {
      glVertex3f(vertex[i].x, vertex[i].y, vertex[i].z);
      glVertex3f(vertex[i].x, vertex[i].y, vertex[i].z+10);
    }
  glEnd();
}









