From: Chris Hecker <checker@d6.com>
To: caml-list@inria.fr
Subject: [Caml-list] lablgl bind texture patch
Date: Mon, 11 Nov 2002 13:02:31 -0800 [thread overview]
Message-ID: <4.3.2.7.2.20021111124942.03702f08@localhost> (raw)
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
reply other threads:[~2002-11-12 9:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4.3.2.7.2.20021111124942.03702f08@localhost \
--to=checker@d6.com \
--cc=caml-list@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