# Picking with JAVA2D

**URL:** <https://discourse.processing.org/t/picking-with-java2d/859>\
**Category:** Libraries\
**Created:** [June 11, 2018, 1:52am UTC](https://discourse.processing.org/t/picking-with-java2d/859 "2018-06-11T01:52:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ferrari](https://avatars.discourse-cdn.com/v4/letter/f/82dd89/32.png) [@ferrari](https://discourse.processing.org/u/ferrari)\
**Post date:** [June 11, 2018, 1:52am UTC](https://discourse.processing.org/t/picking-with-java2d/859/1 "2018-06-11T01:52:13Z")

</div>

hello, is possible to use picking library with the default renderer? (java2d, no P3D or P2D)

in processing 1.5 it was possible…but in processing 3…not anymore.

any idea?

or other library o code?

i need for pick complex shapes…not only rect or circles…

thanks a lot !!

---

<div class="post-metadata">

**Author:** ![TfGuy44](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tfguy44/32/41_2.png) [@TfGuy44](https://discourse.processing.org/u/TfGuy44)\
**Post date:** [June 11, 2018, 1:57am UTC](https://discourse.processing.org/t/picking-with-java2d/859/2 "2018-06-11T01:57:17Z")

</div>

Dunno. You can always maintain your own off-screen buffer (in a PGraphics) that uses false-color drawings of things to do your own picking.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 19, 2018, 12:26am UTC](https://discourse.processing.org/t/picking-with-java2d/859/3 "2018-06-19T00:26:00Z")

</div>

The source code for Picking is very compact – you can find it here:

> **[nclavaud/picking](https://github.com/nclavaud/picking/tree/master/src/picking)**
>
> Processing Library Template for Eclipse. Contribute to nclavaud/picking development by creating an account on GitHub.

At first glance, it looks like the dependency on P2D / P3D (OpenGL) is in Buffer.java – specifically, the use of PShader (31) and the fact that Buffer extends PGraphics3D (33):

> <https://github.com/nclavaud/picking/blob/master/src/picking/Buffer.java#L30-L34>

As @TfGuy44 mentioned, you could write your own false-color buffer from scratch (copy the picking concept). As an alternative, you could fork Picking and write your own `Buffer` that extends `PGraphicsJava2D` instead.

---

<div class="post-metadata">

**Author:** ![ferrari](https://avatars.discourse-cdn.com/v4/letter/f/82dd89/32.png) [@ferrari](https://discourse.processing.org/u/ferrari)\
**Post date:** [June 19, 2018, 3:58pm UTC](https://discourse.processing.org/t/picking-with-java2d/859/4 "2018-06-19T15:58:41Z")

</div>

OK. I will try. Thank you!

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 19, 2018, 8:30pm UTC](https://discourse.processing.org/t/picking-with-java2d/859/5 "2018-06-19T20:30:35Z")

</div>

Good luck!

The Picking repo does not accept issues, but if you do a fork then you might also be able to do a pull request – or simply suggest that your changed version be considered for integration back into the original library…
