I'm following the getting started guide (my code isn't exactly what is shown in the guide though) and I have a little program that uses all the functions taught up until multitexturing, but when I added multitexturing with the TextureUnitState[] array (it's the only array I explicitly use in the program), the program fails to run, giving an ArrayIndexOutOfBoundsException. I've tried increasing the TextureUnitState[] array size by one during initalization and then adding a dummy TextureUnitState, but that doesn't work either. Even though there are 2 or 3 objects in the array, index 1 is considered out of bounds. This to me is very odd, and I don't know what I have done wrong. Could someone please tell me what this is caused by? Thanks.

Here is the Xith3DTest constructor, where the problem should lie. At the very end is the exception I get from the program.

view.addCanvas3D(canvas); view.getTransform().lookAt( new Vector3f(0,0,2f), new Vector3f(0,0,0), new Vector3f(0,1,0)); view.startView();

while(true) { if(isRotationScheduled) { performRotation(); }

view.renderOnce(); } }

---------------------------------------------------------------

java.lang.ArrayIndexOutOfBoundsException: 1 at com.xith3d.scenegraph.GeometryArray.getTexCoordData(GeometryArray.java:107) at com.xith3d.render.jogl.ShapeAtomPeer.setupTextureCoords(ShapeAtomPeer.java:114) at com.xith3d.render.jogl.ShapeAtomPeer.setupTextureUnit(ShapeAtomPeer.java:592) at com.xith3d.render.jogl.ShapeAtomPeer.renderAtom(ShapeAtomPeer.java:698) at com.xith3d.render.CanvasPeerBase.render(CanvasPeerBase.java:102) at com.xith3d.render.jogl.CanvasPeerImpl.drawBin(CanvasPeerImpl.java:760) at com.xith3d.render.jogl.CanvasPeerImpl.display(CanvasPeerImpl.java:1008) at net.java.games.jogl.impl.GLDrawableHelper.display(GLDrawableHelper.java:74) at net.java.games.jogl.GLCanvas$DisplayAction.run(GLCanvas.java:198) at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:239) at net.java.games.jogl.GLCanvas.displayImpl(GLCanvas.java:186) at net.java.games.jogl.GLCanvas.display(GLCanvas.java:74) at com.xith3d.render.jogl.CanvasPeerImpl.render(CanvasPeerImpl.java:1109) at com.xith3d.scenegraph.View.renderOnce(View.java:756) at com.xith3d.scenegraph.View.renderOnce(View.java:689) at Xith3DTest.<init>(Xith3DTest.java:153) at Xith3DTest.main(Xith3DTest.java:48)

Yay thanks. What I did was I just copied the createCubeViaTriangles() used in one of the official test classes and pasted it into my source and used that local one instead of the createCubeViaTriangles() in the Cube class. It then worked for whatever reason. But your way of doing it is the proper way . It should be added to the guide, which I find often leaves out a lot...

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org