From renee@pat.mdc.com  Thu Oct  7 11:57:21 1993
From: Renee Strong <renee@pat.mdc.com>
Message-Id: <9310071857.AA24741@pat.mdc.com>
Subject: cameras and lights
To: info-performer@sgi.sgi.com
Date: Thu, 7 Oct 93 13:57:13 CDT
X-Mailer: ELM [version 2.3 PL11]
Status: OR


Our analysts need to attach cameras and lights to models.  I'd like to make
cameras (I guess that should be pfChannels) and lights  children of pfDCS
nodes and have the position and direction come from the pfDCS node.  Is this
possible?  Right now I can't even get a light to turn on with pfLightOn.  It
just core dumps.  It also core dumps when I try to attach a light to a pfDCS.

Thanks,
Renee Strong
renee@pat.mdc.com



From jrohlf@tubes  Thu Oct  7 12:12:21 1993
Date: Thu, 7 Oct 93 12:12:12 -0700
From: jrohlf@tubes (John Rohlf)
Message-Id: <9310071912.AA01249@tubes.asd.sgi.com>
To: Renee Strong <renee@pat.mdc.com>, info-performer@sgi.sgi.com
Subject: Re:  cameras and lights
Status: OR


>Our analysts need to attach cameras and lights to models.  I'd like to make
>cameras (I guess that should be pfChannels) and lights  children of pfDCS
>nodes and have the position and direction come from the pfDCS node.  

A pfLightSource node will inherit the position and direction of a pfDCS 
node. A pfChannel is not a node so you cannot add it to a pfDCS. You must
set the pfChannel view matrix with pfChanViewMat() at the same time
you call pfDCSMat().







From guest  Mon Feb 14 20:54:06 1994
Return-Path: <wry@dimwit.dst.nk-exa.co.jp>
Date: Tue, 15 Feb 94 13:35:06 +0900
From: wry@dimwit.dst.nk-exa.co.jp (Masahiko Yamanaka)
Message-Id: <9402150435.AA00991@dimwit.dst.nk-exa.co.jp>
To: info-performer%sgi.sgi.com@sgitokyo.nsg.sgi.com
Subject: MultiChannel in singlePipe
Status: OR


I am using 2 pfChannels.
One is main channel, another is sub channel( toggles show/hide, a part of the window ).

As I use following,

pfChanDrawFunc( mainChannel, mainDrawChanCB );
pfChanDrawFunc( subChannel, subDrawChanCB );

then rendering is occured as following( slow ).

1. draw main
2. swapbuffers
3. draw sub
4. swapbuffers

I would like to do this as following( fast ).

1. draw main
2. draw sub
3. swapbuffers

If I don't use pfChanDrawFunc( mainChannel, mainDrawChanCB ), I can get fast one.

But, many processes must be done in mainChannel, because subChannel may disappear.

How can I do this well?

I'm using IRIX4.0.5/CrimsonVGX with Performer1.0.

Thanks.
--
Masahiko Yamanaka











From guest  Tue Feb 15 01:53:23 1994
From: "Ran Yakir" <rany@bvr.co.il>
Message-Id: <9402151152.ZM9341@fred.bvr.co.il>
Date: Tue, 15 Feb 1994 11:52:13 +0000
X-Mailer: Z-Mail (3.0B.0 25aug93 MediaMail)
To: info-performer@sgi.sgi.com
Subject: pfChanFOV
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Status: OR

Hi

I'm using a beta release of Performer 1.2.
It seems that pfChanFOV (chan, horiz, vert), always sets the vertical fov to
comply with the horizontal fov and the dimensions of the viewport. According to
the man page, this should not be the case if I specify both the horizontal and
the vertical fov. The automatic setting of the vertical fov should happen only
if it is defined as -1.0.
Is this a bug, or a still undocumented feature ?

bye

Ran

-- 
 __                                  | Ran Yakir
 /_)  _  __   \  / _   / o __        | Phone :
