Bugs in oct 4th 2004 cvs?

hi all,



i’ve just updated jme source code through cvs tonight (oct 4th 2004) and build it with JDK1.4.2_05. when i try to run my application, it crashed.



it says something like this:

Heap at VM abort:

bla bla



#the exception above was detected in native code outside the VM



as far as i know, this error messages caused by null pointer, right?



looking through the error log, it says something like this:



Current Java thread:

at org.lwjgl.opengl.GL12.nglDrawRangeElements(Native Method)

at org.lwjgl.opengl.GL12.glDrawRangeElements(Unknown Source)

at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)

at com.jme.scene.TriMesh.draw(Unknown Source)

at com.jme.renderer.RenderQueue.renderOpaqueBucket(Unknown Source)

at com.jme.renderer.RenderQueue.renderBuckets(Unknown Source)

at com.jme.renderer.lwjgl.LWJGLRenderer.displayBackBuffer(Unknown Source)

at SemuGame.start(SemuGame.java:253)

at SemuGame.main(SemuGame.java:540)



the application ran fine just before i update from cvs.

Can you narrow down the part that’s causing the bug? Many things cause exceptions at like that. Does HelloWorld cause this bug? What code, when added, throws that exception?

The only code added to CVS today was CloneCreator and related changes. Are you using clone stuff at all?



ObjToJme was also updated.

oops, forgot to login :slight_smile:



anyway, i think it was 1 week or so since the last time i updated the source code. can’t remember exactly when :smiley:

We’ve seen similar in the past. Please double check the Test demos because a lot of the time the error ends up being easily narrowed down when the tests work and the custom code does not.

spent couple of hours trying to figure it out … i think the problem lies in the ms3d model (not really sure) … but … something weird is going on here. if i load the model without terrain, it works fine (including the animation using jointcontroller). then i put terraindemo using its default value, it still works fine. but, if i put the model along with customized terrain, it will crash 8-O. maybe it will be better if i put it this way:



skeleton.ms3d + default terrain = no problem.

skeleton.ms3d + customized terrain = crash when the camera moving/rotating toward terrain & model.

run.ms3d + customized terrain = no problem.

run.ms3d + default terrain = no problem.



here’s the code:


protected void simpleInitGame() {
      MilkToJme converter=new MilkToJme();
      URL MSFile=bugHunt.class.getClassLoader().getResource("data/model/msascii/skeleton.ms3d");
      ByteArrayOutputStream BO=new ByteArrayOutputStream();

      try {
         converter.convert(MSFile.openStream(),BO);
      } catch (IOException e) {
         System.out.println("IO problem writting the file!!!");
         System.out.println(e.getMessage());
         System.exit(0);
      }

      JmeBinaryReader jbr=new JmeBinaryReader();
      URL TEXdir=bugHunt.class.getClassLoader().getResource("data/model/msascii/");
      jbr.setProperty("texurl",TEXdir);
      model = null;

      try {
         model = jbr.loadBinaryFormat(new ByteArrayInputStream(BO.toByteArray()));
      } catch (IOException e) {
         System.out.println("darn exceptions:" + e.getMessage());
      }

      model.setLocalScale(1f);
      rootNode.attachChild(model);

      display.setTitle("Terrain Test");
      input.setKeySpeed(50f);
      cam.setLocation(new Vector3f(64*5, 250, 64*5));
      cam.update();

      FogState fs = display.getRenderer().createFogState();
      fs.setEnabled(false);
      rootNode.setRenderState(fs);

      CullState cs = display.getRenderer().createCullState();
      cs.setCullMode(CullState.CS_BACK);
      cs.setEnabled(true);

      lightState.setTwoSidedLighting(true);
      ((PointLight)lightState.get(0)).setLocation(new Vector3f(100,500,50));
      MidPointHeightMap heightMap = new MidPointHeightMap(64, 1.9f); // CUSTOM VALUE
      Vector3f terrainScale = new Vector3f(5,.25f,5); // CUSTOM VALUE
      TerrainBlock tb = new TerrainBlock(
         "Terrain",
         heightMap.getSize(),
         terrainScale,
         heightMap.getHeightMap(),
         new Vector3f(0, 0, 0), true);
      //tb.setTrisPerPixel( 0.5f);
      tb.setDistanceTolerance( 1.0f);
      tb.setDetailTexture(1, 8); // CUSTOM VALUE
      tb.setModelBound(new BoundingBox());
      tb.updateModelBound();
      tb.setLocalTranslation(new Vector3f(0,0,0));
      rootNode.attachChild(tb);
      rootNode.setRenderState(cs);

      ProceduralTextureGenerator pt = new ProceduralTextureGenerator(heightMap);
      pt.addTexture(new ImageIcon(bugHunt.class.getClassLoader()
         .getResource("data/texture/grassb.png")), -128, 0, 128);
      pt.addTexture(new ImageIcon(bugHunt.class.getClassLoader()
         .getResource("data/texture/dirt.jpg")), 0, 128, 255);
      pt.addTexture(new ImageIcon(bugHunt.class.getClassLoader()
         .getResource("data/texture/highest.jpg")), 128, 255, 384);

      pt.createTexture(32); // CUSTOM VALUE

      TextureState ts = display.getRenderer().createTextureState();
      ts.setEnabled(true);
      Texture t1 = TextureManager.loadTexture(
         pt.getImageIcon().getImage(),
         Texture.MM_LINEAR_LINEAR,
         Texture.FM_LINEAR,
         true,
         true);
      ts.setTexture(t1, 0);

      Texture t2 = TextureManager.loadTexture(
         bugHunt.class.getClassLoader().getResource("data/texture/Detail.jpg"),
         Texture.MM_LINEAR_LINEAR,
         Texture.FM_LINEAR, true);

      ts.setTexture(t2, 1);
      t2.setWrap(Texture.WM_WRAP_S_WRAP_T);

      t1.setApply(Texture.AM_COMBINE);
      t1.setCombineFuncRGB(Texture.ACF_MODULATE);
      t1.setCombineSrc0RGB(Texture.ACS_TEXTURE);
      t1.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
      t1.setCombineSrc1RGB(Texture.ACS_PRIMARY_COLOR);
      t1.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
      t1.setCombineScaleRGB(1.0f);

      t2.setApply(Texture.AM_COMBINE);
      t2.setCombineFuncRGB(Texture.ACF_ADD_SIGNED);
      t2.setCombineSrc0RGB(Texture.ACS_TEXTURE);
      t2.setCombineOp0RGB(Texture.ACO_SRC_COLOR);
      t2.setCombineSrc1RGB(Texture.ACS_PREVIOUS);
      t2.setCombineOp1RGB(Texture.ACO_SRC_COLOR);
      t2.setCombineScaleRGB(1.0f);
      rootNode.setRenderState(ts);

      rootNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
      fpsNode.setRenderQueueMode(Renderer.QUEUE_OPAQUE);
}



