Tutorial ”HelloSimpleApplication”


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();




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);





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]
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.

Erm, your sphere is defined to have 1 vertice pretty much. Try turning those first two 1 values into something like 8 and 16, should do it I think, that may solve your problem.

Oh O.K. ! I read the constructor and I must have misunderstood it because I thought the values where for Z coordinate and radius. Whatever now I dont have error anymore but my sphere is invisible… O_o’

Edit : Solved actually… I had a too high value as radius.

Your code is running fine for me. You sure it now looks like this?

[java] @Override

public void simpleInitApp() {

Sphere sphere = new Sphere(8, 16, 1f);

Geometry geometry = new Geometry("Sphere", sphere);

Material material = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");

material.setColor("m_Color", ColorRGBA.Blue);




Note: 8, 16, 1f

I edited my previous post actually to say that I found out what was wrong… :slight_smile:

I guessed, that’s why I added the ‘Note’ at teh end :stuck_out_tongue: