We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Presentation mode - NullPointerException!
Page Index Toggle Pages: 1
Presentation mode - NullPointerException?! (Read 799 times)
Presentation mode - NullPointerException?!
Aug 27th, 2009, 2:42am
 
Hello, whenever I try to run any of my sketches in Presentation Mode, I get this:

Code:
java.lang.NullPointerException
at processing.core.PApplet.main(PApplet.java:6551)

I'm using Processing 1.0.2, otherwise successfully, on Ubuntu 9.04.

Anyone else have similar problems Anyone got any clues here

Edited:

I really need to run some stuff full-screen, or as near as possible, and when I first posted this I was drawing a blank. I may be there now, but I think this is worth recording: The suggestion here, from Marius Watz gave me
Code:
java.awt.IllegalComponentStateException: The frame is displayable 

...until I added frame.removeNotify(); which was missing from where I first saw the technique, presumably because it was unnecessary in 2007. Then if I included frame.setLocation(0,0); in setup as Marius suggested, it just showed as blank. Finally, with that in draw() instead, and the main Ubuntu toolbar shoved over to the right-hand side, I *think* I've cracked it.


More dead ends I found: this FullScreen API isn't working at all with OPENGL on my system, and I'm pretty sure I'm doomed to hopeless frame rates without that. The FullScreenApp from the Learning section here gives me almost the same NullPointerException as Present:
Code:
java.lang.NullPointerException
at processing.core.PApplet.main(PApplet.java:6551)
at FullScreenTest.main(FullScreenTest.java:22)
Re: Presentation mode - NullPointerException?!
Reply #1 - Sep 4th, 2009, 5:28am
 
...so, um, does nobody else have this problem? I'm just not being able to get Present to work at all. It's not strictly necessary, of course, but this NullPointer thing is just weird! Am I missing something?
Re: Presentation mode - NullPointerException?!
Reply #2 - Sep 4th, 2009, 6:59am
 
I just tested the FullScreenApp you point to, and it works for me, on Windows XP.
Now, I have hit an issue and report it in case it is useful to somebody else. For the test, I just save the example as 'FS', so I got a FS.exe file. Running it silently failed (no trace, etc.).
So I ran the jar instead:
Code:
E:\Dev\PhiLhoSoft\Processing\FS\application.windows\lib
> java -Djava.ext.dirs=. FS
java.lang.ClassNotFoundException: FullScreenApp
at java.net.URLClassLoader$1.run(Unknown Source)

That's where I discovered the FullScreenApp string (second parameter of main()) have to be changed to the name of the sketch. It is stated in the page, but of course I overlooked that...

But obviously, that's not your problem.

Aha! I was annoyed because in the source I have, the line 6551 couldn't generate an NPE (NullPointerException).
I looked at the release notes, saw that 1.0.2 was released on Feb 21, looked at PApplet.java history, saw that one day before, revision 5469 was checked in.
And in this version, at lines 6550-6551, we have:
Code:
	    DisplayMode mode = displayDevice.getDisplayMode();
fullScreenRect = new Rectangle(0, 0, mode.getWidth(), mode.getHeight());
where displayDevice is a GraphicsDevice obtained via: Code:
	  GraphicsEnvironment environment =
GraphicsEnvironment.getLocalGraphicsEnvironment();
displayDevice = environment.getDefaultScreenDevice();
(if you don't specify --display=n option).
In short, it looks like mode is null for some reason. Like Java fails to get your graphics configuration.

I see if you specify an additional argument: --exclusive you go another code path, perhaps you will avoid this NPE.
Page Index Toggle Pages: 1