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 A17E9BC69 for ; Thu, 5 Jul 2007 14:58:00 +0200 (CEST) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l65CvxcQ008354 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 5 Jul 2007 14:58:00 +0200 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay01.plus.net with esmtp (Exim) id 1I6QuF-0006mx-AQ for caml-list@yquem.inria.fr; Thu, 05 Jul 2007 13:57:59 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] ANN: Chess III Arena 0.5 Date: Thu, 5 Jul 2007 13:52:24 +0100 User-Agent: KMail/1.9.7 References: <002501c7be76$d0348630$ac01a8c0@johnyaya> <200707050405.12031.jon@ffconsultancy.com> <1F16F766-1C00-4C69-9154-9A2A1528FB5C@epfl.ch> In-Reply-To: <1F16F766-1C00-4C69-9154-9A2A1528FB5C@epfl.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200707051352.24760.jon@ffconsultancy.com> X-Miltered: at concorde with ID 468CEAD7.004 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 glpix:01 unpack:01 alignment:01 iter:01 hashtbl:01 hashtbl:01 memoize:01 triangles:01 triangles:01 ocaml:01 ocaml:01 frog:98 wrote:01 compile:01 On Thursday 05 July 2007 08:45:49 Daniel B=FCnzli wrote: > No, it can result in a slow down even if it is harwdare rendered, the > effect of your "optimization" is implementation dependent. Can you quantify that: what implementations? how much slow down? > The =20 > problem is that glTexImage2d cannot be compiled efficently in a > display list (see the bottom of this page [1] for why this is the > case). If "glTexImage2d cannot be compiled efficently in a display list" why does= =20 this optimization show an enormous performance improvement here? Anyway, you can use texture objects by supplementing texture.ml with: let activate_texture tex =3D=20 let target =3D `texture_2d in let t =3D GlTex.gen_texture () in GlTex.bind_texture ~target t; GlPix.store (`unpack_alignment 1); GlTex.image2d tex; List.iter (GlTex.parameter ~target) [ `wrap_s `clamp; `wrap_t `clamp; `mag_filter `linear; `min_filter `linear ]; GlTex.env (`mode `modulate); t;; let m =3D Hashtbl.create 1 let set_current_texture texname =3D try GlTex.bind_texture ~target:`texture_2d (Hashtbl.find m texname) with Not_found -> let tex =3D try activate_texture (Hashtbl.find textures texname) with Not_found -> activate_texture (Hashtbl.find textures "unknown") in Hashtbl.add m texname tex This gives me ~50fps without any display lists. If I memoize vertex data=20 generated by Md3.draw_frame_triangles as well: let draw_frame_triangles =3D let m =3D Hashtbl.create 1 in fun a b c d -> let key =3D (a, b, c, d) in try GlList.call(Hashtbl.find m key) with Not_found -> let list =3D GlList.create `compile in draw_frame_triangles a b c d; GlList.ends(); GlList.call list; Hashtbl.add m key list then I'm back up to ~600fps. =2D-=20 Dr Jon D Harrop, Flying Frog Consultancy Ltd. The OCaml Journal http://www.ffconsultancy.com/products/ocaml_journal/?e