hype / HYPE_Processing

HYPE for Processing
BSD 3-Clause "New" or "Revised" License
927 stars 149 forks source link

HCanvas error with Processing 3.0 #87

Closed brockcoop closed 9 years ago

brockcoop commented 9 years ago

When trying to run HCanvas example_001 from skillshare : Listening for transport dt_socket at address: 8232 HYPE.pde:1:0:1:0: NullPointerException Finished. Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help → Troubleshooting. Could not run the sketch. [Finished in 75.8s]

it works with Processing 2.2.1

hype commented 9 years ago

yeah i just tagged it today... as something we need to fix... i encountered the same error today while working through the library JAR port of hype.

On Friday, August 14, 2015, brockcoop notifications@github.com wrote:

When trying to run HCanvas example_001 from skillshare : Listening for transport dt_socket at address: 8232 HYPE.pde:1:0:1:0: NullPointerException Finished. Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help � Troubleshooting. Could not run the sketch. [Finished in 75.8s]

it works with Processing 2.2.1

— Reply to this email directly or view it on GitHub https://github.com/hype/HYPE_Processing/issues/87.

Joshua Davis

234 Jefferson Ave. Mineola, New York 11501 m. +1.516.417.3111 e. studio@joshuadavis.com

portfolio : http://www.joshuadavis.com twitter : http://twitter.com/joshuadavis facebook : http://www.facebook.com/JoshuaDavisStudios instagram : http://instagram.com/praystation

hype commented 9 years ago

@christophertino when you get back from vacation... I hit this today when updating https://github.com/hype/HYPE_Processing/blob/library/examples/basics/basics_014_fading/basics_014_fading.pde NullPointerException on HCanvas

christophertino commented 9 years ago

Update: I can run basics_014_fading if I change line 14 to size(640,640, P2D); and line 21 to HCanvas(640,640,P2D);

For some reason HCanvas breaks when calling loadPixels(), but only when using the JAVA2D renderer.

hype commented 9 years ago

@shiffman

import hype.*;

HCanvas canvas;
HRect   rect;

void setup() {
    size(640,640);
    H.init(this).background(#242424);

    canvas = new HCanvas().autoClear(false).fade(5);
    H.add(canvas);

    canvas.add( rect = new HRect(25) ).noStroke().fill(#FF3300);
}

void draw() {
    rect.loc( (int)random(width), (int)random(height));
    H.drawStage();
}

here's what I tested against after moving loadPixels() to after beginDraw()

shiffman commented 9 years ago

Also related to this may be from: https://github.com/hype/HYPE_Processing/blob/library/src/main/java/hype/HCanvas.java#L262

if(!_renderer.equals(PConstants.JAVA2D))
_graphics.loadPixels();

I think you likely want to load the pixels here for all renderers including JAVA2D.

christophertino commented 9 years ago

Thanks for the help man. I think some of these renderers were explicitly defined for the benefit of Processing.js. Since we're dropping support for that, we can probably lose some of those references.