Custom meshes buffer initialization

Hello!

I’m working on a world where i create custom meshes using OpenCL.
Currently i use this bit of code to initialize the buffers on the mesh:

FloatBuffer fb = BufferUtils.createFloatBuffer(123);
mesh.setBuffer(VertexBuffer.Type.Position, 3, fb);

But this code creates a native buffer, then sends it to the GPU.
Is there any way around this, so i could only specify the size of the needed buffer without sending a whole list of zeros to the GPU?

you mean for opengl interop? So that you just send the id of the object to opencl?

I do not think there is a way, but I suggest to take a look into the sourcecode of jme, as far as I know the NativeObject class is the low level part that contains the actual id.

Yes, opengl interop.
I get the id this way:

mesh.getBuffer(VertexBuffer.Type.Position).getId();

But this only works if i first set the buffer.
I think JME only creates the actual buffers once i set them up with data.
But i’m gonna dig into the sources now. :smiley:
Thanks