Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controlp5 2.2.5 not working with Processing 3.0.1 FX2D renderer #36

Closed
rozling opened this issue Dec 16, 2015 · 2 comments

Comments

@rozling
Copy link

@rozling rozling commented Dec 16, 2015

Windows 7, Processing 3.0.1

Taking a number of examples (e.g. button / slide / textfield), adding FX2D to the size() constructor consistently results in the following error which prevents the sketch from running:

ControlP5 2.2.5 infos, comments, questions at http://www.sojamo.de/libraries/controlP5
java.lang.NullPointerException
    at processing.javafx.PGraphicsFX2D$FontCache$Key.hashCode(PGraphicsFX2D.java:1423)
    at java.util.HashMap.hash(HashMap.java:338)
    at java.util.LinkedHashMap.get(LinkedHashMap.java:440)
    at processing.javafx.PGraphicsFX2D$FontCache.get(PGraphicsFX2D.java:1377)
    at processing.javafx.PGraphicsFX2D.handleTextFont(PGraphicsFX2D.java:1470)
    at processing.javafx.PGraphicsFX2D.textFontImpl(PGraphicsFX2D.java:1446)
    at processing.core.PGraphics.textFont(PGraphics.java:4232)
    at controlP5.ControlFont.adjust(Unknown Source)
    at controlP5.Label$SinglelineLabel.draw(Unknown Source)
    at controlP5.Label$SinglelineLabel.draw(Unknown Source)
    at controlP5.Label.draw(Unknown Source)
    at controlP5.Textfield.draw(Unknown Source)
    at controlP5.ControllerGroup.drawControllers(Unknown Source)
    at controlP5.ControllerGroup.draw(Unknown Source)
    at controlP5.ControlWindow.draw(Unknown Source)
    at controlP5.ControlWindow.draw(Unknown Source)
    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:497)
    at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1395)
    at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1388)
    at processing.core.PApplet.handleMethods(PApplet.java:1582)
    at processing.core.PApplet.handleDraw(PApplet.java:2412)
    at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:75)
    at processing.javafx.PSurfaceFX$1.handle(PSurfaceFX.java:1)
    at com.sun.scenario.animation.shared.TimelineClipCore.visitKeyFrame(TimelineClipCore.java:226)
    at com.sun.scenario.animation.shared.TimelineClipCore.playTo(TimelineClipCore.java:184)
    at javafx.animation.Timeline.impl_playTo(Timeline.java:176)
    at javafx.animation.AnimationAccessorImpl.playTo(AnimationAccessorImpl.java:39)
    at com.sun.scenario.animation.shared.InfiniteClipEnvelope.timePulse(InfiniteClipEnvelope.java:110)
    at javafx.animation.Animation.impl_timePulse(Animation.java:1102)
    at javafx.animation.Animation$1.lambda$timePulse$26(Animation.java:186)
    at javafx.animation.Animation$1$$Lambda$102/1585508389.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javafx.animation.Animation$1.timePulse(Animation.java:185)
    at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
    at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:521)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:505)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$400(QuantumToolkit.java:334)
    at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$56/874026615.run(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$145(WinApplication.java:101)
    at com.sun.glass.ui.win.WinApplication$$Lambda$52/1125138434.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:745)
handleDraw() called before finishing
Could not run the sketch (Target VM failed to initialize).
For more information, read revisions.txt and Help ? Troubleshooting.
@sojamo

This comment has been minimized.

Copy link
Owner

@sojamo sojamo commented Jan 5, 2016

In the case of using the FX2D renderer, controlP5's BitFont can't be rendered and by attempting to do so the above error message is caused. To work around this, set the font to a non-BitFont by calling cp5.setFont(createFont("Arial",10)); right after creating an instance of cp5.

@rozling

This comment has been minimized.

Copy link
Author

@rozling rozling commented Jan 11, 2016

This worked for me (sorry for delay in confirming); thanks for the workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.