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 KAA00983; Thu, 1 May 2003 10:55:54 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA01316 for ; Thu, 1 May 2003 10:55:53 +0200 (MET DST) Received: from avalon.ens-lsh.fr (mailhost.ens-lsh.fr [193.51.131.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h418tqT06808 for ; Thu, 1 May 2003 10:55:52 +0200 (MET DST) Received: from avalon.ens-lsh.fr (localhost [127.0.0.1]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id h419tNPL007927 for ; Thu, 1 May 2003 10:55:23 +0100 (WEST) Received: from ens-notes1.ens-lsh.fr (ens-notes1.ens-lsh.fr [10.2.1.44]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id h419tMji007924 for ; Thu, 1 May 2003 10:55:23 +0100 (WEST) Received: from mostha ([10.3.20.3]) by ens-notes1.ens-lsh.fr (Lotus Domino Release 5.0.10) with SMTP id 2003050110541210:6970 ; Thu, 1 May 2003 10:54:12 +0200 Date: Thu, 1 May 2003 10:53:45 +0200 From: Damien To: caml-list@inria.fr Subject: Re: [Caml-list] writing images with lablgl Message-Id: <20030501105345.67637c53.Damien.Pous@ens-lyon.fr> In-Reply-To: <200304301232.36235.snob@metalinkltd.com> References: <20030430102914.20c1a625.Damien.Pous@ens-lyon.fr> <200304301232.36235.snob@metalinkltd.com> Organization: mosthagloups X-Mailer: Sylpheed version 0.8.10claws13 (GTK+ 1.2.10; i386-debian-linux-gnu) Mime-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 01/05/2003 10:54:12, Serialize by Router on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 01/05/2003 10:54:13, Serialize complete at 01/05/2003 10:54:13 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Spam: no; 0.00; damien:01 ens-lyon:01 caml-list:01 lablgl:01 printf:01 fprintf:01 glpix:01 images:98 width:98 height:98 opengl:02 string:03 glut:03 data:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > You can use glReadPixels and glReadBuffer save BACK image from OpenGL > to memory. Converting pixel data to image format is your task. I have done it for PPM : let save_ppm s = let o = open_out s in let w = Glut.get Glut.WINDOW_WIDTH in let h = Glut.get Glut.WINDOW_HEIGHT in Printf.fprintf o "P6\n%d %d\n%d\n" w h 255; let w3 = 3*w in let r = GlPix.to_raw (GlPix.read 0 0 w (3*h) `rgb `ubyte) in for j = h-1 downto 0 do output_string o (Raw.gets_string r (w3*j) w3) done; close_out o why not to include this kind of boring function into lablgl(ut) ? (or at least somewhere in the examples...) damien ------------------- 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