Loading animated 3D data/OCaml: Difference between revisions

m
style improvements
m (add {{libheader|GLUT}})
m (style improvements)
 
Line 263:
let display scene = function () ->
glClear [GL_COLOR_BUFFER_BIT; GL_DEPTH_BUFFER_BIT];
glLoadIdentity ();
 
List.iter (function
Line 296:
glColor3v (get_val3 !t color)
) appearance;
glPushMatrix ();
glScalev (get_val3 !t size);
glutSolidCube ~size:1.0;
glPopMatrix ();
 
| _ -> () (* TODO other primitives *)
Line 308:
) scene;
 
glFlush ();
glutSwapBuffers ();
;;
 
Line 315:
let reshape ~width ~height =
glMatrixMode GL_PROJECTION;
glLoadIdentity ();
gluPerspective 30. (float width /. float height) 2. 30.;
glViewport 0 0 width height;
glMatrixMode GL_MODELVIEW;
glutPostRedisplay ();
;;
 
Line 331:
let () =
ignore(glutInit Sys.argv);
glutInitDisplayMode [GLUT_RGBA; GLUT_DOUBLE; GLUT_DEPTH];
glutInitWindowPosition ~x:200 ~y:200;
glutInitWindowSize ~width:400 ~height:300;
Line 350:
glutReshapeFunc ~reshape;
glutKeyboardFunc ~keyboard;
glutMainLoop ();
;;</lang>