求助!JAVA3D问题:Exception in thread "J3D-Renderer-1" java.lang.IllegalStat
Exception in thread "J3D-Renderer-1" java.lang.IllegalStateException: GL_VERSION请问是什么问题?
----------------解决方案--------------------------------------------------------
很简单的异常问题嘛~
在你的代码里 你觉得能出现异常的地方try一下 然后再catch一下 试试看~
----------------解决方案--------------------------------------------------------
我知道动不动贴代码上来很讨厌。。但是我还是不得不贴一下。我觉得这个不是逻辑错误导致的异常吧。。。
package jexam2view;
import java.applet.Applet;
import java.awt.BorderLayout;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
import com.sun.j3d.utils.behaviors.mouse.MouseZoom;
import com.sun.j3d.utils.behaviors.mouse.MouseTranslate;
import java.awt.GraphicsConfiguration;
/**
*
* @author Evolution
*/
public class JExam2View extends Applet{
private SimpleUniverse universe ;
public JExam2View()
{
}
public void init()
{
//canvas to draw on, ask SimpleUniverse what config to use
Canvas3D canvas = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
setLayout(new BorderLayout());
add("Center", canvas);
//create top of our scene graph
BranchGroup scene = new BranchGroup();
//create universe, and attach our geometry to it.
SimpleUniverse u = new SimpleUniverse(canvas);
u.getViewingPlatform().setNominalViewingTransform();
// Create the bounding leaf node
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
// Create the transform node
TransformGroup transformGroup = new TransformGroup();
transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
// Create the drag behavior node
MouseRotate behavior = new MouseRotate();
behavior.setTransformGroup(transformGroup);
transformGroup.addChild(behavior);
behavior.setSchedulingBounds(bounds);
// Create the zoom behavior node
MouseZoom behavior2 = new MouseZoom();
behavior2.setTransformGroup(transformGroup);
transformGroup.addChild(behavior2);
behavior2.setSchedulingBounds(bounds);
// Create the zoom behavior node
MouseTranslate behavior3 = new MouseTranslate();
behavior3.setTransformGroup(transformGroup);
transformGroup.addChild(behavior3);
behavior3.setSchedulingBounds(bounds);
transformGroup.addChild(new ColorCube(0.4));
scene.addChild(transformGroup);
u.addBranchGraph(scene);
}
// The following allows UglyCube to be run as an application
// as well as an applet
public static void main(String[] args)
{
new MainFrame(new JExam2View(), 256, 256);
}
}
----------------解决方案--------------------------------------------------------