/ )_ (_(_) )   \/ (_(_/<_(_)(        |   Work : 972-3-5715671
              _/                     |   Res. : 972-3-6995364
                                     | E-mail : rany@bvr.co.il





From guest  Thu Jun  9 10:39:34 1994
Message-Id: <9406091837.ZM2284@unknown.zmail.host>
Date: Thu, 9 Jun 1994 18:37:40 +0100
In-Reply-To: "Carlo L. Tiana" <carlo@vision.arc.nasa.gov> "Movie generation/format conversion" (Jun 9, 9:37am)
References: <199406091637.JAA28788@descartes.arc.nasa.gov>
X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
To: info-performer@sgi.sgi.com
Subject: How to black out a channel
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Status: OR

Hi

I'm in the midle of making a multi-user Performer demo.
I have up to 4 channels, each representing a different users
viewpoint.  I have a VTX, with an MCO, so all the channels
render to the same virtual screen, and I then send the video to
diffreent monitors (up to 4), via an MCO.  I have set
things up so that all channels share thins like SWAPBUFFERS,
EARTHSKY etc..  At various points within the application I wish to turn
off arbitrary channels.  I would like the view point in these channels to
be then set to black (or some other constant colour).  My
question is, how do I do that.  I tried

 pfChanTravMode ( chan, PFTRAV_DRAW, PFDRAW_OFF);

but this only stops any more rendering.

I also tried having

 pfChanShare (chan, PFCHAN_SWAPBUFFERS);

pfClearChan(chan);

for two frames before the rendering stops, to clear the
channel, but that did not seem to work.
Anyway, I'm sure there is a simple way to do what I want.
Anyone know how?  I suppose I could just write the data
r,g,b=0,0,0
by hand into the frame buffer) but is there
an easier way.

Thanks
Richard Gallery




From guest  Tue Jun 14 08:54:34 1994
Date: Tue, 14 Jun 94 08:54:29 -0700
From: stimpy@niesten.arc.nasa.gov (William Briggs)
Message-Id: <9406141554.AA05891@niesten.arc.nasa.gov>
To: info-performer@sgi.sgi.com
Subject: Re: How to black out a channel
Status: O

We are working on a VGXT, no RE (yet!), running Performer 1.0

The way we clear the channel is by setting a Draw callback with
  pfChanDrawFunc( channel, drawfunction ).
We allocate a PassData structure which holds a "clear channel only" flag with
  pfAllocChanData( channel, sizeof( PassData ) ).
In drawfunction we call 
  pfClearChan( channel )
and return if the "clear channel only" flag is set, otherwise render 
the channel.

-------------------+------------------------------+------------------------
William Briggs     | MailStop 262-2               | "The computer screen
NASA Ames Research | PO Box 1000                  |  has become the retina
(415) 604-6438     | Moffett Field, CA 94035-1000 |  of the mind's eye." 
-------------------+------------------------------+------------------------




From guest  Thu May 19 15:26:20 1994
Message-Id: <9405191111.ZM24648@unknown.zmail.host>
Date: Thu, 19 May 1994 11:11:58 +0100
In-Reply-To: aschaffe@holodeck.asd.sgi.com (Allan Schaffer) "IRIS Performer 1.2 released!" (Mar 23, 5:23pm)
References: <9403240123.AA06427@holodeck.asd.sgi.com>
X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
To: info-performer@sgi.sgi.com
Subject: How to relect/mirror a Performer window
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Status: O

Hi

I have an application where I wish to relect or mirror
the viewport of a Performer window.  Specifically, I
need to do this for a home-grown HMD that requires
mirrored images for correct display, but also I can
imagine situations such as a car simulator, in which
the user sees a mirrored image representing the view
out the back window of the car simulator that they are
driving, in which it would be necessary to do this.

Anyone have any suggestions

Thanks
Richard



From guest  Thu May 19 20:45:39 1994
From: aschaffe (Allan Schaffer)
Message-Id: <9405192033.ZM11678@holodeck.asd.sgi.com>
Date: Thu, 19 May 1994 20:33:19 -0700
In-Reply-To: Richard Gallery <gallery@prl.philips.co.uk>
        "How to relect/mirror a Performer window" (May 19, 11:11am)
References: <9403240123.AA06427@holodeck.asd.sgi.com> 
	<9405191111.ZM24648@unknown.zmail.host>
X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
To: Richard Gallery <gallery@prl.philips.co.uk>, info-performer@sgi.sgi.com
Subject: Re: How to relect/mirror a Performer window
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Status: OR

On May 19, 11:11am, Richard Gallery wrote:
>
> I have an application where I wish to relect or mirror
> the viewport of a Performer window.  Specifically, I
> need to do this for a home-grown HMD that requires
> mirrored images for correct display, but also I can
> imagine situations such as a car simulator, in which
> the user sees a mirrored image representing the view
> out the back window of the car simulator that they are
> driving, in which it would be necessary to do this.

I haven't considered all of the possible side effects, but
you might try:

	pfScale(-1.0,1.0,1.0);

before pfDraw() in your channel draw callback.
Upon casual inspection, this seems to work ok..

You'll want to disable backface removal as well.
(You could -enable- frontface removal, though)

Allan



-- 
Allan Schaffer
Silicon Graphics
aschaffe@sgi.com



From guest  Fri Jun  3 08:06:31 1994
From: "Michael Jones" <mtj@babar>
Message-Id: <9406030806.ZM29961@babar.asd.sgi.com>
Date: Fri, 3 Jun 1994 08:06:21 -0700
In-Reply-To: Richard Gallery <gallery@prl.philips.co.uk>
        "How to relect/mirror a Performer window" (May 19, 11:11am)
References: <9403240123.AA06427@holodeck.asd.sgi.com> 
	<9405191111.ZM24648@unknown.zmail.host>
X-Mailer: Z-Mail (3.1.0 22feb94 MediaMail)
To: Richard Gallery <gallery@prl.philips.co.uk>, info-performer@sgi.sgi.com
Subject: Re: How to relect/mirror a Performer window
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Status: O

On May 19, 11:11am, Richard Gallery wrote:
> Subject: How to relect/mirror a Performer window
:Hi
:
:I have an application where I wish to relect or mirror
:the viewport of a Performer window.  Specifically, I
:need to do this for a home-grown HMD that requires
:mirrored images for correct display, but also I can
:imagine situations such as a car simulator, in which
:the user sees a mirrored image representing the view
:out the back window of the car simulator that they are
:driving, in which it would be necessary to do this.

Several ideas are at work here. Pick and choose from:

1. Compute a mirror projection DCS and change the
    culling mode to be the opposite: cull-front and draw
    back faces.

2. Compute the virtual eyepoint and render a channel
    with that eyepoint. Like this:

     + virtual eye
      \
        \
    -------- mirror
        /
      /
     + normal eye


-- 

Be seeing you,      Phone:415.390.1455  Fax:415.390.2658 M/S:9U-590
Michael T. Jones    Silicon Graphics, Advanced Graphics Division
mtj@sgi.com         2011 N. Shoreline Blvd., Mtn. View, CA 94039-7311






From guest  Fri Nov 19 03:27:13 1993
From: "Stephen Joyce {75069}" <shj@swlvx2.msd.ray.com>
Message-Id: <9311182024.AA24446@swlrgk>
To: info-performer
Status: ORS

Does anyone know if stereo capability is going to be 
present in Performer 1.2?

Thanks,
Steve Joyce



From guest  Sun Dec 19 17:55:16 1993
Message-Id: <9312200155.AA00497@surreal.asd.sgi.com>
To: "Stephen Joyce {75069}" <shj@swlvx2.msd.ray.com>
Cc: info-performer@sgi.sgi.com
In-Reply-To: Your message of "Fri, 17 Dec 93 16:21:46 EST."
             <9312172121.AA06183@swlrgk> 
Date: Sun, 19 Dec 93 17:55:09 -0800
From: Jim Helman <jimh@surreal>
Status: ORS

Performer already supports multiple channels quite nicely.

Performer 1.2 adds support for off-axis viewing frusta, which
are needed for proper stereo rendering.  In 1.2, pfChannels
supports pfMakePerspFrust() which is like the GL window()
function.  You could do this under 1.0/1.1 but it was tricky to
get the culling volume correct.

Beyond that stereo is entirely a matter of setting up the
viewing parameters.  For the general case of an arbitrary eye
position w.r.t. the monitor, Michael Deering's SIGGRAPH paper
from 1992 is a good reference (except for its unfortunate use
of PHIGS notation).

rgds,

-jim helman

jimh@surreal.asd.sgi.com
415/390-1151






From guest  Tue Jan 25 10:28:35 1994
Message-Id: <9401251828.AA08502@surreal.asd.sgi.com>
To: Mark Visconti <visconti@cis.ohio-state.edu>
Cc: info-performer@sgi.sgi.com
In-Reply-To: Your message of "Tue, 25 Jan 94 10:14:57 EST."
             <199401251514.KAA06701@anaconda.cis.ohio-state.edu> 
Date: Tue, 25 Jan 94 10:28:20 -0800
From: Jim Helman <jimh@surreal>
Status: OR


There isn't an easy, clean way to do off-axis viewing frusta in 1.0/1.1.

pfChanViewMat only provides an eyepoint and orientation.  It says
nothing about the projection matrix.  You can set up your own
projection matrix in the channel draw callback by calling the GL
window command directly.  However, you also have to change your
culling frustum, which in 1.0/1.1 must be syummetric, so that it
includes the off-axis one.  You can do this by changing the 
orientation and symmetric FOV of the pfChannel.

Here's what the matrix stack looks like in 1.0/1.1  when your 
channel draw callback is invoked:

    window(winLeft, winRight, winBottom, winTop, near, far);

    mmode(MVIEWING);

    pfMatrix invViewMatrix;
    pfInvertOrthoNMat(invViewMatrix, viewMatrix);
  
    loadmatrix(ident);
    rot(-90, 'x');	    // Convert from GL Z-out, Y-up to viskit
			    // Y-in, Z-up.
    multmatrix(invViewMatrix);

1.2 supports off-axis frusta, so you won't need to hack the stack.

rgds,

-jim helman

jimh@surreal.asd.sgi.com
415/390-1151






From guest  Tue Jan 25 07:15:08 1994
Message-Id: <199401251514.KAA06701@anaconda.cis.ohio-state.edu>
To: info-performer@sgi.sgi.com
Status: OR

Subject: Beginner Performer Question

   Hi all,

     I'm trying to duplicate GL's window() call using Performer.
Normally, one would set up each channel with pfChanFOV, but I can not
use a vertically symmetric FOV for this application.  For example, 
the GL code would be

near   = 20.0f; far = 2000.0f;
left   = -tan(10.0*DEG2RAD)*near;
bottom = -tan(16.0*DEG2RAD)*near;
top    = tan(25.0*DEG2RAD)*near;
window(left, -left, bottom, top, near, far);

   Can I use pfMakePerspFrustum and then send the matrix to pfChanViewMat ?
What is the easiest way to do this on a multichannel/pipe system where two
sets of views use a different viewing frustum ?  How does pfChanViewMat
function ?  Do I need to apply the necessary viewpoint rotations and
translations before passing the matrix to pfChanViewMat ?  My _guess_
is for each channel, do a pfMakePerspFrustum, apply the rotations and
translations to the output matrix, and pass the result to pfChanViewMat.
I'd try this, but our system is in use and I'm developing offline.
   I could not find similar examples in the Performer Programming Guide
nor in the Performer FAQ.

Thank you for any assistance,
Mark Visconti






From guest  Mon Apr 11 11:40:29 1994
Message-Id: <9404111836.AA27022@sgi.sgi.com>
Date: 11 Apr 94 14:18:00 EST
From: "Robert Reif" <reif@ntsc-rd.navy.mil>
Subject: Stereo perfly source still available?
To: "info-performer" <info-performer@sgi.sgi.com>
Status: OR

Is the stereo version of perfly (sfly.tar) that was on sgi.com a while
back still available by anonymous ftp somewhere?

Robert Reif
reif@ntsc-rd.navy.mil




From guest  Wed Mar  9 15:04:54 1994
From: fraser@BanffCentre.AB.CA (Glen Fraser)
Message-Id: <9403092254.AA15169@moose.BanffCentre.AB.CA>
Subject: pfFrustums and pfChannels
To: iris-performer@sgi.sgi.com
Date: Wed, 9 Mar 1994 15:54:28 -0700 (MST)
X-Mailer: ELM [version 2.4 PL22]
Content-Type: text
Content-Length: 892       
Status: OR

I am using Performer 1.1 on an Onyx RE2.  I am trying to do off-axis
perspective.  How can I do this with 1.1?  Is there a call like
pfSetChanFrust(pfChannel *chan, pfFrustum *frust) which would
  ---
facilitate this?

A previous message seemed to indicate that one could use
pfMakePerspFrust(), which sets up a pfFrustum.  Are pfFrustums and
pfChannels compatible enough to be used in this way?  Is this a valid
way of assigning an asymmetric viewing frustum to a channel?

Thanks,
Glen.

------------------------------------------------------------------
| Glen D. Fraser                 | fraser@banffcentre.ab.ca      |
|  Work: (403)762-6669           |                               |
| Virtual Reality Developer      | "Let it well be known,        |
| The Banff Centre for the Arts  |  These opinions are my own."  |
------------------------------------------------------------------





From guest  Wed Mar  9 15:18:48 1994
Return-Path: <flip@cgrg.ohio-state.edu>
Date: Wed, 9 Mar 94 18:17:40 EST
From: flip@cgrg.ohio-state.edu (Flip Phillips)
Message-Id: <9403092317.AA03725@sap.cgrg.ohio-state.edu>
To: fraser@BanffCentre.AB.CA
Cc: iris-performer@sgi.sgi.com
In-Reply-To: <9403092254.AA15169@moose.BanffCentre.AB.CA> (fraser@BanffCentre.AB.CA)
Subject: Re: pfFrustums and pfChannels
Status: O


   From: fraser@BanffCentre.AB.CA (Glen Fraser)
   Date: Wed, 9 Mar 1994 15:54:28 -0700 (MST)

   I am using Performer 1.1 on an Onyx RE2.  I am trying to do off-axis
   perspective.  How can I do this with 1.1?  Is there a call like
   pfSetChanFrust(pfChannel *chan, pfFrustum *frust) which would
     ---

not available 'til v1.2 I believe.


-- flip




From guest  Wed Mar  9 19:24:19 1994
From: jrohlf@tubes (John Rohlf)
Message-Id: <9403100324.AA22011@tubes.asd.sgi.com>
Subject: Re: pfFrustums and pfChannels
To: guest (Flip Phillips)
Date: Wed, 9 Mar 94 19:24:07 PST
Cc: fraser@BanffCentre.AB.CA, iris-performer@sgi.sgi.com
In-Reply-To: <9403092317.AA03725@sap.cgrg.ohio-state.edu>; from "Flip Phillips" at Mar 9, 94 6:17 pm
X-Mailer: ELM [version 2.3 PL8]
Status: O

> 
> 
>    From: fraser@BanffCentre.AB.CA (Glen Fraser)
>    Date: Wed, 9 Mar 1994 15:54:28 -0700 (MST)
> 
>    I am using Performer 1.1 on an Onyx RE2.  I am trying to do off-axis
>    perspective.  How can I do this with 1.1?  Is there a call like
>    pfSetChanFrust(pfChannel *chan, pfFrustum *frust) which would
>      ---
> 
> not available 'til v1.2 I believe.
> 
> 
> -- flip
> 

	This is correct. In 1.2, pfChannel is "derived" from pfFrustum 
so you can call pfMakePerspFrust on a pfChannel.






From guest  Thu Mar 10 00:36:58 1994
Message-Id: <9403100836.AA19690@surreal.asd.sgi.com>
To: fraser@banffcentre.ab.ca (Glen Fraser)
Cc: info-performer@sgi.sgi.com
Subject: Re: pfFrustums and pfChannels 
In-Reply-To: Your message of "Wed, 09 Mar 94 15:54:28 MST."
             <9403092254.AA15169@moose.BanffCentre.AB.CA> 
Date: Thu, 10 Mar 94 00:36:43 -0800
From: Jim Helman <jimh@surreal>
Status: O

  
>  I am using Performer 1.1 on an Onyx RE2.  I am trying to do off-axis
>  perspective.  How can I do this with 1.1?  Is there a call like
>  pfSetChanFrust(pfChannel *chan, pfFrustum *frust) which would

Doing off-axis work in 1.1 requires that you set the 
channel viewpoint and FOV so that the on-axis frustum
used for culling, encompasses the off-axis frustum you
really want.

Then in the channel draw callback, set the GL matrix
perspective and viewing matrices appropriately.  Here's
how 1.1 initializes them by default:

        window(winLeft, winRight, winBottom, winTop, near, far);
	mmode(MVIEWING);
	loadmatrix(ident);
	rot(-90, 'x');	/* convert from GL to Performer coords */
	{
	    pfMatrix invViewMat;
	    pfOrthoNInvertMat(invViewMat, ViewMat);
	    multmatrix(invViewMat);
	}	


rgds,

-jim helman

jimh@surreal.asd.sgi.com
415/390-1151









From guest  Wed Mar  9 14:14:59 1994
Message-Id: <199403092214.RAA08435@favorite.cis.ohio-state.edu>
To: iris-performer@sgi.sgi.com
Subject: pfMakePerspFrust
Status: OR


   I'm running 1.2beta on an Onyx RE^2.   I need off-axis perspective views
so I am using pfMakePerspFrust().  I'm was not getting the desired results
so I called pfGetFrustFOV and pfGetFrustNearFar to verify the values.
While near and far matched, the horizontal and vertical field of view
differed from the values I passed.  I am not using pfFrustAutoAspect() and
checked to make sure the default was PFFRUST_CALC_NONE.
   Am I going about this the wrong way ?

Thanks,
Mark Visconti
LTSI, WPAFB, Dayton, OH



From guest  Tue Mar 22 10:41:53 1994
From: jrohlf@tubes (John Rohlf)
Message-Id: <9403221841.AA13019@tubes.asd.sgi.com>
Subject: Re: pfMakePerspFrust
To: guest (Mark Visconti)
Date: Tue, 22 Mar 94 10:41:43 PST
Cc: iris-performer@sgi.sgi.com
In-Reply-To: <199403092214.RAA08435@favorite.cis.ohio-state.edu>; from "Mark Visconti" at Mar 9, 94 5:14 pm
X-Mailer: ELM [version 2.3 PL8]
Status: O


>    I'm running 1.2beta on an Onyx RE^2.   I need off-axis perspective views
> so I am using pfMakePerspFrust().  I'm was not getting the desired results
> so I called pfGetFrustFOV and pfGetFrustNearFar to verify the values.
> While near and far matched, the horizontal and vertical field of view
> differed from the values I passed.  I am not using pfFrustAutoAspect() and
> checked to make sure the default was PFFRUST_CALC_NONE.
>    Am I going about this the wrong way ?

	No, I think I screwed up the API in this particular area. By 
default, a pfChannel has PFFRUST_CALC_VERT auto aspect so 
when you call pfMakePerspFrust the vertical FOV will be tweaked. 
Contrary to what you might think, calling pfFrustAspect does not change 
the auto aspect value of the pfChannel. Also, pfFrustAspect is 
improperly implemented now since it implies that it is set and 
forget but it has lasting effect, ie.- it really does to the work of
a "pfFrustAutoAspect". 

	The following should work:

	pfChanAutoAspect(chan, PFFRUST_CALC_NONE);
	pfFrustNearFar(chan, n, f);
	pfMakePerspFrust(chan, l, r, b, t);


Sorry for any confusion.






From guest  Tue Mar 22 08:42:03 1994
Date: Tue, 22 Mar 94 08:41:07 -0800
From: mars@clubted.csd.sgi.com (David Marsland)
Message-Id: <9403221641.AA08273@clubted.csd.sgi.com>
To: shj@swlvx2.msd.ray.com
Subject: Stereo code examples for Onyx/RE?
Cc: info-performer@sgi.sgi.com
Status: OR


I'm passing on this request for Steve Joyce.  Please respond to him at
shj@swlvx2.msd.ray.com if you have any Onyx/RE stereo examples you'd
like to share.  Sorry if this is an FAQ.

Steve, if you would like to join this mailing group you can send mail
to info-performer-request@sgi.com.

Steve Joyce wrote:
(stuff deleted)
> an Onyx example of stereo viewing that you knew of when I raised the
> question at the end of class. I'm in general looking for some examples of
> stereo viewing programs if you happen to know of any (besides a couple
> in 4Dgifts).
> 
>  Thanks for any help -
> 
> Steve Joyce 
> 
/* David Marsland                       "On Spaceship Earth       *
 * MTS, Worldwide Education R&D          there are no passengers, *
 * Silicon Graphics Computer Systems     only crew."              *
 * Internet: mars@csd.sgi.com                 Buckminster Fuller  */




From guest  Tue Mar 22 09:09:34 1994
Date: Tue, 22 Mar 94 09:08:47 -0800
From: ib@ivan (Ivan Bach)
Message-Id: <9403221708.AA17990@ivan.asd.sgi.com>
To: mars@clubted.csd.sgi.com (David Marsland), shj@swlvx2.msd.ray.com
Subject: Re:  Stereo code examples for Onyx/RE?
Cc: mars@csd.sgi.com, info-performer@sgi.sgi.com
Status: O

Article: 274 of comp.sys.sgi.hardware
Subject: General info about SGI stereo (was: How does one use stereo goggles?)
Message-ID: <C1vv1n.Gt6@news.cso.uiuc.edu>
Date: 3 Feb 93 17:24:59 GMT
Organization: University of Illinois at Urbana

In article <1kn5jqINNqs0@darkstar.UCSC.EDU> gross@maxwell.ucsc.edu 
(Mike Gross) writes:
>    One of the researchers in our department recently bought a pair of stereo
> goggles for our SGI Crimson, but I haven't been able to find anyone in this
> university who knows how to use them. I'm interested primarily in using
> the goggles with Explorer (assuming this is possible), but I'm also
interested
> in finding out how to adapt existing GL programs to use the goggles. Does
> anyone out there have any idea how to get this working? The goggles came
> without an ounce of documentation, and SGI hasn't been very helpful, either.
> Any help is appreciated.
>
>    If you followup to this post, please e-mail me a copy, too.
>
> Mike Gross
> Physics Board and Lick Observatory
> Univ of California                             GO SLUGS!!!!!
> Santa Cruz, CA 95064
> gross@lick.ucsc.edu

Here is a quick general description of how the SGI stereo goggles work, for
those who do not know much about them, and what must be done to have your
programs use them:

First of all, in order to see stereo images on your SGI monitor, you need to
have both the glasses AND special stereo hardware installed in your machine.
Just buying some glasses will not allow you to see in stereo.  So if your
computer did not come already equipped for stereo display, the glasses won't
help any.

Second, here is the general method used by the stereo system:  connected to the
SGI is an infrared emitter, which you place generally on top of or right next
to your monitor.  The glasses have a detector on them that senses the signal
being put out by this emitter.  In your program (or from the Unix command
prompt) you issue a command to switch the monitor into stereo mode; this
changes the frequency of screen updates from 60 times/sec to 120 times/sec.
Thus, the monitor updates the screen twice as fast as it does in non-stereo
mode.  The purpose for this is that to see stereo, you must have two images, a
left-eye image and a right-eye image, and so the monitor with display the two
images each 60 times/sec, for a total of 120 images updates/sec.  In fact, each

second it draws the left eye image, then the right eye image, and alternates
drawing left-right.  The infrared emitter puts out a signal which tells the
glasses which eye's image is currently being drawn, and the glasses, which
contain LCD lenses, darken the lens of the eye for which the image is not being

drawn.  So, when the monitor displays the left eye image, the glasses make the
right lens black, and vice versa.  Each eye sees 60 images/second still, and
sees only the image for that eye.  The special stereo hardware is required to
keep everything in sync, and to allow the monitor to display 120 images/sec.

Third, here is what must be done to display stereo images from your program:
step one is to switch the monitor into stereo mode; there are some demo
programs in ~demos/Stereo, including a utility to check and see if your system
has the stereo option installed.  In these demo programs is some code they
provide to switch between stereo/non-stereo.  On our system, however, there
were already installed the programs 'onstereo' and 'offstereo' which could be
used from the command prompt (or a system() call in a program) to switch stereo

modes.  ~demos/Stereo also provides examples on how to draw images in your
program to display in stereo.

Basically, there is no way to take just any program executable lying around and

make it display in stereo; you need to rewrite the drawing routines so that
they properly display the image such that it will look 3-D to a person wearing
the stereo glasses.  Also, the stereo option works best only when your graphics

window is the size of the entire screen.  Normally, of course, the SGI display
is 1280 x 1024 pixels; when in stereo mode, the display 'wraps around' 1/2 of
this and displays it on top of the other 1/2.  Actually, here is how the
original display is mapped to the stereo display:

   +----------------------+ (1279, 1023)
   |                      |
   |                      |
   |                      |
   |    left eye image    |
   |                      |
   |                      |
   |                      |
   +----------------------+ (1279, 532 = YOFFSET)
   |    space not used    |
   |     by either eye    |
   +----------------------+ (1279, 491 = YMAXSTEREO)
   |                      |
   |                      |
   |                      |
   |   right eye image    |
   |                      |
   |                      |
   |                      |
0,0+----------------------+ (1279,0)

So, in your program, you must draw the same image twice, using a slightly
different perspective for each eye.  Here is a quick list of steps you coud
use:
        a) for the right eye:
                1) set the viewport to the right eye region:
        viewport(0,XMAXSCREEN,0,YMAXSTEREO);
                2) set the perspective so that you are looking at the object
                   from the right eye's position, i.e. if you use a
                   'lookat' perspective call (there are no doubt much more
                   sophisticated methods to do this; this is just a quick
                   example):
        perspective(450, 0.5*(float)XMAXSCREEN/(float)YMAXSTEREO, nearClip,
farClip);
        lookat(SGIeyeSep, 0.0, eyePosition[2], 0.0, 0.0, 0.0, 0);
                3) draw the image

        b) for the left eye:
                1) set the viewport to the left eye region:
        viewport(0,XMAXSCREEN,YOFFSET,YOFFSET + YMAXSTEREO);
                2) set the perspective for the left eye:
        perspective(450, 0.5*(float)XMAXSCREEN/(float)YMAXSTEREO, nearClip,
farClip);
        lookat(-SGIeyeSep, 0.0, eyePosition[2], 0.0, 0.0, 0.0, 0);
                3) draw the image

