OpenEndedGroup / Field2

Field2 — an coding environment for making art
http://openendedgroup.com/field2
57 stars 10 forks source link

Processing Renderers. #36

Closed the-graytest closed 10 years ago

the-graytest commented 10 years ago

If you specify the rendered as P3D, you lose all 2D functionality, the sketches simply won't run. Ideally, it should still run, usually just slower. Issue is temporarily fixed by removed the P3D from the setup but, the bigger issue is that a fair number of 3D sketches (that i've tried anyway) use both 2D and 3D functionality. Looking in the source to try and find a cause.

marcdownie commented 10 years ago

That is very unexpected! (I'm aware that the converse is, and should be, true: 3d things don't work in 2d mode. I got the impression that the P3D renderer was by far the most popular one, hence the default behavior. I don't mind selecting it with a preference // command line option, but I'm afraid Processing just isn't architected to change it on the fly).

Can you give an example of a piece of 2d that isn't working in 3d mode?

Marc

On Mon, Aug 4, 2014 at 4:26 PM, tamblc notifications@github.com wrote:

If you specify the rendered as P3D, you lose all 2D functionality, the sketches simply won't run. Ideally, it should still run, usually just slower. Issue is temporarily fixed by removed the P3D from the setup but, the bigger issue is that a fair number of 3D sketches (that i've tried anyway) use both 2D and 3D functionality. Looking in the source to try and find a cause.

— Reply to this email directly or view it on GitHub https://github.com/CCC-RPI/Field2/issues/36.

the-graytest commented 10 years ago

hmm... I pulled to see if it was a bug in the latest version and now the Java 'Trampoline' won't show any boxes/ the timeline...

 remote.error :: [exception thrown by asynchronous websocket handler <fielded.webserver.Server$3@43d59729> while servicing <{"address":"initialize.finished","payload":0,"from":0} / initialize.finished -> 0 0, java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 1
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2237)
    at fielded.webserver.Server$2.onMessage(Server.java:118)
    at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:457)
    at org.java_websocket.WebSocketImpl.deliverMessage(WebSocketImpl.java:561)
    at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:328)
    at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:149)
    at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:593)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at fielded.ServerSupport.lambda$new$376(ServerSupport.java:120)
    at fielded.ServerSupport$$Lambda$176/503938393.handle(Unknown Source)
    at fielded.webserver.Server$3.handle(Server.java:158)
    at fielded.webserver.Server$2.lambda$onMessage$233(Server.java:118)
    at fielded.webserver.Server$2$$Lambda$301/2022670698.call(Unknown Source)
    at fielded.webserver.Server.lambda$queue$236(Server.java:224)
    at fielded.webserver.Server$$Lambda$302/741531151.run(Unknown Source)
    at fielded.webserver.Server.update(Server.java:201)
    at fielded.webserver.Server.lambda$new$235(Server.java:146)
    at fielded.webserver.Server$$Lambda$166/949581868.accept(Unknown Source)
    at field.graphics.Scene.wrappedCall(Scene.java:222)
    at field.graphics.Scene.update(Scene.java:194)
    at field.graphics.Scene.updateAll(Scene.java:166)
    at field.graphics.RunLoop.enterMainLoop(RunLoop.java:46)
    at fieldbox.FieldBox.go(FieldBox.java:25)
    at fieldbox.FieldBox.main(FieldBox.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at fieldagent.Trampoline.main(Trampoline.java:194)
]

Before that though, here's the coed that wasn't working

var P = Java.type('fieldprocessing.Processing').applet

 var yoff = 0.0;        // 2nd dimension of perlin noise
 P. size(640, 360);
_r=function() {
  P.background(51);

  P.fill(255);
  // We are going to draw a polygon out of the wave points
  P.beginShape(); 

  var xoff = 0.;       // Option #1: 2D Noise

  // Iterate over horizontal pixels
  for (var x = 0.; x <= P.width; x += 10) {
    // Calculate a y value according to noise, map to 
    var y = P.map(P.noise(xoff, yoff), 0, 1, 200,300); // Option #1: 2D Noise

    // Set the vertex
    P.vertex(x, y); 
    // Increment x dimension for noise
    xoff += 0.05;
  }
  // increment y dimension for noise
  yoff += 0.01;
  P.vertex(P.width, P.height);
  P.vertex(0, P.height);
  P.endShape(P.CLOSE);
}
marcdownie commented 10 years ago

Hmm. Everything building here. Try another pull.

Marc

On Mon, Aug 4, 2014 at 4:43 PM, tamblc notifications@github.com wrote:

hmm... I pulled to see if it was a bug in the latest version and now the Java 'Trampoline' won't show any boxes/ the timeline... remote.error :: [exception thrown by asynchronous websocket handler while servicing <{"address":"initialize.finished","payload":0,"from":0} / initialize.finished -> 0 0, java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 1 at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2237) at fielded.webserver.Server$2.onMessage(Server.java:118) at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:457) at org.java_websocket.WebSocketImpl.deliverMessage(WebSocketImpl.java:561) at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:328) at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:149) at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:593) Caused by: java.lang.ArrayIndexOutOfBoundsException: 1 at fielded.ServerSupport.lambda$new$376(ServerSupport.java:120) at fielded.ServerSupport$$Lambda$176/503938393.handle(Unknown Source) at fielded.webserver.Server$3.handle(Server.java:158) at fielded.webserver.Server$2.lambda$onMessage$233(Server.java:118) at fielded.webserver.Server$2$$Lambda$301/2022670698.call(Unknown Source) at fielded.webserver.Server.lambda$queue$236(Server.java:224) at fielded.webserver.Server$$Lambda$302/741531151.run(Unknown Source) at fielded.webserver.Server.update(Server.java:201) at fielded.webserver.Server.lambda$new$235(Server.java:146) at fielded.webserver.Server$$Lambda$166/949581868.accept(Unknown Source) at field.graphics.Scene.wrappedCall(Scene.java:222) at field.graphics.Scene.update(Scene.java:194) at field.graphics.Scene.updateAll(Scene.java:166) at field.graphics.RunLoop.enterMainLoop(RunLoop.java:46) at fieldbox.FieldBox.go(FieldBox.java:25) at fieldbox.FieldBox.main(FieldBox.java:40) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at fieldagent.Trampoline.main(Trampoline.java:194) ]

Before that though, here's the coed that wasn't working

var P = Java.type('fieldprocessing.Processing').applet

var yoff = 0.0; // 2nd dimension of perlin noise P. size(640, 360); _r=function() { P.background(51);

P.fill(255); // We are going to draw a polygon out of the wave points P.beginShape();

var xoff = 0.; // Option #1 https://github.com/CCC-RPI/Field2/issues/1: 2D Noise

// Iterate over horizontal pixels for (var x = 0.; x <= P.width; x += 10) { // Calculate a y value according to noise, map to var y = P.map(P.noise(xoff, yoff), 0, 1, 200,300); // Option #1 https://github.com/CCC-RPI/Field2/issues/1: 2D Noise

// Set the vertex P.vertex(x, y); // Increment x dimension for noise xoff += 0.05;

} // increment y dimension for noise yoff += 0.01; P.vertex(P.width, P.height); P.vertex(0, P.height); P.endShape(P.CLOSE); }

— Reply to this email directly or view it on GitHub https://github.com/CCC-RPI/Field2/issues/36#issuecomment-51122054.

marcdownie commented 10 years ago

The problem is that call to .size. Get rid of that.

.size in processing can only be called from init and we don't have an init.

marcdownie commented 10 years ago

I've made .size a no-op from JavaScript for now.