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 LAA03245; Thu, 1 May 2003 11:48:38 +0200 (MET DST) 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 LAA03098 for ; Thu, 1 May 2003 11:48:36 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from gnome06.net.rol.ru (smtp.rol.ru [194.67.1.9]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h419mYH08717 for ; Thu, 1 May 2003 11:48:35 +0200 (MET DST) Received: from 194.186.30.209.adsl-spb.net.rol.ru ([194.186.30.209]:21890 "EHLO snob.metalinkltd.com" ident: "NO-IDENT-SERVICE[2]" whoson: "madlazy@rol.ru" smtp-auth: TLS-CIPHER: TLS-PEER-CN1: ) by gnome06.net.rol.ru with ESMTP id ; Thu, 1 May 2003 13:48:33 +0400 From: Nickolay Kolchin-Semyonov Organization: MediaLTD To: caml-list@inria.fr Subject: Re: [Caml-list] writing images with lablgl Date: Thu, 1 May 2003 12:55:52 +0400 User-Agent: KMail/1.5 References: <20030430102914.20c1a625.Damien.Pous@ens-lyon.fr> <200304301232.36235.snob@metalinkltd.com> <20030501105345.67637c53.Damien.Pous@ens-lyon.fr> In-Reply-To: <20030501105345.67637c53.Damien.Pous@ens-lyon.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200305011255.52398.snob@metalinkltd.com> X-Spam: no; 0.00; nickolay:01 snob:01 caml-list:01 lablgl:01 damien:01 camlgl:01 printf:01 fprintf:01 stdout:01 bin:01 byte:01 int:01 flush:01 images:98 dump:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thursday 01 May 2003 12:53, Damien wrote: > > You can use glReadPixels and glReadBuffer save BACK image from OpenGL > > to memory. Converting pixel data to image format is your task. Just for completness, PPM saving function for camlgl: let dump_screen name = try let f = open_out_bin name in let (x1,y1,x2,y2) = let a = Hgl.ba_int 4 in glGetIntegerv cgl_viewport a; a.{0},a.{1},a.{2},a.{3} in let w = x2 - x1 and h = y2 - y1 in let b = Hgl.ba_byte (w * h * 3) in glReadPixels x1 y1 x2 y2 cgl_rgb cgl_unsigned_byte b; Printf.fprintf f "P6\n%i %i\n255\n" w h; flush f; for y = 1 to h do let sy = (h-y)*w*3 in for x = 0 to w*3 - 1 do output_byte f b.{sy+x} done done; close_out f with _ -> Printf.printf "dumping failed\n"; flush stdout Nickolay ------------------- 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