If this is done, then the monitor will display the two images right on top of
each other, and the glasses will only see the left eye image in the left eye,
etc.  Note that each image will only have about 1/2 the vertical resolution
possible in non-stereo mode; this is the price that must be paid for the 3-D
effect (besides the fact that drawing each frame will take twice as long, since

each frame requires two redraws).
--
Bill Humphrey

(billh@lisboa.ks.uiuc.edu)
(Beckman Institute - University of Illinois)
(405 North Matthews)
(Urbana, IL  61801)
----------------------------
Article: 283 of comp.sys.sgi.hardware
From: spencer@hailwood.asd.sgi.com (Paul Spencer)
Subject: Re: General info about SGI stereo (was: How does one use stereo goggles?)
Date: 5 Feb 1993 02:39:29 GMT
Organization: Silicon Graphics, Inc., Mountain View, CA

billh@lisboa.ks.uiuc.edu (William F. Humphrey) says:
>
[ excellent description of stereo mode and goggles deleted ]

What Bill described is what we call `old-style' stereo on RealityEngine.
(It's the only kind of stereo available on VGX'es and older).

On RE, we have available `new-style' stereo, which differs in the following
ways (otherwise, it's remarkably similar):

 - Instead of using two different pieces of the screen for left and right
   eyes, your software uses the SAME window in the SAME place. Just as
   each window has a front and a back buffer, a window in new-style stereo
   mode has a left buffer and a right buffer. Well, in fact, it has FOUR:
   left-front, left-back, right-front, right-back.

 - a new-style stereo program looks something like this:

    winopen("");
    doublebuffer();
    stereobuffer();
    gconfig();

    while (1) {
        leftbuffer(TRUE);
        rightbuffer(FALSE);
        /* draw scene as seen from the left eye here */

        leftbuffer(FALSE);
        rightbuffer(TRUE);
        /* draw scene as seen from the right eye here */

        swapbuffers();
    }

 - new-style stereo has one huge advantage over old-style stereo:

        non-stereo programs on your screen look normal!

   That's right, all of your xwsh/xterm/xclock/etc. all look just like they
   do today; no mad flickering, no seeing them in just one eye. Everything
   works just like normal (even if you aren't wearing the glasses!)


 - The screen in new-style stereo is less strangely shaped (1280 x 492
   is kind of an odd aspect ratio!)

   Formats available are:

        1025 x 768 at  96 Hz
         640 x 512 at 120 Hz
         815 x 611 at 120 Hz
         960 x 680 at 108 Hz

....paul

--
Paul Spencer                 Silicon Graphics Advanced Graphics Division
spencer@sgi.com                                Mountain View, California
----------------
Article: 28247 of comp.sys.sgi
From: martinm@sgi.com (Martin McDonald)
Subject: Re: Stereo in a window on a RealityEngine
Message-ID: <1992Nov12.155346.13219@news.csd.sgi.com>
Sender: news@news.csd.sgi.com (Net News CSD)
Organization: Silicon Graphics, Inc., Mountain View, CA
References: <17403@borg.cs.unc.edu>
Date: Thu, 12 Nov 1992 15:53:46 GMT

In article <17403@borg.cs.unc.edu> cullip@pooh.cs.unc.edu (Timothy Cullip) writes:
>We have a loaner Crimson/RealityEngine that we are evaluating for
>our needs. One of our needs is stereo in a window (which I've heard
>it is capable of doing. Does anyone out there have a simple example
>program that demonstrates this capability? If so, could I get my
>nands on the source code?

try this one out. note from the header you need to change the video
output format to do stereo per window. to do this you need to be 
root. run /usr/gfx/setmon 960x680_108s . then run /usr/gfx/stopgfx
followed up with /usr/gfx/startgfx . you will lose some screen 
real estate, but you will be able to do single window stereo.
this program will be found in 4Dgifts soon.

/***********************************************************************
*                                                                      *
*                 Stereo In Window Sample Program                      *
*                                                                      *
* WARNING: YOU MUST RUN  960x680_108s  VOF TO USE STEREO IN WINDOW     *
*          WILL ONLY WORK ON REALITY ENGINE                            *
***********************************************************************/
#include <stdio.h>
#include <gl/gl.h>

#define XSIZE 640.0
#define YSIZE 512.0

static Matrix idmat = { 1.0,0.0,0.0,0.0,
                        0.0,1.0,0.0,0.0,
                        0.0,0.0,1.0,0.0,
                        0.0,0.0,0.0,1.0,
};

static float mat[] = {
    AMBIENT, 0.35, 0.25,  0.1,
    DIFFUSE, 0.65, 0.5, 0.35,
    SPECULAR, 0.0, 0.0, 0.0,
    SHININESS, 0.0,
    LMNULL
};

static float lig[] = {
    AMBIENT, 0.0, 0.0, 0.0,
    LCOLOR, 1.0, 1.0, 1.0,
    POSITION, 0.0, 0.0, -1.0, 0.0,
    LMNULL
};

static float mod[] = {
    AMBIENT, 0.3,  0.3, 0.3,
    LOCALVIEWER, 0.0,
    LMNULL
};

static float ang = 0.0;

static float v[8][3] = { -1.0,-1.0,-1.0,
                          1.0,-1.0,-1.0,
                          1.0, 1.0,-1.0,
                         -1.0, 1.0,-1.0,
                         -1.0,-1.0, 1.0,
                          1.0,-1.0, 1.0,
                          1.0, 1.0, 1.0,
                         -1.0, 1.0, 1.0,
};

static float n[6][3] = {  0.0, 0.0, 1.0,
                          0.0, 0.0,-1.0,
                          0.0, 1.0, 0.0,
                         -1.0, 0.0, 0.0,
                          0.0,-1.0, 0.0,
                          1.0, 0.0, 0.0,
};

static void draw_scene(long);
static void draw_polyg(float *,float *,float *,float *,float *);

main()
{
   foreground();
   prefposition(0,XSIZE-1,0,YSIZE-1);
   winopen("Stereo In Window");

   RGBmode();
   doublebuffer();
   stereobuffer();
   gconfig();

   if (!getgconfig(GC_DOUBLE) || !getgconfig(GC_STEREO)) {
     fprintf(stderr,"ERROR: Could not configure doublebuffer stereo!\n");
     exit(0);
     }

   subpixel(TRUE);
   zbuffer(TRUE);
   lsetdepth(getgdesc(GD_ZMIN),getgdesc(GD_ZMAX));

   lmdef(DEFMATERIAL, 1, 0, mat);
   lmdef(DEFLIGHT,    1, 0, lig);
   lmdef(DEFLMODEL,   1, 0, mod);

   lmbind(MATERIAL, 1);
   lmbind(LMODEL,   1);

   mmode(MPROJECTION);
   perspective(450,XSIZE/YSIZE,0.1,100.0);
   mmode(MVIEWING);
   loadmatrix(idmat);
   lmbind(LIGHT1,1);

   while (1)  {
     leftbuffer(TRUE);
     rightbuffer(FALSE);
     draw_scene(0);

     leftbuffer(FALSE);
     rightbuffer(TRUE);
     draw_scene(1);

     swapbuffers();
     }
}

static void draw_scene(long flag)
{
   czclear(0,getgdesc(GD_ZMAX));

   pushmatrix();

   /* left/right eye */
   if (flag == 0)
        lookat(5.0,-1.0,0.0,0.0,0.0,0.0,0);
   else lookat(5.0, 1.0,0.0,0.0,0.0,0.0,0);

   ang+=2.0;
   rotate(ang,'y');
   rotate(ang/2.7,'z');

   cpack(0xffffffff);
   draw_polyg(v[0],v[1],v[2],v[3],n[0]);
   draw_polyg(v[4],v[5],v[6],v[7],n[1]);
   draw_polyg(v[0],v[1],v[5],v[4],n[2]);
   draw_polyg(v[1],v[2],v[6],v[5],n[3]);
   draw_polyg(v[2],v[3],v[7],v[6],n[4]);
   draw_polyg(v[3],v[0],v[4],v[7],n[5]);

   popmatrix();
}

static void draw_polyg(float *v0,float *v1,float *v2,float *v3,float *n)
{
   bgnpolygon();
   n3f(n);
   v3f(v0);
   v3f(v1);
   v3f(v2);
   v3f(v3);
   endpolygon();
}

--
Martin McDonald       Up there they got a lot of sand, but down here we got a
hot crustacean band. each little snail he know how to wail.  that's why it's 
hotter under the water under the sea.
                                                         -sebastian
---------------------------------
Article: 227 of comp.sys.sgi.graphics
From: airey@woof.asd.sgi.com (John Airey)
Subject: Source for stereo demo...
Date: 27 Jan 1993 22:25:09 GMT
Organization: Silicon Graphics, Inc.  Mountain View, CA
Lines: 435
Message-ID: <1k7245INNhc7@fido.asd.sgi.com>
NNTP-Posting-Host: woof.asd.sgi.com

Here is some source for a demo that uses stereo in a window.
For RealityEngine.

No promises or guarantees okay? It works for me.


#include <stdio.h>
#include <math.h>
#include <gl/image.h>
#include <gl/gl.h>
#include <gl/device.h>

#define X 0
#define Y 1
#define Z 2

static int Colors[] = 
{ 0xff7f1f9f,
  0xff5f0f9f,
  0xff9f0f3f,
  0xff0f9fff,
  0xffff1fff,
  0xff3f5f4f,
  0xff9f3f0f,
  0xff1f2f1f,
};

#define CFACES 6
#define VERTS_PER_CFACE 4
static float    cdata[8][3] =
{{-1., -1., -1.,},
 { 1., -1., -1.,},
 { 1.,  1., -1.,},
 {-1.,  1., -1.,},

 {-1., -1., 1.,},
 { 1., -1., 1.,},
 { 1.,  1., 1.,},
 {-1.,  1., 1.,},};

static int cndex[CFACES][VERTS_PER_CFACE] = 
{{3, 2, 1, 0},
 {4, 5, 6, 7},
 {0, 1, 5, 4},
 {1, 2, 6, 5},
 {2, 3, 7, 6},
 {3, 0, 4, 7},};

static float tex[4][2] = 
{{ 0., 0., },
 { 1., 0., },
 { 1., 1., },
 { 0., 1., },};

static int NumFaces = 6;
static int NumVertsPerFace = 3;

static int LeftBuffer = 1;
static float IOD  = 2.3;

maketexture(unsigned long t[], char *name, int x, int y)
{
   int j,i,n=0;
   int r,g,b,a;
   IMAGE *iimage;
   unsigned short *st = (unsigned short *) t;

   short rbuf[1024],gbuf[1024],bbuf[1024],abuf[1024];

   if ( (iimage = iopen(name,"r")) == NULL){
      fprintf(stderr,"\nCANT OPEN %s\n\n",name);
      exit(1);
   }

   for (j= 0; j< x; j++){
      getrow(iimage,rbuf,j,0);

      for (i= 0; i < y; i++){
	 st[n++]= (rbuf[i]) | (rbuf[i]<<8);
      }
   }
   iclose(iimage);
}

#define TEXSIZE 64
unsigned long tt1[TEXSIZE*TEXSIZE];
unsigned long tt2[TEXSIZE*TEXSIZE];
unsigned long tt3[TEXSIZE*TEXSIZE];
unsigned long tt4[TEXSIZE*TEXSIZE];
unsigned long tt5[TEXSIZE*TEXSIZE];
unsigned long tt6[TEXSIZE*TEXSIZE];

float Ztranslation = 0.;

#define CONVERGENCETRACK 0 
#define PARALLELVIEWS    1
#define SCREENCONVERGE   2
int StereoModel = CONVERGENCETRACK;

float texps[] = { TX_MAGFILTER, TX_SHARPEN,
		  TX_MINFILTER, TX_MIPMAP_TRILINEAR,
		  TX_INTERNAL_FORMAT, TX_IA_8, TX_NULL };

float tevps[] = { TV_MODULATE, TV_NULL };

float ConvergenceFudge = 0.0;

extern void draw_frame(float , float , float );
main()
{
   short           val, mval[2], lastval[2];
   long            org[2], size[2];
   Device          dev, mdev[2];
   Boolean         run;
   int             leftmouse_down = 0;
   int             middlemouse_down = 0;
   float rx,ry;
   float from[3];
   float at[3];
   char buf[80];

   lastval[X] = -1;

   maketexture(tt1,"t1.rgba",TEXSIZE,TEXSIZE);
   maketexture(tt2,"t2.rgba",TEXSIZE,TEXSIZE);
   maketexture(tt3,"t3.rgba",TEXSIZE,TEXSIZE);
   maketexture(tt4,"t4.rgba",TEXSIZE,TEXSIZE);
   maketexture(tt5,"t5.rgba",TEXSIZE,TEXSIZE);
   maketexture(tt6,"t6.rgba",TEXSIZE,TEXSIZE);

   foreground();
   noborder();
   prefposition(0,959,0,679);
   winopen("StereoSpin");
   RGBmode();
   doublebuffer();
   subpixel(1);
   zbuffer(1);
   stereobuffer();
   gconfig();

   if (!getgconfig(GC_STEREO)){
      fprintf(stderr,"stereo not available\n");
      exit(1);
   }

   tevdef(1,0,tevps);
   tevbind(0,1);

   texdef2d(1,2,TEXSIZE,TEXSIZE,tt1,0,texps);
   texdef2d(2,2,TEXSIZE,TEXSIZE,tt2,0,texps);
   texdef2d(3,2,TEXSIZE,TEXSIZE,tt3,0,texps);
   texdef2d(4,2,TEXSIZE,TEXSIZE,tt4,0,texps);
   texdef2d(5,2,TEXSIZE,TEXSIZE,tt5,0,texps);
   texdef2d(6,2,TEXSIZE,TEXSIZE,tt6,0,texps);

   mmode(MVIEWING);

   getorigin(&org[X], &org[Y]);
   getsize(&size[X], &size[Y]);
   mdev[X] = MOUSEX;
   mdev[Y] = MOUSEY;
   getdev(2, mdev, lastval);	/* initialize lastval[] */
   lastval[X] -= org[X];
   lastval[Y] -= org[Y];
   qdevice(LEFTMOUSE);
   qdevice(MIDDLEMOUSE);
   qdevice(ESCKEY);
   qdevice(MOUSEX);
   qdevice(MOUSEY);

   qdevice(SPACEKEY);
   qdevice(RETKEY);

   qdevice(UPARROWKEY);
   qdevice(DOWNARROWKEY);

   qdevice(LEFTARROWKEY);
   qdevice(RIGHTARROWKEY);

   while (1){

      while (qtest()) {

	 switch (dev = qread(&val)) {
	 case LEFTMOUSE:
	    leftmouse_down = val;
	    break;

	 case MIDDLEMOUSE:
	    middlemouse_down = val;
	    break;

	 case MOUSEX:
	    mval[X] = val - org[X];
	    break;
	 case MOUSEY:
	    mval[Y] = val - org[Y];
	    if (leftmouse_down) {
	       rx += (mval[Y] - lastval[Y]);
	       ry += (mval[X] - lastval[X]); 
	    }
	    if (middlemouse_down){
	       Ztranslation += (mval[X] - lastval[X])*(1./8.);
	    }
	    lastval[X] = mval[X];
	    lastval[Y] = mval[Y];
	    break;

	 case SPACEKEY:
	    if (val){
	       StereoModel = (StereoModel+1)%3;
	    }
	    break;
	 
	 case RETKEY:
	    if (val){
	       IOD = 2.3;
	       StereoModel = CONVERGENCETRACK;
	       ConvergenceFudge = 0.0;
	    }
	    break;

	 case UPARROWKEY:
	    if (val)
	       ConvergenceFudge += 0.5;
	    break;

	 case DOWNARROWKEY:
	    if (val)
	       ConvergenceFudge -= 0.5;
	    break;

	 case LEFTARROWKEY:
	    if (val)
	       IOD -= .1;
	    break;

	 case RIGHTARROWKEY:
	    if (val)
	       IOD += .1;
	    break;

	 case ESCKEY:
	    exit(0);
	 }
      }


/* 
 * try to define everything in inches 
 *
 */

#define SCREEN_WIDTH  15.       /* width of screen in inches*/
#define SCREEN_HEIGHT 10.625    /* height of screen in inches*/
#define DISTANCE_TO_SCREEN 19.  /* distance from eye to screen (nearclip)*/

#define CLIP_FACTOR (1./8.00) /* to move near clip in */

#define NEAR_CLIP_DISTANCE	(DISTANCE_TO_SCREEN*CLIP_FACTOR)
#define FAR_CLIP_DISTANCE	(DISTANCE_TO_SCREEN*30.)  

#define DESIRED_SIZE_ON_SCREEN	2.
#define WORLD_SPACE_SIZE	2.


      if (LeftBuffer = !LeftBuffer){

	 leftbuffer(1);
	 rightbuffer(0); 

	 from[X] = -IOD/2.;
	 from[Y] =    0.0;
	 from[Z] =    DISTANCE_TO_SCREEN;

	 at[X] = 0.0;
	 at[Y] = 0.0;
	 at[Z] = 0.0;
      }
      else{

	 leftbuffer(0);
	 rightbuffer(1);

	 from[X] =  IOD/2.;
	 from[Y] =    0.0;
	 from[Z] =    DISTANCE_TO_SCREEN;

	 at[X] = 0.0;
	 at[Y] = 0.0;
	 at[Z] = 0.0;
      }

      if (StereoModel == CONVERGENCETRACK) {

	 float dir[3],new_dir[3],mag, new_mag;

	 /* compute old magnitude of lookat vector */
	 dir[X] = at[X]-from[X];
	 dir[Y] = at[Y]-from[Y];
	 dir[Z] = at[Z]-from[Z];
	 mag = dir[X]*dir[X] + dir[Y]*dir[Y] + dir[Z]*dir[Z];
	 mag = fsqrt(mag);

	 /* compute new lookat direction */
	 new_dir[X] = dir[X];
	 new_dir[Y] = dir[Y];
	 new_dir[Z] = dir[Z]+Ztranslation+ConvergenceFudge;
	 new_mag = new_dir[X]*new_dir[X]  + 
		   new_dir[Y]*new_dir[Y]  + 
		   new_dir[Z]*new_dir[Z];
	 new_mag = fsqrt(new_mag);
	 new_dir[X] /= new_mag;
	 new_dir[Y] /= new_mag;
	 new_dir[Z] /= new_mag;

	 /* make sure new lookat direction has same mag as old lookat vector */
	 at[X] = new_dir[X]*mag + from[X];
	 at[Y] = new_dir[Y]*mag + from[Y];
	 at[Z] = new_dir[Z]*mag + from[Z];

      }
      else if (StereoModel == PARALLELVIEWS){

	 if (LeftBuffer) at[X] = -IOD/2.;
	 else            at[X] =  IOD/2.;

      }
      else if (StereoModel == SCREENCONVERGE){
      }

      cpack(0x2f2f2f2f);
      zclear();
      clear();


      ortho2(0.,1.,0.,1.);
      cpack(0xffffffff);

      switch (StereoModel){
	 case CONVERGENCETRACK:
	    sprintf(buf,"StereModel: CONVERGENCETRACK");
	    break;
	 case PARALLELVIEWS:
	    sprintf(buf,"StereModel: PARALLELVIEWS");
	    break;
	 case SCREENCONVERGE:
	    sprintf(buf,"StereModel: SCREENCONVERGE");
	    break;
      }
      cmov2(0.1,0.96);
      charstr(buf);

      sprintf(buf,"IOD: %2.1f",IOD);
      cmov2(0.4,0.96);
      charstr(buf);

      sprintf(buf,"centroid at: %3.1f inches",
	  DISTANCE_TO_SCREEN-Ztranslation);
      cmov2(0.5,0.96);
      charstr(buf);

      /*
      sprintf(buf,"centroid at: %3.1f inches",
	  DISTANCE_TO_SCREEN-Ztranslation);
      cmov2(0.5,0.96);
      charstr(buf);
      */

      pushmatrix();

      window(-CLIP_FACTOR*SCREEN_WIDTH/2.,  CLIP_FACTOR*SCREEN_WIDTH/2.,   
	     -CLIP_FACTOR*SCREEN_HEIGHT/2., CLIP_FACTOR*SCREEN_HEIGHT/2.,
	      NEAR_CLIP_DISTANCE,  FAR_CLIP_DISTANCE);

      lookat(from[X], from[Y], from[Z], at[X],  at[Y],  at[Z], 0);

      draw_frame(ry,-rx, DESIRED_SIZE_ON_SCREEN/WORLD_SPACE_SIZE);

      popmatrix();

      if (LeftBuffer)
	 swapbuffers();
   }
}

void draw_frame(float ry, float rx, float s)
{

   register int i,j;


#if 0
   cpack(0xafafafaf);
   for (i = 0; i < 20; i++){
      float v1[3];
      float v2[3];

      v1[2] = 0.;
      v1[1] = SCREEN_HEIGHT/2.;
      v1[0] = SCREEN_WIDTH*((float)i/20.) - SCREEN_WIDTH/2;

      v2[2] = 0.;
      v2[1] = -SCREEN_HEIGHT/2.;
      v2[0] = SCREEN_WIDTH*((float)i/20.) - SCREEN_WIDTH/2;
      bgnline();
	 v3f(v1);
	 v3f(v2);
      endline();
   }
#endif


   translate(0.,0.,Ztranslation);
   rot(ry,'y');
   rot(-rx,'x');
   scale(s,s,s);

   for (i = 0; i < NumFaces; i++){
      cpack(Colors[i]);
      texbind(0,(i%6)+1);
      bgnpolygon();
      for (j = 0; j < NumVertsPerFace; j++){
	 t2f(tex[j]); v3f(cdata[cndex[i][j]]);
      }
      endpolygon();
   }
   texbind(0,0);
}

                
john m. airey      airey@asd.sgi.com  (415) 390-5248
                   M/S 7U-553 Silicon Graphics, Advanced Graphics Division
                   2011 N. Shoreline Blvd., Mtn. View, CA 94039  
------
Ivan Bach, ib@sgi.com






From guest  Tue Mar 22 15:01:57 1994
From: jrohlf@tubes (John Rohlf)
Message-Id: <9403222252.AA14567@tubes.asd.sgi.com>
Subject: Re: Stereo code examples for Onyx/RE?
To: guest (David Marsland)
Date: Tue, 22 Mar 94 14:52:13 PST
Cc: shj@swlvx2.msd.ray.com, info-performer@sgi.sgi.com
In-Reply-To: <9403221641.AA08273@clubted.csd.sgi.com>; from "David Marsland" at Mar 22, 94 8:41 am
X-Mailer: ELM [version 2.3 PL8]
Status: O

> 
> 
> I'm passing on this request for Steve Joyce.  Please respond to him at
> shj@swlvx2.msd.ray.com if you have any Onyx/RE stereo examples you'd
> like to share.  Sorry if this is an FAQ.
> 
> Steve, if you would like to join this mailing group you can send mail
> to info-performer-request@sgi.com.
> 
> Steve Joyce wrote:
> (stuff deleted)
> > an Onyx example of stereo viewing that you knew of when I raised the
> > question at the end of class. I'm in general looking for some examples of
> > stereo viewing programs if you happen to know of any (besides a couple
> > in 4Dgifts).
> > 
> >  Thanks for any help -
> > 
> > Steve Joyce 
> > 
> /* David Marsland                       "On Spaceship Earth       *
>  * MTS, Worldwide Education R&D          there are no passengers, *
>  * Silicon Graphics Computer Systems     only crew."              *
>  * Internet: mars@csd.sgi.com                 Buckminster Fuller  */
> 

I have modified perfly to run stereo-in-a-window. You can find 
a tar file with source code in tubes.asd:/usr/tmp/sfly.tar. 
Note that this is not a trivial stereo example.






From guest  Tue Mar 22 18:07:17 1994
From: jrohlf@tubes (John Rohlf)
Message-Id: <9403230207.AA15174@tubes.asd.sgi.com>
Subject: stereo perfly
To: info-performer@sgi.sgi.com
Date: Tue, 22 Mar 94 18:07:10 PST
X-Mailer: ELM [version 2.3 PL8]
Status: OR



	I have put a stereo version of perfly on sgi.com:~ftp/pub/sfly.tar.Z.
This tar file contains:

a cmdline.c 19 blocks
a cmdline.h 3 blocks
a custom.h 3 blocks
a env.c 11 blocks
a env.h 3 blocks
a generic.c 38 blocks
a generic.h 5 blocks
a gui.c 46 blocks
a gui.h 4 blocks
a keybd.c 15 blocks
a keybd.h 3 blocks
a main.c 11 blocks
a main.h 3 blocks
a sfly.c 38 blocks
a sfly.h 12 blocks
a Makefile 11 blocks
a sfly 5064 blocks

1. uncompress sfly.tar
2. tar -xvf sfly.tar
3. smake opt
4. as root: /usr/gfx/setmon -n 960x680_108s or your favorite stereo format.
5. sfly file

The GUI contains a slider for intraocular distance.
-s option disables stereo.







