processingjs
in
Processing with Other Languages
•
1 year ago
Hello
After work with processing now I'm trying processingjs.
I have not found any good forum about processingjs by now.
I have a few questions and was wondering if anyone
on the forum has worked with javascript processing and could help me.
I'm trying to make an application in wich coexist the 3D and 2D.
To do this I mounted a PGraphics object and render over it the 3D scene.
Later over the P2D general scene I draw the GUI (controls, interface...)
That method worked perfectly in my conventional processing, but when trying to run with the program js processing blocks me and stops responding to mouse events.
By testing I can see that everything is broken by introducing lighting
pg.lights ();
strokeWeight() not work either in a P3D scene (This is another problem)
Has anyone had the same problem and found a solution?
It would be helpful for me
thanks
This is the code: It works in processing but not in processingjs
- PGraphics pg;
- float tx;
- float ty;
- void setup()
- {
- size(500,300);
- pg = createGraphics(500,300,P3D);
- }
- void draw()
- {
- //3D scene
- noLoop();
- pg.beginDraw();
- pg.background(32,64,128);
- pg.lights();
- pg.fill(255,128,32);
- pg.stroke(0,0,0,255);
- pg.strokeWeight(2);
- pg.translate(250,150,0);
- pg.translate(tx,ty,0);
- pg.box(100);
- pg.endDraw();
- image(pg,0,0);
- //2D scene
- fill(0,255,0,64);
- stroke(0,0,0,255);
- strokeWeight(2);
- rect(0,0,100,30);
- text("This is 2D",5,20);
- }
- void mouseDragged()
- {
- tx = tx + (mouseX - pmouseX);
- ty = ty + (mouseY - pmouseY);
- redraw();
- }
1