From: Jon Harrop <jon@ffconsultancy.com>
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 [thread overview]
Message-ID: <200707051352.24760.jon@ffconsultancy.com> (raw)
In-Reply-To: <1F16F766-1C00-4C69-9154-9A2A1528FB5C@epfl.ch>
On Thursday 05 July 2007 08:45:49 Daniel Bünzli 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
> 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
this optimization show an enormous performance improvement here?
Anyway, you can use texture objects by supplementing texture.ml with:
let activate_texture tex =
let target = `texture_2d in
let t = 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 = Hashtbl.create 1
let set_current_texture texname =
try GlTex.bind_texture ~target:`texture_2d (Hashtbl.find m texname)
with Not_found ->
let tex =
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
generated by Md3.draw_frame_triangles as well:
let draw_frame_triangles =
let m = Hashtbl.create 1 in
fun a b c d ->
let key = (a, b, c, d) in
try GlList.call(Hashtbl.find m key) with Not_found ->
let list = 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.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
The OCaml Journal
http://www.ffconsultancy.com/products/ocaml_journal/?e
next prev parent reply other threads:[~2007-07-05 12:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-03 21:48 Grant Olson
2007-07-03 22:43 ` [Caml-list] " Jon Harrop
2007-07-04 2:18 ` Grant Olson
2007-07-04 8:00 ` Daniel Bünzli
2007-07-04 20:06 ` Grant Olson
2007-07-04 20:51 ` Bünzli Daniel
2007-07-04 21:22 ` Jon Harrop
2007-07-05 0:25 ` Daniel Bünzli
2007-07-05 3:05 ` Jon Harrop
2007-07-05 7:45 ` Daniel Bünzli
2007-07-05 12:52 ` Jon Harrop [this message]
2007-07-05 13:37 ` Daniel Bünzli
2007-07-05 13:52 ` Daniel Bünzli
2007-07-05 14:22 ` Jon Harrop
2007-07-05 14:43 ` Daniel Bünzli
2007-07-05 23:40 ` Grant Olson
2007-07-06 19:41 ` Jon Harrop
2007-07-04 10:58 ` Jon Harrop
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200707051352.24760.jon@ffconsultancy.com \
--to=jon@ffconsultancy.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox