代码
System.out.println(new VirtualUniverse()); GraphicsConfigTemplate3D template = new GraphicsConfigTemplate3D(); System.out.println("template="+template); //X11GraphicsDevice GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); System.out.println("device="+device); sun.awt.X11GraphicsDevice x11device = (sun.awt.X11GraphicsDevice)device; GraphicsConfiguration[] configs = x11device.getConfigurations(); config = template.getBestConfiguration(configs); System.out.println(config);
javax.media.j3d.JoglGraphicsConfiguration
JoglPipeline
上述类,仅在getBestConfiguration()新建
Renderer(继承自J3dThread)
doWork()调用。
崩溃原因:
JoglPipeline.getBestConfiguration(),大约8730处开始:
Frame f = new Frame(device.getDefaultConfiguration()); f.setUndecorated(true); f.setLayout(new BorderLayout()); capturer = new CapabilitiesCapturer(); try { awtConfig = createAwtGraphicsConfiguration(caps, capturer, screen); QueryCanvas canvas = new QueryCanvas(awtConfig, capturer); f.add(canvas, BorderLayout.CENTER); f.setSize(MIN_FRAME_SIZE, MIN_FRAME_SIZE); f.setVisible(true);
在setVisible()的时候,嗝屁了。
JoglPipeline$QueryCanvas.addNotify()
glDrawable.setRealized(true);
GLDrawableImpl.setRealized()
类不同:
正确:jogamp.opengl.x11.glx.X11OnscreenGLXDrawable(两层继承:X11GLXDrawable, GLDrawableImpl) implements GLDrawable
错误:jogamp.opengl.egl.EGLDrawable(继承GLDrawableImpl)
到了这里,直接原因清楚了。之后就是研究,为什么glDrawable不同。