caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Neswold <rich.neswold@gmail.com>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] OpenGL and LWT
Date: Mon, 17 Mar 2014 17:50:20 -0500	[thread overview]
Message-ID: <2F20BDD4-4475-4250-921F-E4CDB34BFD86@gmail.com> (raw)
In-Reply-To: <3B63CC7A2A994E018E1EC2E450E0FFF4@erratique.ch>

> On Mar 17, 2014, at 9:05 AM, Daniel Bünzli <daniel.buenzli@erratique.ch> wrote:
> I wouldn't use glut which is no longer bundled on osx, is quite limited in functionality and reclaims your main loop. Use SDL, it provides similar functionality to setup an OpenGL context in a platform independent way but it doesn't reclaim control on your main() which will make integration with lwt trivial.

The SDL libraries look much better to use. Thanks for the suggestion!

Sorry, though. I'm still not fully understanding how to interface the two. I see that, in SDL, I can call Tsdl.Sdl.wait_event to block and wait for events to get posted. But in what context should I call this function? In my LWT environment, this would block the entire application. Lwt.Async threads would also do that. I could use 'detach' to use an OS thread, but then I'm back to the same problem as libglut: a secondary thread needs to communicate with the main LWT environment which itself can't make SDL calls since the secondary thread "owns" the SDL context.

I could have an Lwt thread call Sdl.poll_event and then go to sleep if no events were available, but I'm trying to make this driven by events and not resort to polling, if possible.

I must be missing some detail in getting these libraries to work together trivially. Sorry for my misunderstanding.

--
Rich

  parent reply	other threads:[~2014-03-17 22:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-15 17:37 Richard Neswold
2014-03-17 10:09 ` Jeremie Dimino
2014-03-17 10:32   ` Ivan Gotovchits
2014-03-17 13:39     ` Rich Neswold
2014-03-17 14:05       ` Daniel Bünzli
2014-03-17 14:13         ` Daniel Bünzli
2014-03-17 22:50         ` Richard Neswold [this message]
2014-03-17 23:50           ` Daniel Bünzli
2014-03-19 12:01             ` Rich Neswold
2014-03-17 10:34   ` Török Edwin
2014-03-17 11:01     ` Daniel Bünzli

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=2F20BDD4-4475-4250-921F-E4CDB34BFD86@gmail.com \
    --to=rich.neswold@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /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).