Ejemplo n.º 1
0
/*
* main - this is the main programme.
*/
int main ()
{
  TestMaterial universe;
  universe.initializeUniverse();
  universe.TestPrecision();
  return 0;
}
Ejemplo n.º 2
0
/*
* main - this is the main programme.
*/
int main ()
{
  #ifdef ENABLE_SIGFPE
  feenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT);
  #endif
  TestMaterial universe = TestMaterial(NON_STP_BV_OBJECTS );
  universe.initializeUniverse();
  universe.TestAnimation();
  return 0;
}
/*
* main - this is the main programme.
*/
int main ()
{
  #ifdef ENABLE_SIGFPE
  feenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT);
  #endif
  TestMaterial universe = TestMaterial(); //No other objects than STP-BVs
  universe.initializeUniverse();
  universe.TestAnimation();
  return 0;
}
Ejemplo n.º 4
0
/*
* init - application initialisation. Setup keyboard input,
* mouse input, timer, camera and OpenGL.
*/
static void
init (void)
{
  /*
  * application initialization
  */

  /* init keyboard */
  memset (keyboard.keymap, 0, 256);
  memset (keyboard.special, 0, 256);

  glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA| GLUT_DEPTH|GLUT_ALPHA);

  glutInitWindowSize (800, 600);
  glutCreateWindow ("Smooth collision detection");

  /* init mouse */
  mouse.buttons[GLUT_LEFT_BUTTON] = GLUT_UP;
  mouse.buttons[GLUT_MIDDLE_BUTTON] = GLUT_UP;
  mouse.buttons[GLUT_RIGHT_BUTTON] = GLUT_UP;
  mouse.x = 0;
  mouse.y = 0;

  /* init timer */
  timer.current_time = 0;
  timer.last_time = 0;

  /* init camera input */
  rot.x = 0.0f;
  eye.x = 0.0f;
  rot.y = 0.0f;
  eye.y = 0.0f;
  rot.z = 0.0f;
  eye.z = 7.0f;



  /*
  * init OpenGL
  */




  glEnable (GL_LIGHTING);

  glClearColor (background[0], background[1], background[2], 1.0f);
  glShadeModel (GL_SMOOTH);

  glEnable (GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);

  glEnable(GL_COLOR_MATERIAL);

  glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE);
  glShadeModel (GL_SMOOTH);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_DST_ALPHA);

#ifndef LINES_DISPLAY
  glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
#else
  glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
  //glEnable(GL_LINE_SMOOTH);
#endif

  glEnable(GL_FOG);
  {
    glFogfv (GL_FOG_COLOR, &background[0]);
    glFogi (GL_FOG_MODE, GL_EXP2);

    glFogf (GL_FOG_DENSITY, 0.00025);

    glFogf (GL_FOG_START, 14000.0);
    glFogf (GL_FOG_END, 15000.0);
  }

  glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
  glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
  glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
  glHint (GL_FOG_HINT, GL_NICEST);

  glEnable(GL_LIGHT0);
  glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
  glLightfv(GL_LIGHT0, GL_POSITION, light0_position);

  glEnable(GL_LIGHT1);
  glLightfv(GL_LIGHT1, GL_AMBIENT, light1_ambient);
  glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_diffuse);
  glLightfv(GL_LIGHT1, GL_POSITION, light1_position);

  glMatrixMode( GL_MODELVIEW );

  glLoadIdentity();
  glGetDoublev(GL_MODELVIEW_MATRIX,matCam);

  /*inialize objects*/

  universe.initializeUniverse();

  //create the gl volumes.
  sObjGL = createGL(universe.sObj);
}