Skip to content

Canvas size and window size mismatch when running sketch #2

@SableRaf

Description

@SableRaf

When running a simple p5.js sketch, the rendered canvas does not match the actual window size. The canvas appears smaller than the window, leaving empty space at the bottom and right.

Example:

function setup() {
  createCanvas(200, 200);
}

function draw() {
  background(220);
}

Observed behavior:
The canvas is visibly smaller than the 200×200 window created by createCanvas().

Image

Expected behavior:
The canvas should fully match the window dimensions specified in createCanvas().

Possible cause:
This might be related to pixel density or scaling on high-DPI displays (e.g., macOS Retina).

Environment:

  • Platform: macOS 15.6.1
  • Display: Retina (high-DPI)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions