Camera with monitor

Hey folks i tried somthing which maybe is a little bit beyond my skills but anyway i think its a nice feature.

i tried to copy somehow the main stuff from the renderer.cameraman Test and to create a camera class so here is the code:

import com.jme.image.Texture;
import com.jme.math.Vector3f;
import com.jme.renderer.TextureRenderer;
import com.jme.scene.CameraNode;
import com.jme.scene.Node;
import com.jme.scene.shape.Quad;
import com.jme.scene.state.LightState;
import com.jme.scene.state.TextureState;
import com.jme.scene.state.ZBufferState;
import com.jme.system.DisplaySystem;

public class InGameCam {
   private CameraNode camNode;
   private DisplaySystem display;
   private TextureRenderer tRenderer;
   private float lastRend = 1;
   private float throttle = 1/30f;
   private Texture fakeTex;
   public InGameCam(DisplaySystem display,int sizeX, int sizeY) {
      this.display = display;
      fakeTex = new Texture();

      tRenderer = display.createTextureRenderer(sizeX,sizeY, TextureRenderer.RENDER_TEXTURE_2D);
      camNode = new CameraNode("Camera Node", tRenderer.getCamera());
       camNode.updateGeometricState(0, true);
   public Node createMonitor() {
      Node monitorNode = new Node("Monitor Node");
       Quad quad = new Quad("Monitor");
       quad.initialize(3, 3);
       ZBufferState buf = display.getRenderer().createZBufferState();
       TextureState screen = display.getRenderer().createTextureState();
       monitorNode.updateGeometricState(0.0f, true);
      return monitorNode;
   public CameraNode getCamNode() {
      return camNode;
   protected void render(float tpf) {
       lastRend += tpf;
       if (lastRend > throttle ) {
         lastRend = 0;

i didnt understand everything of what im doing espacially not the line tRenderer.render(camNode,fakeTex); in the test class ther was instead of the camNode the model which is viewed but i dont get what this method does i thougth it updates this fake Texture so it can display moving things but then i dont understand what the spatial is for. nevertheless my actual problem is that i get a nullpointer Exception in this Line:


at com.jme.renderer.lwjgl.LWJGLTextureRenderer.<init>(Unknown Source)
at com.jme.system.lwjgl.LWJGLDisplaySystem.createTextureRenderer(Unknown Source)

thanks for help

you get NullPointer Exceptions if you try to create the texture renderer outside the opengl thread.

if that is the problem, use GameTaskQueueManager to create it inside the opengl thread.

yepp did forget about the ogl thread once more

now i have the problem that the monitor quad is just white. any idea why that is?