From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA24571; Tue, 12 Nov 2002 10:12:21 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA24567 for ; Tue, 12 Nov 2002 10:12:20 +0100 (MET) Received: from relay.pair.com (relay1.pair.com [209.68.1.20]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id gAC9CIX15472 for ; Tue, 12 Nov 2002 10:12:18 +0100 (MET) Received: (qmail 31280 invoked from network); 11 Nov 2002 21:45:28 -0000 Received: from arda.pair.com (HELO compaqreview.d6.com) (209.68.1.133) by relay1.pair.com with SMTP; 11 Nov 2002 21:45:28 -0000 X-pair-Authenticated: 209.68.1.133 Message-Id: <4.3.2.7.2.20021111124942.03702f08@localhost> X-Sender: checker@localhost X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Mon, 11 Nov 2002 13:02:31 -0800 To: caml-list@inria.fr From: Chris Hecker Subject: [Caml-list] lablgl bind texture patch Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Here's a small patch to add glBindTexture et al. to lablgl 0.98. It was easiest to add the scalar versions of gen_ and delete_ and then build the array versions off those even though OpenGL only has the array versions, so I exposed them. I haven't actually tested it beyond my use, but it's pretty trivial. Enjoy, Chris diff -ur old/lablGl-0.98/glTex.ml lablGl-0.98/glTex.ml --- old/lablGl-0.98/glTex.ml Sun Sep 30 19:59:13 2001 +++ lablGl-0.98/glTex.ml Sun Nov 10 17:52:07 2002 @@ -66,3 +66,11 @@ ] external parameter : target:[`texture_1d|`texture_2d] -> parameter -> unit = "ml_glTexParameter" + +type texture_id = int32 +external gen_texture : unit -> texture_id = "ml_gen_texture" +let gen_textures n = Array.init n (fun _ -> gen_texture ()) +external bind_texture : target:[`texture_1d|`texture_2d] -> texture_id -> unit + = "ml_glBindTexture" +external delete_texture : texture_id -> unit = "ml_delete_texture" +let delete_textures a = Array.iter (fun id -> delete_texture id) a diff -ur old/lablGl-0.98/glTex.mli lablGl-0.98/glTex.mli --- old/lablGl-0.98/glTex.mli Sun Sep 30 19:59:13 2001 +++ lablGl-0.98/glTex.mli Sun Nov 10 17:49:55 2002 @@ -41,3 +41,10 @@ | `priority of clampf ] val parameter : target:[`texture_1d|`texture_2d] -> parameter -> unit + +type texture_id +val gen_texture : unit -> texture_id +val gen_textures : int -> texture_id array +val bind_texture : target:[`texture_1d|`texture_2d] -> texture_id -> unit +val delete_texture : texture_id -> unit +val delete_textures : texture_id array -> unit diff -ur old/lablGl-0.98/ml_gl.c lablGl-0.98/ml_gl.c --- old/lablGl-0.98/ml_gl.c Sun Jul 14 19:15:48 2002 +++ lablGl-0.98/ml_gl.c Sun Nov 10 17:51:41 2002 @@ -576,6 +576,26 @@ return Val_unit; } +CAMLprim value ml_gen_texture (value unit) +{ + GLuint id; + glGenTextures(1,&id); + return copy_int32(id); +} +CAMLprim value ml_glBindTexture (value target, value texture_id) +{ + GLenum targ = GLenum_val(target); + GLuint id = Int32_val(texture_id); + glBindTexture(targ,id); + return Val_unit; +} +CAMLprim value ml_delete_texture (value texture_id) +{ + GLuint id = Int32_val(texture_id); + glDeleteTextures(1,&id); + return Val_unit; +} + ML_3 (glTranslated, Double_val, Double_val, Double_val) CAMLprim value ml_glVertex(value x, value y, value z, value w) /* ML */ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners