From: Damien <Damien.Pous@ens-lyon.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] writing images with lablgl
Date: Thu, 1 May 2003 10:53:45 +0200 [thread overview]
Message-ID: <20030501105345.67637c53.Damien.Pous@ens-lyon.fr> (raw)
In-Reply-To: <200304301232.36235.snob@metalinkltd.com>
> 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
next prev parent reply other threads:[~2003-05-01 8:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-30 8:29 Damien
2003-04-30 8:32 ` Nickolay Kolchin-Semyonov
2003-05-01 8:53 ` Damien [this message]
2003-05-01 8:55 ` Nickolay Kolchin-Semyonov
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=20030501105345.67637c53.Damien.Pous@ens-lyon.fr \
--to=damien.pous@ens-lyon.fr \
--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