Hey,
I am currently trying to modify some codes from the tutorials to get used with different classes and methods but I have met a problem. Here is my code :
[java]package com.jme3test.hellotest;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Sphere;
public class HelloTest extends SimpleApplication {
public static void main(String[] args) {
HelloTest test = new HelloTest();
test.start();
}
@Override
public void simpleInitApp() {
Sphere sphere = new Sphere(1, 1, 1f);
Geometry geometry = new Geometry(“Sphere”, sphere);
Material material = new Material(assetManager, “Common/MatDefs/Misc/SolidColor.j3md”);
material.setColor(“m_Color”, ColorRGBA.Blue);
geometry.setMaterial(material);
rootNode.attachChild(geometry);
}
}[/java]
This is almost the same code as in the “HelloSimpleApplication” tutorial. The only thing I’have really changed is the spatial shape (I turned a “Quad” into a “Sphere”). This turned out in an error :
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:495)
at java.nio.DirectFloatBufferU.put(DirectFloatBufferU.java:274)
at com.jme3.scene.shape.Sphere.setGeometryData(Sphere.java:271)
at com.jme3.scene.shape.Sphere.updateGeometry(Sphere.java:400)
at com.jme3.scene.shape.Sphere.(Sphere.java:125)
at com.jme3.scene.shape.Sphere.(Sphere.java:107)
at com.jme3test.hellotest.HelloTest.simpleInitApp(HelloTest.java:18)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:218)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:138)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:206)
at java.lang.Thread.run(Thread.java:680)
Java Result: 143
What's weird is that the same code works without any error when I put Quads instead of Spheres. Any idea of why I have such an error ?
Edit : Actually I've tried some other shapes and Quad seems to be the only one working though Cylinder do not causes error even if it remains invisible.