FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Tools
(Moderator: REAS)
   BApplet fullscreen modification
« Previous topic | Next topic »

Pages: 1 2 3 
   Author  Topic: BApplet fullscreen modification  (Read 12529 times)
jamie howard
Guest
Email
Re: BApplet fullscreen modification
« Reply #30 on: Jul 15th, 2004, 3:07pm »

Help!! I have produced an applet to run full screen and have tried both Toxi's AppLauncher and the BAppletFS code, also I have tried putting a main method inside the applet. In every case I get the same behaviour - on exit, 80% of the time, the process hangs in memory and cannot be shut down.
 
This is a real problem for me and I'm desperate to solve it fast! Does anyone have a workaround? I'm running jre 1.4.2_04-b05 with processing version 069 alpha.
 
Hope someone can help - cheers - Jamie
 
physcopanda

WWW Email
Re: BApplet fullscreen modification
« Reply #31 on: Jul 15th, 2004, 4:42pm »

OK, I think I answered my own problem! - After extensive testing with several different JRE's I can confirm what I think is the source of the problem and a fix:
 
Switching away from desktop rez for fullscreen - on system.exit it seems to cause the jvm to hang - solution store the desktop display mode - and switch it back before system.exit
 
Anyone else noticed this problem - any other workarounds?
 

Space elephant lost in the intergalactic cheese matrix of swiss wormholes inside the belly of the almighty space gerbal.
fjen

WWW
Re: BApplet fullscreen modification
« Reply #32 on: Jul 17th, 2004, 8:36am »

on Jul 14th, 2004, 7:33pm, bren wrote:

 
er... do you wanna tell us how you solved it I get the same error message: beginVideo(III)V  
 
Running Mac OS 10.3 Java 1.4.2

 
 
http://processing.org/discourse/yabb/board_Tools_action_display__num_1084266556_start_8.html
 
it's solved there ( reply #8 ) ... you have to include the classes from Processing/lib into your project (on win it's comm.jar, pde.jar - i think).
on mac i had to include some more to get it to run.
 
i think the reason for the beginVideo(III)V-error is that the p5-environment is running on a newer version of the classes than the ones in export (that are included into the .jar's).
« Last Edit: Jul 17th, 2004, 8:50am by fjen »  
poliphemuss


Fullscreen?
« Reply #33 on: Apr 3rd, 2005, 9:13pm »

...I've followed all the posts from TomC and I've included the codes he has published, I've changed the name of the application within the sketche's code, and I've made the MS-DOS .BAT file. But when I double click it, I see a frame of the application when it's opened and then it closes again. Is it a common mistake?  here's my code, using one of sonia's examples:
 
 // originally provided by michael05  
static public void main(String args[]) {  
  try {  
    Frame frame = new Frame();  
 
    // !!!  
    // change this to your sketch name...  
    Class c = Class.forName("pruebascodigo");  
    BApplet applet = (BApplet) c.newInstance();  
    applet.init();  
    applet.start();  
 
    // get default screendevice and configuration  
    GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice   ();  
    GraphicsConfiguration gc = gd.getDefaultConfiguration();  
 
    frame.setUndecorated(true);  
    frame.setBackground(Color.black);  
    frame.setLayout(new GridBagLayout());  
    frame.add(applet);  
    frame.pack();  
 
    // test if fullscreen mode is available (jvm 1.4+) and activate it  
    if (gd.isFullScreenSupported()) {  
 gd.setFullScreenWindow(frame);  
    }  
    // test if display mode is available (jvm 1.4+) and set it to the  
    // size of the applet  
    if (gd.isDisplayChangeSupported()) {  
 gd.setDisplayMode(new DisplayMode(applet.g.width, applet.g.height, 32, 0));  
    }  
 
    frame.setLocation(0, 0);  
    frame.show();  
    applet.requestFocus();  
 
    frame.addWindowListener(new WindowAdapter() {  
 public void windowClosing(WindowEvent e) {  
   System.exit(0);  
 }  
    });  
 
  } catch (Exception e) {  
    e.printStackTrace();  
    System.exit(1);  
  }  
}  
 int outputLen = 800;
void setup(){
  size(800,200); // in this example, we assume that width equals outputLen.
  Sonia.start(this,15000); // Start Sonia in a lower sampling rate, for improved CPU performance.
  LiveOutput.start(outputLen,outputLen*2); // Start LiveOutput, define the Stream-length and Stream-buffer.
  LiveOutput.startStream(); // Start the streaming -activates the liveOutputEvent(){}
}
 
 
void loop(){
   // draw the background graphics
   background(0,30,0);
   stroke(0,100,0);
   line(0,height/2, width,height/2);
   stroke(0,255,0);
       
   // Draw the waveform of the sample-data
   // notice that we multiply the data by 30, because it is originally in a float value range of 0.0 -> 1.0
   for (int i=0; i < outputLen-1; i++) {
     line(i,LiveOutput.data[i]*30 + height/2, i+1,LiveOutput.data[(i+1)]*30 + height/2);
   }
}
 
 
// This event is automatically called every time new sample data is required by the LiveOutput stream.
// You are expected to pass LiveOutput.data[] new values on each call.
// Notice that LiveOutput.data.length is determined by the LiveOutput.start(streamLength)command in void setup()
 
void liveOutputEvent(){
  if(mousePressed){
     // do the math for creating the sample data
     int freq = mouseX/10; // mouseX determines the amount of sine-cycles to be created.  
     float oneCycle = (TWO_PI) / outputLen; // math to be used in sin() below. it changes the value range, to produce 1 sin cycle.  
     float amp = 0.5; // determines the amplitude of our sample data. (values range from 0.0 to 1.0);
 
     // populate the liveOutput 'data' array with sample data
 for (int i=0; i < outputLen; i++) {
   LiveOutput.data[i] = amp* sin(float(i*oneCycle*freq));
 }
   }else {
 // on mouseRelease, do a fade-out of the sample data by slowly 'shrinking' the array values.
 for (int i=0; i < outputLen; i++) {
 LiveOutput.data[i] *= 0.98;
 }
   }
}
 
 
// Safely close the sound engine upon Browser shutdown.
public void stop(){
     Sonia.stop();
     super.stop();
}
 
 
Then, the .BAT code: start javaw -cp pruebascodigo.jar pruebascodigo
 
 
What else should I do?
 
Any help will be appreciated...I got a presentation next thursday and I'm out of time!
 
 
 
 
Pages: 1 2 3 

« Previous topic | Next topic »