caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@epfl.ch>
To: Jon Harrop <jon@jdh30.plus.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] lablGL and the top-level
Date: Mon, 7 Mar 2005 15:05:02 +0100	[thread overview]
Message-ID: <dbddaa04777ebbd433d4408942f1edf9@epfl.ch> (raw)
In-Reply-To: <200503020818.16207.jon@jdh30.plus.com>

Jon,

Just in case you are not aware your problem is easy to solve if you use 
sdl [1] instead of glut to setup your gl context and handle input. Sdl 
doesn't own your main loop, you can poll or wait for events and then 
continue with your own code.

This simplifies a lot the interaction with the toplevel. For example, 
you can enter a function from the toplevel which will handle user input 
until the user presses escape to return to the toplevel and reenter the 
function later again. Or you can just initialize the context and then 
paint your window from the toplevel without handling the input in the 
window.

The features you loose with respect to glut is menus and multiple 
windows. But with sdl you don't need threads to solve your problem, you 
control the loop and this may be simpler for students (unless you want 
to introduce them to concurrency at the same time...).


A more brittle path to follow (with glut or whatever) which I did not 
investigate deeply is to use the (hidden) Toploop module and to try to 
render and control the toplevel in one of your glut window. However I 
don't know enough about Toploop to be sure you can get to the expected 
result.

Daniel

[1] <http://ocamlsdl.sourceforge.net/>


      parent reply	other threads:[~2005-03-07 14:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-02  8:18 Jon Harrop
2005-03-02  8:48 ` [Caml-list] " Jacques GARRIGUE
2005-03-07 14:05 ` Daniel Bünzli [this message]

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=dbddaa04777ebbd433d4408942f1edf9@epfl.ch \
    --to=daniel.buenzli@epfl.ch \
    --cc=caml-list@inria.fr \
    --cc=jon@jdh30.plus.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;
as well as URLs for NNTP newsgroup(s).