# screenX screenY equivalent in p5.js

**URL:** <https://discourse.processing.org/t/screenx-screeny-equivalent-in-p5-js/10581>\
**Category:** Coding Questions\
**Created:** [April 23, 2019, 7:48pm UTC](https://discourse.processing.org/t/screenx-screeny-equivalent-in-p5-js/10581 "2019-04-23T19:48:05Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [April 23, 2019, 8:14pm UTC](https://discourse.processing.org/t/screenx-screeny-equivalent-in-p5-js/10581/4 "2019-04-23T20:14:16Z")

</div>

if I call it like this:

```auto
  var worldMy = createVector( 0,0,0 );
  let screenCoor = projectWorldToCanvas( canvas, worldMy ) ;

```

I receive

> TypeError: canvas.uMVMatrix is undefined (sketch: line 99)
> 
> p5.RendererGL: enabled webgl context

in

```auto
/* Project a vector from World to Canvas coordinates. */
function projectWorldToCanvas(canvas, vWorld) {
  // Calculate the ModelViewProjection Matrix.
  var mvp = (canvas.uMVMatrix.copy()).mult(canvas.uPMatrix); // !!!!!!!!!!!!!!!!!! HERE 

  // Transform the vector to Normalized Device Coordinate.

```

?

I gather that of the 3 funcs in [Add screenX, screenY and screenZ · Issue #1553 · processing/p5.js · GitHub](https://github.com/processing/p5.js/issues/1553)  
I only need projectWorldToCanvas ?  
and not the other?

That’s overly complicated…

Is canvas = 2D and world = 3D?

Thanks for your help!

Chrisir

---

_[View the full topic](https://discourse.processing.org/t/screenx-screeny-equivalent-in-p5-js/10581)._
