hype / HYPE_Processing

HYPE for Processing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HCanvas error with Processing 3.0

brockcoop opened this issue · comments

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

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
#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

@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

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.

@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()

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.

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.