Im trying to make a FPS window to my game but im getting a NullPointerException
Do you guys know why
The is the same from BSPTest
private BranchGroup createHUD(ExtXith3DEnvironment env, RenderPassConfigProvider passConfig, Canvas3D canvas, Xith3DDemoFolder demoFolder) throws Exception
{
BranchGroup hudBranch = new BranchGroup();
HUD hud = new HUD(canvas, 800, 600, this);
Image crosshair = new Image(hud.getSizeOfPixels(32, 32), "src/Textures/CrosshairWhite.png", true);
hud.addWidget(crosshair, (hud.getResolution().x - crosshair.getWidth()) / 2f, (hud.getResolution().y - crosshair.getHeight()) / 2f);
FPSCounter fpsCounter = new FPSCounter(100, 30, "src/Textures/YellowBorder.png");
fpsCounter.setFontColor( new Color3f(0.12f, 1.0f, 0.18f) );
this.addFPSListener(fpsCounter);
hud.addWidget(fpsCounter, 650, 520);
hudBranch.addChild(hud);
env.addBranchGraph( hudBranch );
env.addRenderPass( new RenderPass(hudBranch, passConfig) );
return( hudBranch );
}
Whe i try to run i get this error
Exception in thread "main" java.lang.NullPointerException
at org.xith3d.ui.hud.utils.WidgetTheme.<init>(WidgetTheme.java:473)
at org.xith3d.ui.hud.utils.WidgetTheme.<init>(WidgetTheme.java:500)
at org.xith3d.ui.hud.HUD.getTheme(HUD.java:172)
at org.xith3d.ui.hud.widgets.Label.<init>(Label.java:639)
at org.xith3d.ui.hud.widgets.Label.<init>(Label.java:657)
at org.xith3d.ui.hud.widgets.FPSCounter.<init>(FPSCounter.java:160)
at org.xith3d.ui.hud.widgets.FPSCounter.<init>(FPSCounter.java:221)
at org.xith3d.ui.hud.widgets.FPSCounter.<init>(FPSCounter.java:281)
at Project.game.createHUD(game.java:122)
at Project.game.<init>(game.java:152)
at Project.game.main(game.java:174)
I tryied to run the BSPTest and it runs well but it dosent appear the FPS window