3.1Beta upgrade IllegalArguementExcept for VertexBuffer with j3o

I seem to be having an issue using a j3o object after upgrading from 3.0 to 3.1Beta. I am unable to post the j3o object in question due to policy issues, but figured I’d see if anyone could figure it out without the object. Essentially I have been using a j3o object with skeletal animation in 3.0 and it appeared to work fine (so I assume the model is fine). After transitioning to 3.1Beta, it appears to now be causing issues. After loading the object and the renderManager.render(tpf, context.isRenderagble()) is called, I get:

java.lang.IllegalArgumentException: Buffer format mismatch. Cannot copy
at com.jme3.scene.VertexBuffer.copyElements(VertexBuffer.java:914)
at com.jme3.scene.Mesh.prepareForAnim(Mesh.java:473)
at com.jme3.animation.SkeletonControl.switchToHardware(SkeletonControl.java:129)
at com.jme3.animation.SkeletonControl.testHardwareSupported(SkeletonControl.java:161)
at com.jme3.animation.SkeletonControl.controlRender(SkeletonControl.java:281)
at com.jme3.scene.control.AbstractControl.render(AbstractControl.java:135)
at com.jme3.scene.Spatial.runControlRender(Spatial.java:756)

The spatial is added within a class that extends AbstractControl via the following:
physicsCharacter = new BetterCharacterControl(1.0f, 6f, 8f);

  Spatial avatar =
  Node avatarNode = new Node();

I commented out all animation stuff to limit possible causes but still get the issue. Has anyone else had this issue or know what the cause could be? Any help is appreciated!


It’s the copyElements() call in this block of code:

            if (tangents != null) {
                tangentsBP.copyElements(0, tangents, 0, tangentsBP.getNumElements());

So seems something is wrong with the tangent buffer.

Yes, outVb.components is 3, yet the internal components variable is 4. The j3o hasn’t changed, only the version of JME. Is there something else I should be doing with the j3o in the new version?

No, I guess it’s a bug to do with hardware skinning but I don’t know what changes there… and have no real familiarity with hardware skinning. Something is assuming that tangents are always four components I guess… which seems wrong to me.

Thanks, @pspeed. Hopefully someone else can weight in. Unfortunately I’m not experienced in this as well, but I’m sure there’s someone on here that is. I guess it’s a waiting game for that person to see this. :slight_smile:

You can just re-generate the tangents using the TangentBinormalGenerator

@Momoko_Fan please forgive my lack of knowledge, but where would I do this? Or are you proposing VertexBuffer should be calling this? Thank you for weighing in!


Here’s an example. You call it against the scene you loaded.

@Momoko_Fan Excellent! That fixed it! Thank you!