# Check which renderer is active?

**URL:** <https://discourse.processing.org/t/check-which-renderer-is-active/6452>\
**Category:** Processing\
**Created:** [December 9, 2018, 9:59pm UTC](https://discourse.processing.org/t/check-which-renderer-is-active/6452 "2018-12-09T21:59:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ffd8](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ffd8/32/815_2.png) [@ffd8](https://discourse.processing.org/u/ffd8)\
**Post date:** [December 9, 2018, 9:59pm UTC](https://discourse.processing.org/t/check-which-renderer-is-active/6452/1 "2018-12-09T21:59:27Z")

</div>

Was checking out the source code on GitHub and found many mentions to ‘this.renderer’ for internal use to see which renderer is in use (P2D, P3D) – just wondering if we’re able to access this variable? Was interested to alternate some code in a library based on P3D being in use or not.

Tried:

```auto
this.renderer
PApplet.renderer

```

Both report that it’s not visible…

---

<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:** [December 10, 2018, 12:17am UTC](https://discourse.processing.org/t/check-which-renderer-is-active/6452/2 "2018-12-10T00:17:27Z")

</div>

```java
// https://Discourse.Processing.org/t/check-which-renderer-is-active/6452/2
// GoToLoop (2018/Dec/09)

void setup() {
  size(800, 600, P2D); // JAVA2D, FX2D, P2D, P3D
  final String render = discoverRenderer(this);
  println(render);
  exit();
}

static final String discoverRenderer(final PApplet p) {
  final Object window = p.getSurface().getNative();
  final PGraphics pg = p.getGraphics();

  if (window instanceof javafx.scene.canvas.Canvas) return FX2D;
  else if (pg.isGL()) return pg.is3D()? P3D : P2D;
  return JAVA2D;
}

```
