[jit.gl] multiple viewports across multiple displays - bug?

pseudostereo's icon

Hi -

I'm trying to use scissor_test, glviewport and glscissor to render multiple viewports across multiple displays. It works, but only as long as the viewport size is smaller than my primary display. Once the viewport size = the display size, the multiple viewports stop working; a single viewport fills the whole window, and the window stays this way even after the viewport size is reduced again. The patch has to be closed and reopened for the viewports to start working again.

Example patch & javascript follow.

Max Patch
Copy patch and select New From Clipboard in Max.

//begin multiViewports.js
autowatch = 1;
post ("recompiledn");

var vportLoc = [];                //positions/dimensions of viewports
var vportXno;                    //horizontal count of viewports
var vportYno;                    //vertical count of viewports
var vportXpix;                //pixel width of viewports
var vportYpix;                //pixel height of viewports
var vCount;                    //total number of viewports
var mySketch = new JitterObject("jit.gl.sketch","someport");
var myRender = new JitterObject("jit.gl.render","someport");
mySketch.glenable("scissor_test");        //enable multiple viewports

var myWindow = new JitterObject("jit.window","someport");
myWindow.pos = [0,24];

function viewportSet(xcount,ycount,xwidth,ywidth) {
    vportXno = xcount;
    vportYno = ycount;
    vportXpix = xwidth;
    vportYpix = ywidth;
    c = 0;
    for(y=(vportYno-1)*vportYpix;y>=0;y-=vportYpix) {
        for(x=0;x
            vportLoc[c] =[x,y,vportXpix,vportYpix];
            post(c,vportLoc[c],"n");
            c++;
        }
    }
    myWindow.size = [vportXno*vportXpix,vportYno*vportYpix];
    vCount = clipViewportCount(vportXno*vportYno);
    clear();
    clearColors();
}

function clipViewportCount(slots) {
    slots = Math.max(slots,1);
    slots = Math.min(slots,9);
    return slots;
}

function clear() {
     mySketch.glviewport(0,0,vportXno*vportXpix,vportYno*vportYpi x);        //set to entire window
     mySketch.glscissor(0,0,vportXno*vportXpix,vportYno*vportYpix );    

    myRender.erase();                 // bug?
    myRender.drawswap();            // have to erase+drawswap twice, once before...

    mySketch.reset();
    mySketch.glclear();

    myRender.erase();                 //....once after reset+glclear
    myRender.drawswap();
}

function clearColors() {
    mySketch.reset();
    for (n=0;n
        mySketch.glviewport(vportLoc[n]);
        mySketch.glscissor(vportLoc[n]);
         mySketch.glclearcolor(Math.random(),Math.random(),Math.rando m(),1);
        mySketch.glclear();
    }
    myRender.erase();
    myRender.drawswap();
}
//end multiViewports.js

Joshua Kit Clayton's icon

On Feb 8, 2006, at 11:11 AM, Perry Hoberman wrote:

> I'm trying to use scissor_test, glviewport and glscissor to render
> multiple viewports across multiple displays. It works, but only as
> long as the viewport size is smaller than my primary display. Once
> the viewport size = the display size, the multiple viewports stop
> working; a single viewport fills the whole window, and the window
> stays this way even after the viewport size is reduced again. The
> patch has to be closed and reopened for the viewports to start
> working again.

Thanks for the report. I can't reproduce on Mac under 10.4.3 on my
AluBook with no monitor attached, but I will say that this is not a
current priority for us to support, and that I'd suggest using two
windows.

-Joshua

pseudostereo's icon

Joshua -

I've already been down the road of using multiple windows. That's slower and much less efficient than scissor_test. It means setting up multiple render contexts, one for each window, which makes it much harder to manage. My scenes often include (for instance) a number of complex models, a couple of jit.gl.nurbs and a bunch of jit.gl.sketch objects - and every single one of those objects has to be duplicated each time for each additional window I'm trying to display.

Whereas if I'm using glscissor and glviewport, I only need a single render context that I can draw to any number of viewports. My example used just two views to demonstrate the bug, but I'm actually trying to build a flexible framework to display any number of views across any number of screens, for CAVE-like immersive displays and the like.

So your response is extremely disappointing. You can't even rustle up an external monitor, at least to verify that the bug is reproducible? I've already put a lot of work into this project, assuming that scissor_test would work as advertised, and I didn't become aware of the bug until I'd already been working on it for weeks, if not months.

Please reconsider.

- pH

Joshua Kit Clayton's icon

On Feb 9, 2006, at 10:32 AM, Perry Hoberman wrote:

> Whereas if I'm using glscissor and glviewport, I only need a single
> render context that I can draw to any number of viewports. My
> example used just two views to demonstrate the bug, but I'm
> actually trying to build a flexible framework to display any number
> of views across any number of screens, for CAVE-like immersive
> displays and the like.

I can't guarantee that it will be supported for more outputs than two
displays on the same card. This is heavily HW and graphics driver
dependent, and whether or not the driver supports contexts which span
multiple graphics cards is something that is out of our hands. So you
might need to approach with multiple contexts for a greater number of
outputs anyway.

As for multiple window performance, for the time being disable the
sync attribute. This will produce tearing, but it will offer
additional performance. We will be looking at ways of improving the
framerate of multiple windows with VBL sync in future versions of
Jitter.

> So your response is extremely disappointing. You can't even rustle
> up an external monitor, at least to verify that the bug is
> reproducible? I've already put a lot of work into this project,
> assuming that scissor_test would work as advertised, and I didn't
> become aware of the bug until I'd already been working on it for
> weeks, if not months.

Sorry. We've got lots on our plate, and while I can respect the
amount of time you've spent on the project, this is a particularly
advanced feature that therefore takes lower priority over features
that benefit everyone. This is the unfortunate reality of developing
applications for more than one specific purpose. Priorities must be
made. We can investigate this further (as with all bug reports,
please also provide the specific HW and OS info you are experiencing
this problem on), but I'm not making any promises to when/if this
issue will be resolved.

Thanks for the report.

-Joshua

pseudostereo's icon

Hi Joshua -

>I can't guarantee that it will be supported for more outputs than two displays on the same card.

OK, but I'd really like to at least get two outputs working with scissors/viewports; at least then I can do polarized stereo with two projectors.

>As for multiple window performance, for the time being disable the sync attribute.

Will try that out, thanks.

>We can investigate this further (as with all bug reports, please also provide the specific HW and OS info you are experiencing this problem on), but I'm not making any promises to when/if this issue will be resolved.

Tested on both a Powerbook 17" and a G5 desktop, both running Mac OS 10.4.4. Same thing happens on both, whether a second monitor is connected or not: that is, as soon as the viewport size equals or surpasses the monitor size, multiple viewports stop working, even after you reduce the viewport size back down.

Anyway, I understand your position, and I realize that this might not get fixed, but I'd really appreciate any bit of attention you can put towards this.

One small question: any idea if there's any way to turn off the shadows that the active window always casts on the other windows (Mac OS X)?

pH

Jan Klug's icon

On 10.02.2006, at 04:27, Perry Hoberman wrote:

> One small question: any idea if there's any way to turn off the
> shadows that the active window always casts on the other windows
> (Mac OS X)?

jan

pseudostereo's icon

perfect! thanks jan-

pH