Re: three-pipe operation using the Triple Keyboard Option

New Message Reply Date view Thread view Subject view Author view

Allan Schaffer (aschaffe)
Thu, 19 Oct 1995 13:10:32 -0700


On Oct 19, 2:38pm, Daniel C. Williams X-2453 wrote:
>
> I'm trying to get Performer1.2 to run in multipipe, multiple channel
> mode when using the Triple Keyboard Option on my client's 3-pipe
> RE2. That is, when running three X servers as :0, :1 and :2 instead
> of one X server as :0.0, :0.1 and :0.2.

> When I run in non-TKO mode and the display strings are :0.0, :0.1 and :0.2,
> it works fine. When I run in TKO mode and the display strings are
> :0, :1 and :2, it fails with this stack trace when it tries to open the
> second pipe:
>
> Am I doing something wrong, or is this a limitation of Performer1.2?
> If the latter, will it be addressed by Performer2.0?

This is ultimately a shortcoming of Performer 1.2; I haven't tried it
with Performer 2.0 but think it should work better there.

I'm inclined to believe the bus errors you get come from using
XOpenDisplay outright. I've been able to get it to work by using
putenv("DISPLAY=:0"); [and :1, :2 etc] in 3 separate initPipe
routines, which is more hackishly indirect than XOpenDisplay().

I'll include the toy program I used to test below, based on
multipipe.c. It's not clean but you'll get the idea. Two
things to remember:

  - the 'putenv()' must precede any calls from the GL library
    (including 'foreground')

  - remember to 'winset' to the correct window in the draw callback

Allan

--------------

/*
 * multipipe.c: simple Performer program to demonstrate use of
 * multiple pfPipe's. based on simple.c
 *
 * $Revision: 1.5 $ $Date: 1994/03/16 01:59:46 $
 *
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <gl/device.h>

#include <Performer/pf.h>
#include "pfsgi.h"

static void OpenPipeline1 (pfPipe *p);
static void OpenPipeline2 (pfPipe *p);

int win1, win2;

/*
 * Usage() -- print usage advice and exit. This
 * procedure is executed in the application process.
 */
static void
Usage (void)
{
    fprintf(stderr, "Usage: multipipe file.ext ...\n");
    exit(1);
}

void Draw0(pfChannel *chan)
{
        winset(win1);
        pfClearChan(chan);
        pfDraw();
}

void Draw1(pfChannel *chan)
{
        winset(win2);
        pfClearChan(chan);
        pfDraw();
}

int
main (int argc, char *argv[])
{
    float t = 0.0f;
    pfScene *scene;
    pfPipe *pipe[2];
    pfChannel *chan[2];
    pfNode *root;
    pfSphere bsphere;
    int loop;

    if (argc < 2)
        Usage();

    /* Initialize Performer */
    pfInit();

    /* specify the number of pfPipes */
    pfMultipipe (2);

    /* Use default multiprocessing mode based on number of
     * processors.
     */
    pfMultiprocess(PFMP_DEFAULT);

    /* Configure multiprocessing mode and start parallel
     * processes.
     */
    pfConfig();

    /* Append to PFPATH additional standard directories where
     * geometry and textures exist
     */
    pfFilePath(".:/usr/src/Performer/data");

    /* Read a single file, of any known type. */
    if ((root = LoadFile(argv[1], NULL)) == NULL)
    {
        pfExit();
        exit(-1);
    }

    /* Attach loaded file to a pfScene. */
    scene = pfNewScene();
    pfAddChild(scene, root);

    /* determine extent of scene's geometry */
    pfGetNodeBSphere (scene, &bsphere);

    /* Create a pfLightSource and attach it to scene. */
    pfAddChild(scene, pfNewLSource());

            pipe[0] = pfGetPipe(0);
            pipe[1] = pfGetPipe(1);
            pfInitPipe(pipe[0], OpenPipeline1);
            pfInitPipe(pipe[1], OpenPipeline2);

    /* Create and configure pfChannels. */
    for (loop=0; loop < 2; loop++)
    {
            chan[loop] = pfNewChan(pipe[loop]);
            pfChanScene(chan[loop], scene);
            pfChanNearFar(chan[loop], 1.0f, 10.0f * bsphere.radius);
            pfChanFOV(chan[loop], 45.0f, 0.0f);
    }

pfChanDrawFunc(chan[0], Draw0);
pfChanDrawFunc(chan[1], Draw1);

    pfInitClock (0.0f);

    /* Simulate for twenty seconds. */
    while (t < 20.0f)
    {
        float s, c;
        pfCoord view;

        /* Go to sleep until next frame time. */
        pfSync();

        /* Compute new view position. */
        t = pfGetTime();
        pfSinCos(45.0f*t, &s, &c);
        pfSetVec3(view.hpr, 45.0f*t, -10.0f, 0);
        pfSetVec3(view.xyz, 2.0f * bsphere.radius * s,
                -2.0f * bsphere.radius *c,
                 0.5f * bsphere.radius);

        for (loop=0; loop < 2; loop++)
                pfChanView(chan[loop], view.xyz, view.hpr);

        /* Initiate cull/draw for this frame. */
        pfFrame();
    }

    /* Terminate parallel processes and exit. */
    pfExit();

    return 0;
}

/*
 * OpenPipeline() -- create a GL window: set up the
 * window system, IRIS GL, and IRIS Performer. This
 * procedure is executed in the draw process (when
 * there is a separate draw process).
 */
static void
OpenPipeline1 (pfPipe *p)
{
putenv ("DISPLAY=:1");
    /* Open graphics window. */
    foreground();
    prefposition(100, 500, 100, 500);
    win1 = winopen("foo");

    /* Configure window with reasonable defaults. */
    pfInitGfx(p);

    /* Create and apply a default material for those models
     * without one.
     */
    pfApplyMtl(pfNewMtl(pfGetSharedArena()));

    /* Create a default lighting model. */
    pfApplyLModel(pfNewLModel(pfGetSharedArena()));
}

static void
OpenPipeline2 (pfPipe *p)
{
    /* Open graphics window. */

putenv ("DISPLAY=:2");
    foreground();
    prefposition(500, 900, 500, 900);
    win2=winopen("IRIS Performer");

    /* Configure window with reasonable defaults. */
    pfInitGfx(p);

    /* Create and apply a default material for those models
     * without one.
     */
    pfApplyMtl(pfNewMtl(pfGetSharedArena()));

    /* Create a default lighting model. */
    pfApplyLModel(pfNewLModel(pfGetSharedArena()));
}

-- 
Allan Schaffer                                             aschaffe++at++sgi.com
Silicon Graphics                  http://reality.sgi.com/employees/aschaffe

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:58 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.