From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 114CEBC69 for ; Fri, 13 Apr 2007 00:24:35 +0200 (CEST) Received: from ptb-relay02.plus.net (ptb-relay02.plus.net [212.159.14.213]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3CMOYB8015929 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 13 Apr 2007 00:24:34 +0200 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay02.plus.net with esmtp (Exim) id 1Hc7iT-0001K3-VK for caml-list@yquem.inria.fr; Thu, 12 Apr 2007 23:24:34 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Example slowing down... (OpenGL/lablgl) Date: Thu, 12 Apr 2007 23:19:50 +0100 User-Agent: KMail/1.9.5 References: <20070411222521.GA1603@first.in-berlin.de> <200704122046.18632.jon@ffconsultancy.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200704122319.51034.jon@ffconsultancy.com> X-Miltered: at concorde with ID 461EB1A2.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lablgl:01 sqrt:01 argv:01 buffer:01 printf:01 printf:01 triangles:01 iter:01 mainloop:01 vsync:01 ocaml:01 ocaml:01 26,:98 3600:98 10.:98 On Thursday 12 April 2007 21:26, Martin wrote: > No, it seems to be related to the matrix accumulating numerical errors. No. It is the time function. You can check the numerical error by computing the determinant, which remains accurate to 1 part in 10^5 after 3600 frames. The mean numerical error probably scales as sqrt n because the floats are "random". > The following works just fine: > > let _ = > ignore( Glut.init Sys.argv ); > Glut.initDisplayMode ~double_buffer:true (); > ignore (Glut.createWindow ~title:"OpenGL Demo"); > let angle t = 10. *. t *. t in > let render () = let a = GlMat.to_array(GlMat.get_matrix `modelview_matrix) in let d = a.(0).(0)*.a.(1).(1) -. a.(1).(0)*.a.(0).(1) in Printf.printf "%f\n" d; > GlClear.clear [ `color ]; > GlMat.load_identity (); > GlMat.rotate ~angle: (angle (Sys.time ())) ~z:1. (); > GlDraw.begins `triangles; > List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.]; > GlDraw.ends (); > Glut.swapBuffers () in > GlMat.mode `modelview; > Glut.displayFunc ~cb:render; > Glut.idleFunc ~cb:(Some Glut.postRedisplay); > Glut.mainLoop () The original also works fine, depending what results you expect and whether you've forced vsync. If you want to check the latter, run nvidia-settings and select "OpenGL Settings". -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists