Re: XForms: Some help about threads and Xforms and OpenGL...

From: Steve Lamont (spl@ncmir.ucsd.edu)
Date: Fri Feb 07 2003 - 15:49:35 EST

  • Next message: Enrico De Filippo: "XForms: Threads and fl_get_input()"

    # To subscribers of the xforms list from Steve Lamont <spl@ncmir.ucsd.edu> :

    > Content-Transfer-Encoding: quoted-printable

    Please - - no MIME junque to the mailing list. It can be difficult to
    decipher with non-MIME text-only mail readers (Yes, I read mail with
    good old virus/worm/trojan/malware-of-the-month-safe text-only `mailx'
    and ain't about to change).

    > Basically, we need to draw continuously a moving object in a glcanvas
    > which is inside one of the application's forms, with lots of other
    > objects (buttons, inputs, etc.).

    I'm not sure I entirely parsed what you're saying but I think I do
    something similar in an application I wrote recently and it seems to
    work.

    In my case, I have four glCanvas objects in a single form that has
    various other controls which affect the rendering of the stuff in the
    glCanvases (I'm rendering three views of a scene along each of the
    major axes plus a perspective view from an arbitrary and user settable
    viewpoint). No reparenting needed.

    Each glCanvas is rendered by a separate POSIX thread. I communicate
    with the child threads from the main thread by a set of mailboxes
    (basically just members of a structure belonging to each thread) and
    mutexes within a data structure. In this case, there's no attempt at
    frame synchronization but adding a mutex could probably handle this.

    You could render into a non-XForms window if you wanted to -- I don't
    see any problem with that.

    OpenGL is inherently multithreaded, so there's nothing special I do to
    make the threads run. Since each thread is rendering into a separate
    glCanvas, each just gets its own GLXContext and off it goes.

    The only thing you need to do is make sure X is running in
    multi-threaded mode and you're already doing that.

                                                            spl
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Fri Feb 07 2003 - 15:50:10 EST