Browse thread
[Caml-list] writing images with lablgl
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Damien <Damien.Pous@e...> |
| Subject: | Re: [Caml-list] writing images with lablgl |
> 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