From: Vu Ngoc San <san.vu-ngoc@ujf-grenoble.fr>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Interactive technical computing
Date: Thu, 08 Mar 2007 22:28:40 +0100 [thread overview]
Message-ID: <45F08008.8050800@ujf-grenoble.fr> (raw)
In-Reply-To: <200703081243.35432.jon@ffconsultancy.com>
Jon Harrop a écrit :
> How exactly do you do that? Can you post a complete working example?
>
> Looks great... :-)
>
Thanks :-)
The idea is that sdl (contrary to glut or lablgtk2), does not have a
"main loop": so you can write your own. This allows you to open an
opengl window from the toplevel, and when you quit your mainloop, you
get back nicely to the toplevel. You can even let the window open when
you are back to toplevel, but then the graphics are not updated anymore.
Nice enough: you can later update the sdl window (no need to close it
and open another one !).
If you really need interaction in the window and in the toplevel at the
same time, you can launch the sdl mainloop in a separate thread. It
really works. But I wouldn't try to open two sdl windows at the same
time (??).
I don't have the courage -- and time -- to give you a "working example"
(see below) but the initialisation is like this:
Sdl.init [ `VIDEO ];
Sdlvideo.set_video_mode !window_width !window_height [ `DOUBLEBUF ;
`OPENGL ; `RESIZABLE]);
Sdlwm.set_caption "Oplot - SDL Window" "";
Then you can issue any openGL command you wish. Even from the toplevel !
You can also use Sdlttf to handle any ttf font.
.....
Now, since you sort of asked for it, here it is:
I have written a small graphics library that does all of this. But this
is my first ocaml program, first use of openGL etc.. so I'm not
particularly proud of it. It is quite messy, and in a state of perpetual
development. You can find a (not so recent) version at
http://www-fourier.ujf-grenoble.fr/~svungoc/prog/oplot/index.html
This lib is actually useful (to me) because you can insert LaTeX
formulas and export directly to xfig (or postscript). It produces
postscript of better quality than maple :-)
There is a (very recent) GUI for this at
http://www-fourier.ujf-grenoble.fr/~svungoc/prog/goplot/index.html
which uses lablgtk2 and launches sdl in a separate thread... (yep. my
first use of GTK and of threads.. don't be too harsh if you read my
code... -:) ). However, and even though I'm not a programmer (I do this
for learning ocaml during my spare time), I'd be happy to have some
feedback. There is a package with precompiled binaries that works on at
least three linux machines :-)
San
next prev parent reply other threads:[~2007-03-08 21:28 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-08 1:13 Jon Harrop
2007-03-08 1:49 ` [Caml-list] " Jim Miller
2007-03-08 2:52 ` skaller
2007-03-08 3:00 ` Jim Miller
2007-03-08 3:10 ` skaller
[not found] ` <beed19130703071919g1f537f59o93ce06871fba8f3a@mail.gmail.com>
2007-03-08 3:27 ` skaller
2007-03-08 3:36 ` Jim Miller
2007-03-08 21:16 ` Richard Jones
[not found] ` <45F10E90.5000707@laposte.net>
2007-03-09 7:43 ` Matthieu Dubuget
2007-03-10 14:58 ` Richard Jones
2007-03-08 12:22 ` Gerd Stolpmann
2007-03-08 14:24 ` Christophe TROESTLER
2007-03-08 19:34 ` Jon Harrop
2007-03-08 20:34 ` Christophe TROESTLER
2007-03-09 10:22 ` Jon Harrop
2007-03-09 10:45 ` Christophe TROESTLER
2007-03-08 2:12 ` Erik de Castro Lopo
2007-03-08 12:41 ` [Caml-list] F# Jon Harrop
2007-03-08 11:12 ` [Caml-list] Interactive technical computing Andrej Bauer
2007-03-08 11:59 ` Vu Ngoc San
2007-03-08 12:43 ` Jon Harrop
2007-03-08 21:28 ` Vu Ngoc San [this message]
2007-03-09 0:14 ` skaller
2007-03-08 21:26 Robert Fischer
2007-03-09 0:04 ` skaller
2007-03-09 10:06 ` Jon Harrop
2007-03-09 10:25 ` Jon Harrop
2007-03-10 14:55 ` Richard Jones
2007-03-10 22:07 ` Michael Vanier
2007-03-29 0:33 ` Jon Harrop
2007-03-29 8:41 ` Joel Reymont
2007-03-30 11:31 ` Jon Harrop
2007-03-09 13:33 Robert Fischer
2007-03-09 13:49 ` Jon Harrop
2007-03-09 13:54 ` skaller
2007-03-09 14:13 Robert Fischer
2007-03-09 15:21 ` skaller
2007-03-09 17:26 ` Jon Harrop
2007-03-09 18:50 ` Jon Harrop
2007-03-09 14:21 Robert Fischer
2007-03-09 15:35 Robert Fischer
2007-03-09 17:41 Robert Fischer
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=45F08008.8050800@ujf-grenoble.fr \
--to=san.vu-ngoc@ujf-grenoble.fr \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.com \
/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