(Fwd) Re: Stereo in a X Window

New Message Reply Date view Thread view Subject view Author view

Tom McReynolds (tomcat++at++proxima.asd.sgi.com)
Mon, 24 Jun 1996 21:54:34 -0700


You shouldn't need to use the XSync() calls. I wrote a stereo demo program
that works with both OpenGL and IrisGL. I'll put it up on the Performer
web-site and post it's location here.

Here's some of the relevant code fragments:

/* left =1 if left channel; 0 if right channel. Shared->stereo != 0 if
   stereo visual could be obtained */

static void
DrawChannel (pfChannel *channel, void *left)
{

    /* rebind light so it stays fixed in position */
    pfLightOn(Sun);

    /* which buffer to draw into ? */
    if(Shared->stereo) { /* if not stereo, draw to left all the time */
        if(*(int*)left) {
#ifdef IRISGL
            leftbuffer(1);
            rightbuffer(0);
#else
            glDrawBuffer(GL_BACK_LEFT);
#endif
        } else {
#ifdef IRISGL
            leftbuffer(0);
            rightbuffer(1);
#else
            glDrawBuffer(GL_BACK_RIGHT);
#endif
        }
    }
    /* erase framebuffer and draw Earth-Sky model */
    pfClearChan(channel);

    /* invoke Performer draw-processing for this frame */
    pfDraw();

    /* draw Performer throughput statistics */

    if (Shared->drawStats)
        pfDrawChanStats(channel);

    /* read window origin and size (it may have changed) */
    pfGetPWinSize(pfGetChanPWin(channel), &Shared->winSizeX,
&Shared->winSizeY);

#ifdef IRISGL
    if (!(WinType & PFPWIN_TYPE_X))
        GetGLInput();
#endif /* GL type */
}

static int FBAttrs[] = {
    PFFB_RGBA,
    PFFB_DOUBLEBUFFER,
    PFFB_STEREO,
    PFFB_DEPTH_SIZE, 23,
    PFFB_RED_SIZE, 1,
    PFFB_STENCIL_SIZE, 1,
    None,
};

/* request a stereo window, and check to see if we got one; NOTE:
   IrisGL erroneously says "yes" regardless. Stereo still functions
   properly if stereo visual is available, however */

static void
OpenPipeWin(pfPipeWindow *pw)
{
    pfPipe *p;
    Window w;
    Display *dsp;
    int stereo;

    /* set up stereo */

    pfPWinFBConfigAttrs(pw, FBAttrs);

    pfOpenPWin(pw);

    (void)pfQueryPWin(pw, PFQWIN_STEREO, &Shared->stereo);

    /* give up if the system doesn't support stereo */

    if(Shared->stereo == PFQFTR_FALSE)
        pfNotify(PFNFY_NOTICE, PFNFY_RESOURCE,
                 "Couldn't get a stereo window; using mono mode");

#ifdef IRISGL
    if (!(WinType & PFPWIN_TYPE_X))
    {
        /* register events of note with event-queue manager */
        qdevice(ESCKEY);
        qdevice(F1KEY);
        qdevice(GKEY);
    }
#endif /* GL type */

    /* create a light source in the "south-west" (QIII) */
    Sun = pfNewLight(NULL);
    pfLightPos(Sun, -0.3f, -0.3f, 1.0f, 0.0f);
}

Hope this helps!

        -Tom

--- Forwarded mail from rainer++at++rus.uni-stuttgart.de

From: "Daniela Rainer" <zrgr0390++at++visin2.rus.uni-stuttgart.de>
Date: Fri, 14 Jun 1996 11:30:32 +0000
In-Reply-To: "Sharon Clay" <src++at++rose.asd.sgi.com>
        "Re: Stereo in a X Window is working now !" (Jun 13, 2:00pm)
Reply-To: rainer++at++rus.uni-stuttgart.de
X-Mailer: Z-Mail (3.2.1 6apr95 MediaMail)
To: "Sharon Clay" <src>
Subject: Re: Stereo in a X Window
Cc: info-performer++at++sgi.com

On Jun 13, 2:00pm, Sharon Clay wrote:
>
> Communicating through X is terribly slow - FYI, you definitey don't want
> to ever be doing an XSync() in your drawing!
> You can just select left and right buffers directly through the GL.
> For IRISGL it is leftbuffer() and rightbuffer() and for
> OpenGL it is glDrawBuffer(GL_BACK_LEFT or GL_BACK_RIGHT).
>
>-- End of excerpt from Sharon Clay

I use IRISGL based Performer with a X Window and the STR_BOT stereo mode.
Can I really use leftbuffer() and rightbuffer() for setting the buffer in a
GLX-window opened with pfuGLXWinopen (it doesn't work in my program)?

Regards

Daniela

--
----------------------------------------------------------------------------
Daniela Rainer

rainer++at++rus.uni-stuttgart.de Tel.: ++49-(0)711-685-5970 ======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com

---End of forwarded mail from rainer++at++rus.uni-stuttgart.de

--
-----{-----{---++at++   -----{----{---++at++   -----{----{---++at++   -----{----{---++at++
Sharon Rose Clay (Fischler) - Silicon Graphics, Advanced Systems Dev.
src++at++sgi.com  (415) 933 - 1002  FAX: (415) 965 - 2658  MS 8U-590
-----{-----{---++at++   -----{----{---++at++   -----{----{---++at++   -----{----{---++at++

---End of forwarded mail from "Sharon Clay" <src++at++rose>

======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer.html Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com


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:53:04 PDT

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