• Runtimes
  • Cocos2d-x 3.12 and spine 3.4

Related Discussions
...

Hey,

I've upgraded my spine files to 3.4.

Firstly I have to re-export all my spine files.

Then i have the following error.(crash)

Assert failed: GL_CLAMP_TO_EDGE should be used in NPOT dimensions.

This is solved by exporting with the POT option on. Is there a way to not use POT??

Thanks

You can manually set the texture wrap on spAtlasPage to something != clamp to edge. I have to check, but I think clamp to edge works with non-POT in GL ES +2.0. Could be a bug in cocos2d-x.

edit: looks like your wrap is set to repeat or repeat mirror, which requires POT textures. The wrap of the spAtlasPages in your texture atlas should be set to clamp to edge. Please follow this issue for updates https://github.com/EsotericSoftware/spine-runtimes/issues/639

Hey,

Thanks for fixing this issue.

I found another crash.

If constraints are used and path doesn't have constant speed then a crash occurs due to world = NULL.

This can be fixed by
-> Go to pathConstraint.c
-> Line 312
-> add the following.


world = self->world;

Thanks


Another problem I found

In skeletonJson.c
Line 522 to 527
My games gets stuck in an infinite Loop.
"i" goes negative.

Hm, I can't reproduce the infinite loop. Could you send me an export that breaks for you?

It turns out that, the exports from a very old version of spine file that has a bounding box attachment is causing the crash.

so basically,

exports that include bounding box attachment. with spine v2.1.27 causes infinite loop.
exports that include bounding box attachment. with spine v3.1.02 -> bounding box don't work.

solved by re-exporting all files from v3.4

Right, the way attachments with vertices are stored has changed in 3.2, which explains the crashes. In general, the Spine editor version from which one exports and the Spine runtime must be on the same version. Going forward, we will be tagging the runtime repository with the respective versions.

I've attached a screenshot with the error.

Note: sometimes the export works but crashes after few minutes. You will have to run "idle" animation to reproduce the crash.

majzim: I've tried your sample with the latest spine-c and spine-sfml runtimes from GitHub, seems to work as intended. What editor and runtime versions are you using? http://sht.tl/q21oso

bilalmirza: can you provide me with a file that reproduces the error?

did you run the idle animation?


majzim and I are using the same spine export.

Yes, since that's the only animation on the skeleton. Full SFML code (just took what's in main.cpp:vine() and pointed it at the exports i made from Spine 3.4.01):

// Load atlas, skeleton, and animations.
   Atlas* atlas = Atlas_createFromFile("data/sentinel.atlas", 0);
   SkeletonJson* json = SkeletonJson_create(atlas);
   json->scale = 0.5f;
   SkeletonData *skeletonData = SkeletonJson_readSkeletonDataFile(json, "data/sentinel.json");
   if (!skeletonData) {
      printf("Error: %s\n", json->error);
      exit(0);
   }
   SkeletonJson_dispose(json);

   SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
   drawable->timeScale = 1;

   Skeleton* skeleton = drawable->skeleton;
   skeleton->x = 320;
   skeleton->y = 590;
   Skeleton_updateWorldTransform(skeleton);

   AnimationState_setAnimationByName(drawable->state, 0, "idle", true);

   sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - vine");
   window.setFramerateLimit(60);
   sf::Event event;
   sf::Clock deltaClock;
   while (window.isOpen()) {
      while (window.pollEvent(event))
         if (event.type == sf::Event::Closed) window.close();

  float delta = deltaClock.getElapsedTime().asSeconds();
  deltaClock.restart();

  drawable->update(delta);

  window.clear();
  window.draw(*drawable);
  window.display();
   }

   SkeletonData_dispose(skeletonData);
   Atlas_dispose(atlas);

it seems that it works on iOS simulator and on iphone. But this crashes on mac desktop build.


I've made a video on the test project.
in every case of crash "i" is 1 less than "n"
if i change the loop to
for (i = 0; i < n-1; ++i)

it works fine. but of course I'm not suppose to change that 😛

https://www.dropbox.com/s/rzy35545fffken1/spineBugVid.mov?dl=0

There must be something wrong in your setup of the desktop project. Cocos2d-X ships their own, super outdated, broken, Spine runtime (which we tried to make them not do for a long time). My guess is that your desktop project links to that instead of our Spine runtime. Could you send me your test project so I can check?

Actually, All of cocos2dx projects( ios, dekstop, android etc) link to only one runtime. I have updated to the latest runtime.

Desktop build doesn't crash if paths are not used.

Cocos2dx will update to spine v3.4 in their next release.

If you've updated to the latest official runtime, then paths will not crash. Please provide a sample that reproduces the issue.

Sample is provided above...

It crashes when you ran a MAC version


The above export also crashes on mobile version when spine node is deleted.

at

void spTimeline_dispose (spTimeline* self) {
VTABLE(spTimeline, self)->dispose(self);
}

@bilamirza I don't see a reproduction sample in this thread. Please post a project so I can check if you are actually using the latest official Spine runtime.