Hello all,
I’m using jMonkey as a panel inside a bigger application.
I start by adding the canvas to a JPanel then I add that JPanel to another one. This is when all hell breaks loose and I get a LWJGLException. I realize this is because the pBuffers are not supported by the graphic’s driver.
Thing is the Exception kicks in at a separated Thread at the bold line. Since it’s a separated Thread no try catch will catch it.
Is there a way to force the SimpleApplication to blow up when I still have control. Or maybe a test to see if all the functionalites need are supported so I can run safely in unknown computers.
This is some code so you can see what I’m doing:
[java]
class JPanelFather extends JPanel{
public void componentShown(ComponentEvent e) {
if (source == null) // To protect against null pointer
return;
cpanel = vis.getComponent(source, timestep);
cpanel.setVisible(true);
<strong>add(cpanel, BorderLayout.CENTER);</strong>
revalidate();
repaint();
}
}
class JPanelSon extends JPanel{
public JComponent getComponent() {
jme = new JmeComponent();
Canvas canvas = jme.getComponentAndStartIt();
removeAll();
setLayout(new BorderLayout());
add(canvas);
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
super.componentResized(e);
jme.resize(getBounds());
}
});
return this;
}
public class JmeComponent extends SimpleApplication {
}
[/java]
And the exception:
Aug 27, 2012 3:47:21 PM com.jme3.app.Application handleError
SEVERE: Failed to initialize OpenGL context
org.lwjgl.LWJGLException: No Pbuffer support
at org.lwjgl.opengl.LinuxPbufferPeerInfo.nInitHandle(Native Method)
at org.lwjgl.opengl.LinuxPbufferPeerInfo.(LinuxPbufferPeerInfo.java:52)
at org.lwjgl.opengl.LinuxDisplay.createPbuffer(LinuxDisplay.java:1278)
at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:234)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:219)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:190)
at org.lwjgl.opengl.Pbuffer.(Pbuffer.java:166)
at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:335)
at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:467)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:113)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Thread.java:662)
Aug 27, 2012 3:47:21 PM com.jme3.app.Application handleError
SEVERE: Failed to create display
java.lang.NullPointerException
at org.lwjgl.opengl.GL11.glGetString(GL11.java:1771)
at com.jme3.system.lwjgl.LwjglContext.printContextInitInfo(LwjglContext.java:79)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:114)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Thread.java:662)