Forums > Jitter

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

February 8, 2006 | 7:11 pm

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 v2;
#N vpatcher 226 412 825 666;
#P origin 22 -44;
#P window setfont "Sans Serif" 9.;
#P window linecount 2;
#P comment 281 128 294 196617 …but once each viewport is as large as your primary display , the window shows only a single color from then on.;
#P window linecount 1;
#P message 469 98 79 196617 2 1 1280 1024;
#P message 112 98 67 196617 2 1 160 120;
#P message 392 98 73 196617 2 1 1024 768;
#P message 323 98 67 196617 2 1 800 600;
#P message 252 98 67 196617 2 1 640 480;
#P message 183 98 67 196617 2 1 320 240;
#P newex 49 72 30 196617 t b b;
#P newex 49 51 48 196617 loadbang;
#P newex 112 126 100 196617 unpack 1 1 320 240;
#P number 226 160 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 188 160 35 9 1 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 150 160 35 9 1 9 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 112 160 35 9 1 9 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 74 182 164 196617 pak viewportSet 3 3 320 240;
#P message 49 128 62 196617 clearColors;
#P message 63 154 33 196617 clear;
#P newex 49 217 103 196617 js multiViewports.js;
#B color 6;
#P objectname js[1];
#P comment 126 148 124 196617 across down width height;
#P window linecount 3;
#P comment 115 27 387 196617 glviewport and glscissor work only until a single viewport gets as large as the primary display – after that , a single viewport fills the whole window , and multiple viewports doesn’t start working again until the patch is closed and reopened.;
#P window linecount 1;
#P comment 115 74 462 196617 start here and work your way across and then back – the window should always show two colors…;
#P comment 116 87 20 196617 /;
#P connect 13 0 14 0;
#P connect 14 0 6 0;
#P connect 7 0 4 0;
#P connect 5 0 4 0;
#P connect 6 0 4 0;
#P fasten 14 1 19 0 74 93 117 93;
#P fasten 16 0 12 0 257 119 117 119;
#P fasten 17 0 12 0 328 119 117 119;
#P fasten 18 0 12 0 397 119 117 119;
#P fasten 15 0 12 0 188 119 117 119;
#P connect 19 0 12 0;
#P fasten 20 0 12 0 474 119 117 119;
#P connect 12 0 8 0;
#P connect 8 0 7 1;
#P connect 12 1 9 0;
#P connect 9 0 7 2;
#P connect 12 2 10 0;
#P connect 10 0 7 3;
#P connect 12 3 11 0;
#P connect 11 0 7 4;
#P pop;

//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< =(vportXno-1)*vportXpix;x+=vportXpix) {
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


February 9, 2006 | 12:42 am

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


February 9, 2006 | 6:32 pm

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


February 9, 2006 | 7:41 pm

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


February 10, 2006 | 3:27 am

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


February 10, 2006 | 9:50 am

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)?

try ShadowKiller: http://www.unsanity.com/haxies/shadowkiller

jan


February 10, 2006 | 1:02 pm

>try ShadowKiller: http://www.unsanity.com/haxies/shadowkiller

perfect! thanks jan-

pH


Viewing 7 posts - 1 through 7 (of 7 total)