Creating custom geometry

I got trouhg almost every topic in tutorial, and i have a question: all models MUST be importet from ogre file or is there possibility to create my own geometry within code?

For example how to create a cube with possibility to texture differently every side of that cube, and possibility to change material, and textures any time?

I made it almost exacly as it’s there, but i’m getting java.lang.NullPointerException when trying to execute application.

[java]m.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vecs));[/java] it’s the line, where i’m getting the error.

vecs is array created ina nother function, and is created like

[java]Vector3f [] vecs = new Vector3f[4];

vecs[1] = new Vector3f(0f, 0f, 1f);

vecs[0] = new Vector3f(1f, 0f, 1f);

vecs[3] = new Vector3f(1f, 1f, 1f);

vecs[2] = new Vector3f(0f, 1f, 1f);[/java]

and then pushed to another function

[java] Mesh m = createCubeSideMesh(vecs);[/java]

and in that function in line shown on top i’m getting the error. What’s wrong?

this is exact error i’m getting

[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.NullPointerException[/java]



EDIT: Alredy solved, forget :wink:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:custom_meshes

Thanks, i think it’s exacly what i was looking for.