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 OAA08200; Wed, 20 Feb 2002 14:48:59 +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 OAA08351 for ; Wed, 20 Feb 2002 14:48:58 +0100 (MET) Received: from comtv.ru (comtv.ru [217.10.32.4]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g1KDmuH15173 for ; Wed, 20 Feb 2002 14:48:56 +0100 (MET) Received: from [10.0.66.9] ([10.0.66.9] verified) by comtv.ru (CommuniGate Pro SMTP 3.5.6) with ESMTP id 2342831; Wed, 20 Feb 2002 16:48:43 +0300 Date: Wed, 20 Feb 2002 16:48:13 -0500 (EST) From: malc X-Sender: malc@home.oyster.ru To: Bor-Yuh Evan Chang cc: caml-list@inria.fr Subject: Re: [Caml-list] lablGL and camlimages In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 20 Feb 2002, Bor-Yuh Evan Chang wrote: > Hello, > > I am using the lablGL library to use Open GL in OCaml. I am trying to > read from the frame buffer (using GlPix.read) and output to a file (a jpeg > using camlimages), but I am having difficulties. Has anyone tried this or > have any pointers to where I can find some additional information? What kind of difficulties? lablgl or camlimages related? In any case here goes very simple template to output picture to TGA, you can work from there. method screenshot = let w = Togl.width togl and h = Togl.height togl in let pixels = GlPix.read ~x:0 ~y:0 ~width:w ~height:h ~format:`rgb ~kind:`ubyte in let praw = GlPix.to_raw pixels in let raw = Raw.gets ~pos:0 ~len:(Raw.byte_size praw) praw in let w = GlPix.width pixels in let h = GlPix.height pixels in let f = open_out_bin "shot.tga" in let outb = output_byte f in let outw w = output_byte f (w land 0xff); output_byte f (w lsr 8) in outw 0; outb 2; for i = 0 to 8 do outb 0 done; outw w; outw h; outb 24; outb 0; for i = 0 to pred (w * h) do outb raw.(i * 3 + 2); outb raw.(i * 3 + 1); outb raw.(i * 3 + 0); done; close_out f -- mailto:malc@pulsesoft.com ------------------- 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