Fullscreen Processing in Eclipse

edited March 2014 in Programming Questions

So I haven't used processing seriously in a while (sorry I got stuck in Open Frameworks land don't judge me!)

Though I remember always having issues going full screen in eclipse and exporting it. However the same code in the IDE works fine and exports fine. I never understood the difference.

Is there still no way around having variables final or other wise in the size() method in eclipse? I can call size(displayWidth, displayHeight) in the IDE and that works and exports fine...

Any new developments on this at all??

Thanks

Answers

  • What issues do you have in using full screen from eclipse? What code are you using?

    What specifically are you talking about when it comes to final variables? What code are you using?

  • in eclipse i write a basic setup method that creates a window at fullscreen

    public void setup(){
        size(displayWidth, displayHeight);
        //other stuff
    }
    

    that won't export into an app because it says i can't use variables in the size command. However the exact same code in the Processing IDE will run export just fine.

  • edited March 2014

    Lucky for us Processing's devs leave secret public functions for us to @ Override whene'er we will to:

    /**
     * Override Canvas Defaults (v1.11)
     * by GoToLoop (2014/Mar)
     *
     * forum.processing.org/two/discussion/3970/
     * fullscreen-processing-in-eclipse
     *
     * github.com/processing/processing/blob/master/core/src/
     * processing/core/PApplet.java#L1036
     */
    
    static final int GW = 800, GH = 600;
    static final String RENDERER = P3D;
    
    @ Override void setup() {
      noLoop();
      println(width + ", " + height + "\t" + isGL());
    
      clear();
      fill(#FFFF00);
      stroke(#0000FF);
      strokeWeight(4);
    
      translate(width>>1, height>>1, -0100);
      lights();
      sphere(0400);
    }
    
    @ Override int sketchWidth() {
      return GW;
    }
    
    @ Override int sketchHeight() {
      return GH;
    }
    
    @ Override String sketchRenderer() {
      return RENDERER;
    }
    
  • edited March 2014

    And to get rid of the window border:

    @ Override
    boolean sketchFullScreen() {
        return true;
    }
    
  • edited March 2014

    hmm i tried that and i still seem to be getting the same error. I'm using the Proclipsing Plugin for eclipse and the @ Overrides work but when I try to export an app i get the same error with the size code. Here's what I have so far.

        public static final int screenWidth = (int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
        public static final int screenHeight = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
    
        public static void main(String[] args){
            //PApplet.main(new String[]{ "--present", "edmondtest.EdmondTest"});
            PApplet.main(new String[]{"edmondtest.EdmondTest"});
        }
    
        @ Override public int sketchWidth(){
            return screenWidth;
        }
    
        @ Override public int sketchHeight(){
            return screenHeight;
        }
    
        @ Override public boolean sketchFullScreen(){
            return true;
        }
    
        @ Override public void setup(){
            //size(screenWidth, screenHeight);
            background(0);
            smooth();
    
            //other setup stuff
        }
    
  • Try this in the class where your setup and draw methods are:

    public static void main(String[] args) {
        PApplet.main(new String[] { "--present", "nameOfYourClass" });
    }
    
Sign In or Register to comment.