Trouble using Assimp.

Started by Kneesnap, October 13, 2019, 21:18:20

Previous topic - Next topic

Kneesnap

I'm trying to write some code to generate a 3D model, and save that model.
At this point, I just want to write something that can make a single face, or a cube, or something simple.

This code, however, crashes the JVM, and I'm not entirely sure why.
I'm new to LWJGL, so it is very likely I am using it wrong.

Could someone help me turn this code into something which will create and save a basic 3D model?
Thanks for the help!

public static void exportModel(File outputFile) {
    AIScene scene = AIScene.create();
    scene.mMeshes(PointerBuffer.allocateDirect(1));
    AIMesh mesh = AIMesh.create(scene.mMeshes().get(0));
    scene.mMeshes().put(mesh.address());
    
    mesh.mNumVertices(3);
    mesh.mVertices().put(0, AIVector3D.create().x(0).y(0).z(0)); // THIS CRASHES THE JVM.
    .......
    Assimp.aiExportScene(scene, "dae", outputFile.getPath(), 0);
}