I'm trying to write a simple FX8 image display program on the Raspberry Pi2 with only 64MB of GPU memory. This results in a NullPointer Exception at com.sun.prism.impl.BaseGraphics.drawTexture attempting to render the ImageView. This is with the packaged Oracle JDK8 (build 1.8.0-b132).
I was told on the Pi stackexchange that 128MB is the minimum GPU memory to use the OpenGL features, which doesn't seem unreasonable... but I don't think I'm doing anything fancy enough to need OpenGL.
Question
I'm new to JavaFX and the Pi, so maybe I'm headed in the wrong direction. I'm using Rasbian/X11, but am not tied to it. Does JavaFX8 have a mechanism that will allow me display a fullscreen image without using OpenGL?
MCVE:
My minimum demonstration is very straightforward: an AnchorView holding an ImageView, displaying a 29kB PNG (1847x1080).
package sample;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception
{
Image image = new Image("/Sponsor.png");
ImageView imageview = new ImageView(image);
AnchorPane root = new AnchorPane(imageview);
Scene scene = new Scene(root, 400, 275);
primaryStage.setScene(scene);
imageview.setFitHeight(scene.getHeight());
imageview.setFitWidth(scene.getWidth());
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Stack trace
glGetError 0x505
java.lang.NullPointerException
at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:389)
at com.sun.prism.impl.ps.BaseShaderGraphics.drawTexture(BaseShaderGraphics.java:139)
at com.sun.prism.image.Coords.draw(Coords.java:46)
at com.sun.prism.image.CompoundCoords.draw(CompoundCoords.java:94)
at com.sun.javafx.sg.prism.NGImageView.renderContent(NGImageView.java:134)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2043)
at com.sun.javafx.sg.prism.NGImageView.doRender(NGImageView.java:103)
at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1951)
at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:225)
at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:575)
at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2043)
at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1951)
at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:469)
at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:324)
at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:89)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:129)
at java.lang.Thread.run(Thread.java:744)