# Is it possible to extend the classes PGraphics/ PGraphics3D?

**URL:** <https://discourse.processing.org/t/is-it-possible-to-extend-the-classes-pgraphics-pgraphics3d/1593>\
**Category:** Libraries\
**Created:** [July 8, 2018, 2:42pm UTC](https://discourse.processing.org/t/is-it-possible-to-extend-the-classes-pgraphics-pgraphics3d/1593 "2018-07-08T14:42:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![teresa](https://avatars.discourse-cdn.com/v4/letter/t/958977/32.png) [@teresa](https://discourse.processing.org/u/teresa)\
**Post date:** [July 8, 2018, 2:42pm UTC](https://discourse.processing.org/t/is-it-possible-to-extend-the-classes-pgraphics-pgraphics3d/1593/1 "2018-07-08T14:42:55Z")

</div>

Hello,

I am currently working with the Keystone library, which enables to map projections onto surfaces. The library uses an offscreen buffer (PGraphics object) to draw the sketch. I’ve written a simple programm, consisting of a costum class and some methodes, which I would like to display on the offscreen. I’ve tried to extend the PGraphic3D class with my methodes and classes inorder to invoke them with the offscreen object, however, I’ve failed implementing them correctly. Consequently, I was wondering, if it is even possible to extend the classes PGraphics/ PGraphics3D ?

Greets,  
Teresa

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 8, 2018, 3:18pm UTC](https://discourse.processing.org/t/is-it-possible-to-extend-the-classes-pgraphics-pgraphics3d/1593/2 "2018-07-08T15:18:32Z")

</div>

> [@teresa](#):
>
> … I was wondering if it is even possible to extend the classes PGraphics/PGraphics3D?

I’ve done to PGraphicsJava2D here. But never tried PGraphics3D yet: 🙄

- [PShape inside a class, or extend PShape - Processing 2.x and 3.x Forum](https://Forum.Processing.org/two/discussion/16314/pshape-inside-a-class-or-extend-pshape#Item_4)

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [July 8, 2018, 3:37pm UTC](https://discourse.processing.org/t/is-it-possible-to-extend-the-classes-pgraphics-pgraphics3d/1593/3 "2018-07-08T15:37:31Z")

</div>

It’s definitely possible. I have to do this in PraxisLIVE to work around some Processing issues. Make sure you’re setting up the parent, primary and size.

> <https://github.com/praxis-live/praxis/blob/master/praxis.video.pgl/src/org/praxislive/video/pgl/PGLGraphics.java>

---

<div class="post-metadata">

**Author:** ![teresa](https://avatars.discourse-cdn.com/v4/letter/t/958977/32.png) [@teresa](https://discourse.processing.org/u/teresa)\
**Post date:** [July 8, 2018, 5:07pm UTC](https://discourse.processing.org/t/is-it-possible-to-extend-the-classes-pgraphics-pgraphics3d/1593/4 "2018-07-08T17:07:47Z")

</div>

Thank you very much! Your code helped me a lot! 🙂

---

<div class="post-metadata">

**Author:** ![teresa](https://avatars.discourse-cdn.com/v4/letter/t/958977/32.png) [@teresa](https://discourse.processing.org/u/teresa)\
**Post date:** [July 8, 2018, 5:10pm UTC](https://discourse.processing.org/t/is-it-possible-to-extend-the-classes-pgraphics-pgraphics3d/1593/5 "2018-07-08T17:10:05Z")

</div>

Thank you for your help. I’ve set up the parent, primary and size. it worked! 🙂
