Are Undecorated frames Dead with Processing 2.x

Hello, Earlier today I was going through some of my old 1.5.1 Processing sketches and testing them with 2.x. I encountered a number of things that no longer worked but was able to fix them. However one sketch made use of undecorated frames as documented here: wiki.processing.org/w/Undecorated_frame

I also found a forum post on the subject here: forum.processing.org/one/topic/full-screen-approach.html

When I try to use frame.whatevermethod() with the Java renderer I get a mysterious NullPointerException. If I try to use frame.whatevermethod() with the OPENGL renderer I get a java.lang.NullPointerException

Here is the ultra-stripped down code from my original PDE that I used to identify frame as being the source of the problem.

void setup() {   
   size(800, 600);   
   frame.removeNotify();    
   frame.setUndecorated(true);    
}   

void draw() {  
   ellipse(frameCount%width,100,50,50); // output draw test  
  //  if(frameCount == 2)  { frame.setLocation(0,0);  }   
}   

Note this is with the 32 bit version of Processing 2 on a 64bit Windows 7 platform. I haven't tested this with the 64 bit version of Processing 2 but have no reason to believe that it would behave differently.

Answers

  • I noticed that as well. Strangely, frame.setTitle() works, so it's not frame that is null.

  • edited February 2014
    /** 
     * setUndecorated (v4.31)
     * by  rbrauer (2013/Jul)
     * mod GoToLoop (2013/Dec)
     * 
     * forum.processing.org/one/topic/
     * setundecorated-conflic-with-loadlont
     *
     * forum.processing.org/two/discussion/2018/
     * remove-decoration-window-under-p3d
     */
    
    void setup() {
      size(400, 300, removeFrameBorder());
    
      frameRate(60);
      smooth(8);
      stroke(#00FFFF);
      strokeWeight(1.5);
      textSize(32);
    }
    
    void draw() {
      background(0300);
    
      fill(#FF0000);
      text(frameCount, width - 100, 40);
    
      fill(#0000FF);
      translate(frameCount % width, height >> 1);
      sphere(96);
    }
    
    String removeFrameBorder() {
      if (!isGL()) {
        frame.removeNotify();
        frame.setUndecorated(true);
        frame.addNotify();
      }
    
      return P3D;
    }
    
  • Answer ✓
    // forum.processing.org/two/discussion/3013/
    // are-undecorated-frames-dead-with-processing-2-x
    
    void setup() {
      size(800, 600);
    
      frame.removeNotify();
      frame.setUndecorated(true);
      frame.addNotify();
    }
    
    void draw() {  
      ellipse(frameCount%width, 100, 50, 50);
    }
    
  • Wow, Adding the frame.addNotify(); statement (which I never used with 1.5.1) eliminates the error but only for the Java renderer.

    Make that size(800,600, OPENGL) and the java.lang.NullPointerException rears its ugly head.

  • edited February 2014

    Make that size(800,600, OPENGL) and the java.lang.NullPointerException rears its ugly head.

    My very 1st reply was exactly about frame.setUndecorated(true); for OPENGL modes -> P2D & P3D! :-t

Sign In or Register to comment.