jonathanperret / paysage

Paysage is a visual shared playground for code.
http://paysage.xyz
GNU Affero General Public License v3.0
19 stars 8 forks source link

3D processing sketches do not work #104

Open jonathanperret opened 7 years ago

jonathanperret commented 7 years ago

Here's a basic sketch using Processing.js's 3D capabilities:

void setup() {
  size(300, 300, P3D);
}

void draw() {
  lights();
  background(0);

  translate(width/2, height/2, 0);
  rotateX(-0.5);
  rotateY(millis()/1000.0);
  box(100);
}

When pasted into Paysage, this fails with an error on modelView.rotateX. This is Processing.js's way of telling us that the 3D mode initialization failed.

Actually, what happens is that the Paysage renderer calls size() by itself to fill the rendering area, without specifying a rendering mode, which is the same as specifying P2D. This used to be done after setup() ran, which meant a size() call from setup() could set the mode to P3D, but this caused issue #68, so we moved the size() call earlier. And given that it is not possible to change the rendering mode once it is set, this precludes running P3D sketches.

Note that in a similar fashion, our preemptive background() call (the fix for #76) probably also forces the sketch in P2D mode.

juliendorra commented 6 years ago

Should we consider this a Won't Fix?

I'm quite satisfied with Paysage being a 2D tool.

The only issue I can see is that a growing number of people expect Processing sketches to work in 3D, and we directly point them from the programmer to a reference that includes 3D commands!

Maybe we add this to version 2 roadmap? (p5js, bug report in the editor, 3D, etc.)