as you can see, it's the same code from TestMilkWrite and TestTerrain. let me know if you need the model (i don't have web space to put the file and linked it here :(). i got the model from a site with tutorials for Maya artist. yes, basically i'm an artist, a Maya user (and know how to code in java roughly :D). and i wish to use jME for my school project. what i did with the model is i exported it from Maya to milkshape (and hopefully it's not the reason why the ms3d file acts so weird ...)

I am a newbie. I did full checkout of jme, compiled it (with tests) correctly, no error or warning, but I got the same error running all tests:



java.lang.UnsatisfiedLinkError: nglDrawRangeElements

at org.lwjgl.opengl.GL12.nglDrawRangeElements(Native Method)

at org.lwjgl.opengl.GL12.glDrawRangeElements(Unknown Source)

at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)

at com.jme.scene.TriMesh.draw(Unknown Source)

at com.jme.scene.Spatial.onDraw(Unknown Source)

at com.jme.scene.Node.draw(Unknown Source)

at com.jme.scene.Spatial.onDraw(Unknown Source)

at com.jme.scene.Node.draw(Unknown Source)

at com.jme.widget.WidgetAbstractFrame.draw(Unknown Source)

at com.jme.scene.Spatial.onDraw(Unknown Source)

at com.jme.widget.WidgetAbstractFrame.onDraw(Unknown Source)

at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)

at jmetest.widget.TestWidgetButtonLightSwitch.render(Unknown Source)

at com.jme.app.BaseGame.start(Unknown Source)

at jmetest.widget.TestWidgetButtonLightSwitch.main(Unknown Source)





Where did I go wrong ???



Thanks

If you checked out jme, make sure you either

  • define java.library.path to point to the lib folder, which contains the .dll files for lwjgl (do a java -Djava.library.path=/lib your.main.class, IIRC)



    or


  • copy the dlls from the lib folder into the base folder of the project; if you use eclipse, you can then start the test classes directly, since the jvm will find the dlls in the default place

Try updating the drivers for you graphics card. Old drivers is the number one cause of Opengl problems.

What are your graphics cards that you guys are using? Does it support OpenGL 1.2 (specifically glDrawRangeElements)?

PixelAmp: FPS mode should be QUEUE_ORTHO , but that may not fix the problem. Email me the model (cep221 at gmail dot com) I’ll run it when I get home at around 9PM CST and see if I can’t narrow down the problem on my home computer.



freestyle65: Do all the demos at www.lwjgl.org work for you?

… nope, none of the demos works …



:frowning:

If none of the LWJGL demos work, then the problem’s your drivers or your card. Either the card doesn’t support OpenGL extentions 1.2 or there was some kind of problem updating your drivers. Do you know if your card supports OpenGL? If so, up to which version? Try uninstalling your drivers and reinstalling new ones.

"freestyle65" wrote:
... nope, none of the demos works ...

:(

Is the problem with webstart or with the program?
"freestyle65" wrote:
java.lang.UnsatisfiedLinkError: nglDrawRangeElements
at org.lwjgl.opengl.GL12.nglDrawRangeElements(Native Method)
at org.lwjgl.opengl.GL12.glDrawRangeElements(Unknown Source)
at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)
at com.jme.scene.TriMesh.draw(Unknown Source)

An "UnsatisfiedLinkError" generally means the native methods referenced via JNI are not found... Or in otherwords, your lwjgl .dll files are not in the right place or not properly referenced.

Probem solved !!!



I tried the same distribution with a GeForce FX5200 graphic card and everything worked fine ! The former video card was an onboard Intel 82815 chipset (it sux !!!).



Thanks to everybody for the support.

I have such an embedded graphics chip set in my pc at work. Use an updated driver, it should work (no shader support though, i’m afraid)

i’m using nVidia GeForce2go, it’s a mobile GPU with 16mb of vram. the problem with most mobile GPU is that the drivers are not updated regularly (nVidia told us to download it from our mobile manufacturer, but manufacturers rarely updating it :(). and if i install regular driver (detonator) from nVidia site, chances are the drivers won’t work



cep21: i just mailed the model to you. sorry i was busy this whole day

oh well, i guess my GPU doesn’t support glDrawRangeElements :frowning:

We just added a path for non opengl1.2 compliant drawing… so far this is only at that spot, so while it should solve this issue, it may not solve others in other spots… remains to be seen. :slight_smile: