[SOLVED] Rendering with the simpleRender?

Hi all :),

so simplified I’ve tried to do this:

@Override
public void simpleRender(RenderManager r) {
    r.renderGeometry(sphereGeo);
}

And I just don’t understand why the sphere-geometry is not displayed. Is there a way to get it displayed with the RenderManager?

Thanks for answering.

Why you are using simpleRender ?
Are you using Jm3 or Jm2 ?
Also, try to explain a litle more about what you are trying to do.
The normal way to render stuff is not that way.

Yeah I agree with @wagfeliz, sounds like the post where you are asking how to solve an issue you have because you’re trying to fix an other issue in the wrong way.
What do you really want to do?

Though to expain your particular issue, you can’t call renderGeometry out of a certain context. The renderer doesn’t know where to render this geometry.
This however should work :

r.renderScene(sphereGeo, viewPort);

But again, probably not the answer to your real problem.

Thanks for answering.

@wagfeliz I’m using Jm3, and previously I used LibGdx, where a render and a update loop was the to go. Seeing the simple Update and simpleRender method and knowing that both use LWJGL i thought it would be the same thing.

@nehon so what I was really trying to do was:

I created a class “multisphere” where I have a ArrayList, that stores another class called “Layer”.

public class Layer {

Sphere sphereMesh;
Geometry sphereGeo;
AssetManager assetManager;

public Layer(AssetManager asset) {

    sphereMesh = new Sphere(64, 64, 2f);
    sphereGeo = new Geometry("layer", sphereMesh);
    assetManager = asset;

    Material mat = new Material(assetManager,
            "Common/MatDefs/Light/Lighting.j3md");
    mat.setBoolean("UseMaterialColors", true);
    mat.setColor("Ambient", ColorRGBA.Blue);
    mat.setColor("Diffuse", ColorRGBA.Blue);
    mat.getAdditionalRenderState().setWireframe(true);

    sphereGeo.setMaterial(mat);
}

public void update(float deltatime) {
    sphereGeo.rotate(0, 0, 0.1f * deltatime);
}

public void render(RenderManager r) {
    r.renderGeometry(sphereGeo);
}

}

And now the “multisphere” should go though every “layer” and call update() and render() always passing the RenderManager by.
So in the end I create an object of “multisphere” and call its update and render method in the simple-Update/Render.

And that’s what I was trying to do. But after what @wagfeliz said I guess its not the proper way to do it, right?

You don’t have to care about Render. It’s there only for advanced and specific things. Just add your geometry to rootNode and you are done.

Also, don’t be shy about reading the whole tutorial. It’s your friend.

1 Like

Alright got it working by making “multisphere” a node and attaching my "layer"s geometry to it.

Thank you all for helping out!