i have an environment that i want to add new viewports into by pressing a JButton. The code i have works if you hard code my addViewPort method into the initial setup but fails if it is tried to be added once the environment has been initialized.
public void addViewportPanel()
{
numOfViewports++;
// System.out.println(DisplaySystem.getDisplaySystem());
osRenderer.add(((LWJGLDisplaySystem) DisplaySystem.getDisplaySystem()).createOffscreenRenderer(320, 320));
osRenderer.get(numOfViewports).setBackgroundColor(new ColorRGBA(0f, 0f, 0f, 1f));
CameraNode temp2;
temp2 = new CameraNode("Camera Node Offscreen", osRenderer.get(numOfViewports).getCamera());
camNode.add(temp2);
temp2.setLocalTranslation(new Vector3f(0, 50, 50));
temp2.lookAt(Vector3f.ZERO, Vector3f.UNIT_Z);
temp2.updateGeometricState(0, true);
OffScreenViewPort temp1;
temp1 = new OffScreenViewPort(camNode.get(numOfViewports));
view.add(temp1);
temp1.setPreferredSize(new Dimension(320, 320));
JFrame tempJFrame = new JFrame();
frame.add(tempJFrame);
tempJFrame.setLayout(new GridLayout(1, 1));
tempJFrame.add(temp1);
tempJFrame.pack();
tempJFrame.setLocation(0, 0);
tempJFrame.setVisible(true);
}
The exception is thrown by the LWJGLOffScreenRenderer when it is being initialized. any suggestions on what the problem might be?