Clip function crashes live html canvas (unresolved)

not sure quite how to even phrase this question but i’m trying to use the clip function and it works fine on local processing, but in my live html canvas (with processing.js) invoking it in any capacity, even just using noClip(); immediately breaks the program. no error no way to debug it at all. it’s definitely clip that’s doing this. any guidance? thanks

here’s some relevant code:

<!doctype html>
<meta charset="utf-8">
	<title>pde test</title>
	<script type="text/javascript" src="processing.js"></script>
	<link rel="stylesheet" href="index.css">

	<canvas data-processing-sources="topdown_engine.pde camera.pde grid.pde scene.pde tile.pde sprite.pde"></canvas>
/* @pjs preload="data/tall_tex.png"; */

Scene scene;
int TICK;

void setup(){
  noClip(); //adding this line makes the canvas immediately go blank, commenting it out fixes it
  TICK = 0;

  scene = new Scene();

void draw(){


void runGameTEMP(){
    float[] mpos = scene.mainCam.tileAt(mouseX*((float),mouseY*((float),0);
  for(int i = 1;i < scene.sprites.size();i ++){


here’s what my canvas looks like when i invoke clip

do i just need to import this somehow? it’s like it doesn’t recognize it at all. again this works totally fine in a local processing sketch, just not in html

Hi @canslp,

Don’t stick on processing.js too much. It’s no future tech. If you want to provide your stuff to the web, it would be better to use p5js. Don’t know your expertise but it is imo not that hard to translate the processing java to p5js… You should give it a try …


which one is faster for graphics, that’s my main priority atm

Hi @canslp,

when comparing processingjs to p5js, I would strongly assume that the latter is far more optimized in terms of browser compatibility and performance. Especially since both are based on javascript. It’s not like you could compare it with processing java.

— mnse

oh is p5js weakly typed. is there like a version of it that is strongly typed

fwiw i would still like to know if the clip function can work in html and if not what i should do instead


I can’t find the noClip function in processing.js at all !?
Looks to me as it is not implemented for processing.js…

Have you checked your console output when running with noClip if your sketch is running or throws errors !?

— mnse

well the console doesn’t really ever throw errors in the html side. again clip and noClip both work in processing (the side that throws errors). i think you are right that for some reason the html interpreter just does not have this thing

Hi @canslp,

I’ve now checked this on my box. Unfortunately I had only mobile access to it the last days …
But when I tried it the console now it clearly says:

ReferenceError: noClip is not defined

and so for sure the processing bail out …

— mnse

PS: Also I made a quick example here how to do fast clipping with p5js+shader