CameraGameState produces NPE when setActive is called!

Ok, I thought I’d give the CameraGameState a try and I get a NPE from LWJGL GL11. I’ve looked on the forums here and found the issue being raised and that something needs to be set in the OpenGL thread. I’m really curious what needs to be set and how to do that.



The only thread I could find on the issue is here



Also, on the wiki I noticed the note that Renderer.setCamera() has to be done in the OpenGL thread although I cannot figure out how to acheive this.  I noticed from the thread above that there is something called a GameTaskQueueManager.  And this just has me thoroughly confused. Why it is necessary for me to interact with the queue for such a simple request. I think all this stuff should be handled under the hood.



Any help or information would be greatly appreciated, Thanks in Advance!

try to wrap the setActive call in a GameTask.

the GameTaskQueuemanager then executes the task in the opengl thread:


      GameTaskQueueManager.getManager().update(new Callable<Object>() {
         public Object call() throws Exception {
                gamestate.setActive(true);
            return null;
         }
      });

Thanks for the quick reply [Core-Dumped] I appreciate it.



And yes that was really all I needed to get it to work.



Still wondering why this just isn't done in the Renderer to avoid nasty NPE suprises?

thats just the nature of StandardGame, because it creates a separate OpenGL thread, the developer needs to take care to execute some things inside the OpenGL thread.