From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id D81327F860 for ; Mon, 17 Mar 2014 14:39:20 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of rich.neswold@gmail.com) identity=pra; client-ip=209.85.220.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="rich.neswold@gmail.com"; x-sender="rich.neswold@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of rich.neswold@gmail.com designates 209.85.220.49 as permitted sender) identity=mailfrom; client-ip=209.85.220.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="rich.neswold@gmail.com"; x-sender="rich.neswold@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-pa0-f49.google.com) identity=helo; client-ip=209.85.220.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="rich.neswold@gmail.com"; x-sender="postmaster@mail-pa0-f49.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am0FAMb6JlPRVdwxlWdsb2JhbABZhBiDBoYbuGAlawgWDgEBAQEHDQkJEiqCHQgBAQEDASMdARsdAQMBCwYFCw0CAiYCAiIBEQEFARwZG4VbgW4BAwkIpCmMDlGDDpY9ChknDWSGSxEBBQyBHYVNh3IHgm8PgToBA4lSjnSQQRgphHgf X-IPAS-Result: Am0FAMb6JlPRVdwxlWdsb2JhbABZhBiDBoYbuGAlawgWDgEBAQEHDQkJEiqCHQgBAQEDASMdARsdAQMBCwYFCw0CAiYCAiIBEQEFARwZG4VbgW4BAwkIpCmMDlGDDpY9ChknDWSGSxEBBQyBHYVNh3IHgm8PgToBA4lSjnSQQRgphHgf X-IronPort-AV: E=Sophos;i="4.97,670,1389740400"; d="scan'208";a="52979189" Received: from mail-pa0-f49.google.com ([209.85.220.49]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 17 Mar 2014 14:39:19 +0100 Received: by mail-pa0-f49.google.com with SMTP id lj1so5703994pab.36 for ; Mon, 17 Mar 2014 06:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=H+ySHa8LJqTLDnGQCGaWWjQOz9lIale9CpJQ0gzzGFE=; b=I0WwTN02007hBkbNvZyAb8FWhgpND3WNs0siqKMeiCYTsf2z7SW+J+imbkO8DuguGO mV1OQJJ9DRx1/2JllR2bxxA99lBZfNARTCP18bpBcDiB36HTNKZVTd69cxJbbC9dZwgW XmLOCbzW6m03VPaW+x//FvzFSbJPoO4LpxikCIaQ9aUeixGW/rgjazPrtAzY21QepFDK 09+0Mak1fZchvORR4gSq3+up5etrnSGualt6H/LtDb6oq9V87CVBnHb6HN5gcfmOek3F FW8YUiC4YL/B07xGEpB+GM7N/ht2yHJXPdk99lP/9jKzByJFIlSE75DwmfKd8sEc++Bt 5QhQ== MIME-Version: 1.0 X-Received: by 10.66.139.38 with SMTP id qv6mr8619544pab.123.1395063558290; Mon, 17 Mar 2014 06:39:18 -0700 (PDT) Received: by 10.68.59.7 with HTTP; Mon, 17 Mar 2014 06:39:18 -0700 (PDT) In-Reply-To: <8738ihru8r.fsf@golf.niidar.ru> References: <1732E7D3-C154-4305-90C8-0CC292FE08CF@gmail.com> <8738ihru8r.fsf@golf.niidar.ru> Date: Mon, 17 Mar 2014 08:39:18 -0500 Message-ID: From: Rich Neswold Cc: "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] OpenGL and LWT On Mon, Mar 17, 2014 at 5:32 AM, Ivan Gotovchits wrote: > Unfortunately, I don't know how LabGL is organized. Most OpenGL bindings (including LabGL) include 'libglut', which is a library that is bundled with OpenGL that opens a UI window with an OpenGL context in it. It would be nice to use this library because it hides these details (i.e. the same code runs on Unix and MacOSX and Windows.) Unfortunately, the way libglut works is you call main_loop() which never returns. Before calling main_loop(), you register callbacks for mouse and keyboard events. You can also register a callback for periodic timeouts. Lastly, there's a callback which gets called whenever the libglut main loop is "idle" (with unspecified latencies, frequency, or guarantees.) > If it has an event loop it will be better to incorporate it into main event loop of lwt, as > it was done for lablgtk. Otherwise, I see several solutions. First, use > Lwt_unix jobs, or, if you find it to tedious, just use an async task > (see Lwt.async). What I'll try is to run the GLUT main loop in a async task and when the idle callback is called, I'll call lwt.yield. The keyboard and mouse callbacks can post lwt.react.events. This set-up might work. Thanks! -- Rich