Name

fullScreen()

Description

This function is new for Processing 3.0. It opens a sketch using the full size of the computer's display. This function must be the first line in setup(). The size() and fullScreen() functions cannot both be used in the same program, just choose one.

When fullScreen() is used without a parameter, it draws the sketch to the screen currently selected inside the Preferences window. When it is used with a single parameter, this number defines the screen to display to program on (e.g. 1, 2, 3...). When used with two parameters, the first defines the renderer to use (e.g. P2D) and the second defines the screen. The SPAN parameter can be used in place of a screen number to draw the sketch as a full-screen window across all the attached displays if there are more than one.

Prior to Processing 3.0, a full-screen program was defined with size(displayWidth, displayHeight).

Examples

  • // If more than one screen is attached to the computer, run the 
    // code at the full dimensions on the screen defined by the 
    // parameter to fullScreen()
    
    int x = 0;
    
    void setup() {
      fullScreen(2);
      background(0);
      noStroke();
      fill(102);
    }
    
    void draw() {
      rect(x, height*0.2, 1, height*0.6); 
      x = x + 2;
    }
    
  • // Run the code at the full dimensions of the screen currently
    // selected inside the Preferences window
    
    int x = 0;
    
    void setup() {
      fullScreen();
      background(0);
      noStroke();
      fill(102);
    }
    
    void draw() {
      rect(x, height*0.2, 1, height*0.6); 
      x = x + 2;
    }
    
  • // If more than one screen is attached to the computer, run the 
    // code at the full dimensions across all of the attached screens
    
    int x = 0;
    
    void setup() {
      fullScreen(P2D, SPAN);
      background(0);
      noStroke();
      fill(102);
    }
    
    void draw() {
      rect(x, height*0.2, 1, height*0.6); 
      x = x + 2;
    }
    
  • // Run full screen using the P2D renderer on screen 2
    
    int x = 0;
    
    void setup() {
      fullScreen(P2D, 2);
      background(0);
      noStroke();
      fill(102);
    }
    
    void draw() {
      rect(x, height*0.2, 1, height*0.6); 
      x = x + 2;
    }
    

Syntax

  • fullScreen()
  • fullScreen(display)
  • fullScreen(renderer)
  • fullScreen(renderer, display)

Parameters

  • renderer(String)the renderer to use, e.g. P2D, P3D, JAVA2D (default)
  • display(int)the screen to run the sketch on (1, 2, 3, etc. or on multiple screens using SPAN)

Return

  • void