testplot2.rb
Path: testplot2.rb
Modified: Sat Mar 20 22:39:57 JST 2004
Required files
opengl    glut    mathn   
Methods
init    showstep   
Included modules
Math
Public Instance methods
init()
# File testplot2.rb, line 44
def init
   mat_specular = [ 1.0, 1.0, 1.0, 1.0 ];
   light_position = [ 0.0, 30.0, 50.0, 0.0 ];

   GL.ClearColor(0.0, 0.0, 0.0, 0.0);
   GL.ShadeModel(GL::SMOOTH);
   GL.Enable(GL::DEPTH_TEST);
   GL.Light(GL::LIGHT0, GL::POSITION, light_position);
   GL.Enable(GL::LIGHTING);
   GL.Enable(GL::LIGHT0);

   GL.Material(GL::FRONT, GL::DIFFUSE, $diffuseMaterial);
#   GL.Material(GL::FRONT, GL::SPECULAR, mat_specular);
#   GL.Material(GL::FRONT, GL::SHININESS, 25.0);
#   GL.ColorMaterial(GL::FRONT, GL::DIFFUSE);
   GL.Enable(GL::COLOR_MATERIAL);
  GL.MatrixMode(GL::PROJECTION);
  GLU.Perspective(40.0, 1.0, 1.0,  10.0);
  GL.MatrixMode(GL::MODELVIEW);
  GLU.LookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
  
end
showstep(direction)
# File testplot2.rb, line 67
def showstep(direction)
  if $runstate == 1
    GLUT.IdleFunc(nil) 
    $runstate = 0;
  end
  $inc = -$inc if $inc < 0
  $inc = 1  if $inc == 0
  $inc = -$inc if direction < 0
end