Stereo Windows

New Message Reply Date view Thread view Subject view Author view

From: Todd J. Furlong (tfurlong++at++e-motek.com)
Date: 10/10/2001 15:39:06


Hi,

I have an application where I need the ability to toggle a window
between mono display and stereo display for Crystaleyes, and I am having
some trouble getting this to work. The application is based on perfly,
and I've tried two ways of doing this:

1. Declare the initial window as a stereo window. setmon to
1024x768_96s and assign a second channel to it when the toggle is pressed.

2. setmon to 1024x768_96s and create a new, 2-channel, window when the
toggle is pressed.

I think either of these methods should work, but I haven't had success
with either one. The first method seems to give me a ghost image in
addition to the right and left eye images with the following code:

{
int *rightArg, *leftArg;

// first put the monitor in the correct mode
system("/usr/gfx/setmon -n -p0 1024x768_96s");

//wait for the monitor change to take effect
sleep(2);

//use existing channel for left eye and new one for right eye
pfPipe *p_mainpipe = pfGetPipe(0);
m_p_pfleft = p_mainpipe->getChan(1); //get main view

//get pointer to currently active window
m_p_pfpwin = m_p_pfleft->getPWin();

// Create a new pfChan for right eye
m_p_pfright = new pfChannel(p_mainpipe);

/let two channels share the same viewport
unsigned int mask = m_p_pfleft->getShare();
mask |= PFCHAN_VIEWPORT;
m_p_pfleft->setShare(mask);

// attach new channel to existing
m_p_pfleft->attach(m_p_pfright);

// set view offsets
pfVec3 vecOffsets;
pfVec3 vecAngleOffsets;

// Left eye first
vecOffsets.set(-m_fIOD * 0.5, 0.0, 0.0);
vecAngleOffsets.set(-m_fConvAngle, 0.0, 0.0);
m_p_pfleft->setViewOffsets(vecOffsets, vecAngleOffsets);

// Then Right eye
vecOffsets.set(m_fIOD * 0.5, 0.0, 0.0);
vecAngleOffsets.set(m_fConvAngle, 0.0, 0.0);
m_p_pfright->setViewOffsets(vecOffsets, vecAngleOffsets);

//set up arguments to distinguish between left & right channels
leftArg = (int *) m_p_pfleft->allocChanData(sizeof(int)*2);
rightArg = (int *) m_p_pfright->allocChanData(sizeof(int)*2);

// first argument is whether or not stereo is enabled
leftArg[0] = 1;
rightArg[0] = 1;

// second argument is which eye
leftArg[1] = 1;
rightArg[1] = 0;

m_p_pfright->passChanData();
m_p_pfleft->passChanData();

m_bIsStereo = true;
}

My draw function checks the arguments to decide which back buffer to
render to, as in the stereo.c example code.

Can someone tell what I'm doing wrong here?

Thanks,
Todd

-- 
Todd J. Furlong
MOTEK Motion Technology, Inc.      voice 603.641.1300
360 Commercial St                  fax   603.641.8385
Manchester, NH 03101               web http://www.e-motek.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Oct 10 2001 - 13:38:20 PDT

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