We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › fullscreen / dual monitors / 2 viewports
Page Index Toggle Pages: 1
fullscreen / dual monitors / 2 viewports? (Read 3864 times)
fullscreen / dual monitors / 2 viewports?
Jul 17th, 2007, 6:28pm
 
searching for nirvana... i'd like to have fullscreen, with an application spanning 2 monitors; the window has 2 viewports (as described here: http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1181318085
)
this is on windows XP

i've tried the technique of having a larger window and positioning it slightly off (as described here under "WINDOWED":

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1182293890;start=1#1

but then the window doesn't fill the screen because of the space left for the task bar.

i've tried "Present Mode" but of course that only works with a single monitor

i've tried the usual full screen code applied here:

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1183320480

but then i only get one monitor working full screen and the other one doesn't appear at all.

finally, i tried editing that code for two monitors, as below, but that had a similar result.

any suggestions....?

Code:


here's my latest code:

void FullscreenOn2()
{
noCursor();

frame.dispose();
frame.setUndecorated( true );

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
gs[0].setFullScreenWindow( frame );

if (gs[0].isDisplayChangeSupported())
{

int refreshRate = gs[0].getDisplayMode().getRefreshRate();
int bitDepth = gs[0].getDisplayMode().getBitDepth();

DisplayMode myDisplayMode = new DisplayMode(
gs[0].getDisplayMode().getWidth(), gs[0].getDisplayMode().getHeight(), bitDepth, refreshRate);
gs[0].setDisplayMode( myDisplayMode );
}

gs[1].setFullScreenWindow( frame );
if (gs[1].isDisplayChangeSupported())
{
DisplayMode myDisplayMode = new DisplayMode(
480, 640, 32, DisplayMode.REFRESH_RATE_UNKNOWN);
gs[1].setDisplayMode( myDisplayMode );
}
}



p.s. might an alternative be to have 2 different windows instead of 2 viewports? ... no idea how to go about that though... thanks for any pointers!

Re: fullscreen / dual monitors / 2 viewports?
Reply #1 - Jul 17th, 2007, 7:23pm
 
This may help.

Quote:


private static secondCanvas sCanvas;
private static secondApplet sApplet;

import java.awt.*;
import java.awt.event.*;
import processing.core.*;

int xPos = 0;
int yPos = 0;

void setup() {
 size(400, 400);
 smooth();
 background(0);
 noStroke();

 sApplet = new secondApplet();
 sCanvas = new secondCanvas("follower", sApplet, screen.width/2, screen.height/2);
}

void draw() {
 background(0);
 fill(200, 100, 0);
 rect(xPos++,0, 100, 100);
 if(xPos >= width) xPos = 0;
}


public class secondApplet extends PApplet {

 public void setup() {
   size(400, 400);
   background(255, 0, 0);
   frameRate(10);
 }

 public void draw() {
   background(0);
   fill(200, 100, 0);
   rect(0, yPos++, 100, 100);
   if(yPos >= height) yPos = 0;
   ;
 }
}


public class secondCanvas extends Frame {
 public secondCanvas(String name, PApplet embed, int x, int y) {
   super(name);

   // add the PApplet to the Frame
   setLayout(new BorderLayout());
   add(embed, BorderLayout.CENTER);

   // ensures that the animation thread is started and
   // that other internal variables are properly set.
   embed.init();

   // add an exit on close listener
   addWindowListener(new WindowAdapter() {
     public void windowClosing(WindowEvent evt) {
       // exit the application
       System.exit(0);
     }
   }
   );

   setSize(400, 400);
   setLocation(x, y);
   setVisible(true);

 }
}


Re: fullscreen / dual monitors / 2 viewports?
Reply #2 - Jul 18th, 2007, 12:09pm
 
hi thanks for this, works pretty well!

i'm seeing a bit of a performance hit though, working with quite a few 3d forms in opengl -- is it my imagination or is this more processor-intensive than having two viewports in a single window? if so, are there any other ways around this?

thanks again.
Re: fullscreen / dual monitors / 2 viewports?
Reply #3 - Jul 21st, 2007, 6:48pm
 
hi,

I haven't found some time yet to look into that, so I won't be able to tell. I will keep this thread updated if I find something new.
Re: fullscreen / dual monitors / 2 viewports?
Reply #4 - Jul 21st, 2007, 7:02pm
 
It will run slower than 2 viewports, since they're completely seperate OpenGL contexts, the graphics card will be constantly switching back and forth between the two. As a single window it's just 2 views of the same context.
Re: fullscreen / dual monitors / 2 viewports?
Reply #5 - Jul 21st, 2007, 8:17pm
 
thanks johng for the confirmation, as i suspected...

do you have any recommendations for getting fullscreen across two monitors using a single window with 2 viewports? (as it happens i'm using the code you suggested a while back for 2 viewports and i know at that stage i said i wasn't going to need 2 screens but you know how things change...... your viewport code works great though, thank you very much for that!)

Re: fullscreen / dual monitors / 2 viewports?
Reply #6 - Jul 26th, 2007, 12:29am
 
got it; for future reference, here's the answer:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Syntax;action=display;num=1185318989
Page Index Toggle Pages: 1