Skip to content

Instantly share code, notes, and snippets.

@baris
Created March 19, 2010 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baris/337573 to your computer and use it in GitHub Desktop.
Save baris/337573 to your computer and use it in GitHub Desktop.
(* ocamlopt -I +glMLite GL.cmxa Glut.cmxa testgl.ml *)
open GL;;
open Glu;;
open Glut;;
let start_show () =
glClear [GL_COLOR_BUFFER_BIT];
glBegin GL_TRIANGLES;
glColor4 1.0 1.0 0.0 0.75;
glLoadIdentity ();
glMatrixMode GL_MODELVIEW;
glVertex3 (Random.float 1.0) (Random.float 1.0) (Random.float 1.0);
glVertex3 (Random.float 1.0) (Random.float 1.0) (Random.float 1.0);
glVertex3 (Random.float 1.0) (Random.float 1.0) (Random.float 1.0);
glEnd ();
glutSwapBuffers();
;;
let () =
ignore(glutInit Sys.argv);
glutInitDisplayMode [GLUT_DOUBLE];
ignore(glutCreateWindow Sys.argv.(0));
glutDisplayFunc ~display:start_show;
glutIdleFunc ~idle:(glutPostRedisplay);
glutMainLoop();
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment