Library creation help

Hey guys,

So, I am not the most experienced p5 user but I am trying to write a “Picking” library for a specific project of mine. In the picking library, I need to create a “buffer” which is basically a hidden canvas which the user can interact with.

I am basing a lot of my code of the original Picking library made by Nicolas Clavaud for Processing. After decompiling the .jar file I have found a few things which I am struggling to think of a way to implement in JS.

The original picking library has a “buffer” class, which is basically a replica of the canvas. This class extends P3D so that it can do this.

I have 2 questions regarding this. Primarily, how would I extend the WEBGL renderer (p5.RendererGL) with a new class? (or function since classes are different in .js)

My second question is a bit naive since I do not have much experience in .js but what is the equivalent of a public void?

Thanks guys

EDIT: here is the link to the decompiled .jar files from the original Picking lib

You can create a class which extends p5.RendererGL: :nerd_face:

Just ignore it. :wink:

dang, is it really that simple? I thought I would need to do like a bunch of stuff with prototype…

@GoToLoop this is more like ES6 syntax right?

ES6 is from 2015 and by 2017 most browsers had most of its new features, including class: :sailboat:

Dang, that’s useful

If I may, can I ask whether you would know if I could recreate the Processing PApplet’s .record function somehow? It’s pretty necessary for my lib.

I was thinking copy() could be used in a similar way to .record but I’m not entirely sure.

Just ignore it :wink:
should I use function or something?

1st step you should take in order to make a lib is creating a repo for it: :octopus:

You can post the original “.java” file(s) you’re attempting to convert to JS there. :coffee:

Then create a new “.js” file w/ you attempt conversion, so others can chime in too. :bellhop_bell:

thanks man, means a lot to me

I already have a repo but I haven’t filled it in yet. I’ll make a post when I have got everything set up :slight_smile:

thanks again.