Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

376
Views
Error in p5.js: "pushMatrix() not used, see push()"

Every time I run my code, it gives me an error:

p5.js says: An error with message "pushMatrix() not used, see push()" occured inside the p5js library when pushMatrix was called (on line 175 in sketch.js [/sketch.js:175:13])

If not stated otherwise, it might be an issue with the arguments passed to pushMatrix. (http://p5js.org/reference/#/p5/pushMatrix)

However, pushMatrix() does not exist in my code. When I try to fix it by replacing push() with pushMatrix(), it gives me the same error:

p5.js says: An error with message "pushMatrix() not used, see push()" occured inside the p5js library when pushMatrix was called (on line 175 in sketch.js [/sketch.js:175:13])

If not stated otherwise, it might be an issue with the arguments passed to pushMatrix. (http://p5js.org/reference/#/p5/pushMatrix)

My code: https://pastebin.com/gMxwvJLA (StackOverflow wouldn't let me post the question because the code was so large)

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In short: pushMatrix() is not a valid function in p5. It doesn't exist. You want to find and replace all usages of pushMatrix() with push() and popMatrix() with pop().

With those replacements your code runs without any errors and I see a square spinning around in the center of the canvas.

The error message is not particularly helpful, but looking at the source code clarifies things a lot.

/**
 * @for p5
 * @requires core
 * These are functions that are part of the Processing API but are not part of
 * the p5.js API. In some cases they have a new name, in others, they are
 * removed completely. Not all unsupported Processing functions are listed here
 * but we try to include ones that a user coming from Processing might likely
 * call.
 */

import p5 from './main';

p5.prototype.pushStyle = function() {
  throw new Error('pushStyle() not used, see push()');
};

p5.prototype.popStyle = function() {
  throw new Error('popStyle() not used, see pop()');
};

p5.prototype.popMatrix = function() {
  throw new Error('popMatrix() not used, see pop()');
};

p5.prototype.pushMatrix = function() {
  throw new Error('pushMatrix() not used, see push()');
};

export default p5;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!