EzDevInfo.com

spine

Lightweight MVC library for building JavaScript applications Build Awesome Javascript MVC Applications - Spine spine - build awesome javascript mvc applications

Use Spine in Cocos2dx

In cocos2dx, I use the class skeletonAnimation to create the skeleton animation which uses the resources exported by spine. We know the class skeletonAnimation is the subclass of node not is sprite.
How to do to make the skeleton animation flip the node as it like to use the method setFlippedX() in sprite node.


Source: (StackOverflow)

Error In Spine Animation

I am facing a problem while animating characters Spine 2.1.01 Professional. When I export the JSON file (imported on Cocos-2d-x), some images are getting displayed when they are not supposed to...and some others are disappearing when they should be visible (on animation).

Any ideas/suggestions would be really appreciated. I'm totally stuck!


Source: (StackOverflow)

Advertisements

Unable to render spine::SkeletonAniamtion with a cocos2d::Label child

I am using spine 1.9 to create skeleton animations and render with cocos2d-x v3.2. My skeletons contain skinnedmesh, I'm not able use the spine-cocos2dx runtime released with cocos2dx as the runtime is of an old version. I copied the latest spine-cocos2dx 3.2 runtime source and replaced files under cocos/editor-support/spine foler, after doing so my skeleton rendered.

But the program crashed after I added some nodes to spine::SkeletonAnimation node. After some investigations I found it only happen when,

  • My scene has at least two SkeletonAnimation nodes.
  • Each SkeletonAnimation node has a cocos2d::Label as child.

Sample code:

    auto m1 = spine::SkeletonAnimation::createWithFile("1001.json", "1001.atlas", 0.5f);
    auto l1 = Label::createWithTTF(ttfConfig, "1234567");
    m1->addChild(l1);
    this->addChild(m1);

    auto m2 = spine::SkeletonAnimation::createWithFile("1002.json", "1002.atlas", 0.5f);
    auto l2 = Label::createWithTTF(ttfConfig, "123456789");
    m2->addChild(l2);
    this->addChild(m2);

Crash callstack:

    Thread 1, Queue : com.apple.main-thread
    #0  0x324f894a in gpus_ReturnGuiltyForHardwareRestart ()
    #1  0x324f93d0 in gpusSubmitDataBuffers ()
    #2  0x2c7b229a in SubmitPackets ()
    #3  0x2fce3a6c in gliPresentViewES_Exec ()
    #4  0x2fce397e in gliPresentViewES ()
    #5  0x2fcee0ca in -[EAGLContext presentRenderbuffer:] ()
    #6  0x00e2e2d6 in EAGLContext_presentRenderbuffer(EAGLContext*, objc_selector*, unsigned int) ()
    #7  0x00435cfa in -[CCEAGLView swapBuffers] at /Users/xtjiao/Documents/client/cocos2d/cocos/platform/ios/CCEAGLView.mm:316
    #8  0x003acb04 in cocos2d::GLView::swapBuffers() at /Users/xtjiao/Documents/client/cocos2d/cocos/platform/ios/CCGLView.mm:180
    #9  0x00304840 in cocos2d::Director::drawScene() at /Users/xtjiao/Documents/client/cocos2d/cocos/base/CCDirector.cpp:315
    #10 0x003076b8 in cocos2d::DisplayLinkDirector::mainLoop() at /Users/xtjiao/Documents/client/cocos2d/cocos/base/CCDirector.cpp:1269
    #11 0x0045976c in -[CCDirectorCaller doCaller:] at /Users/xtjiao/Documents/client/cocos2d/cocos/platform/ios/CCDirectorCaller.mm:109
    #12 0x00e2d5ee in -[DYDisplayLinkInterposer forwardDisplayLinkCallback:] ()
    #13 0x2ff35eee in CA::Display::DisplayLinkItem::dispatch() ()
    #14 0x2ff35c98 in CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) ()
    #15 0x32cd275c in IOMobileFramebufferVsyncNotifyFunc ()
    #16 0x2e7265c8 in IODispatchCalloutFromCFMessage ()
    #17 0x2d9fbc54 in __CFMachPortPerform ()
    #18 0x2da06846 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
    #19 0x2da067e2 in __CFRunLoopDoSource1 ()
    #20 0x2da04fae in __CFRunLoopRun ()
    #21 0x2d96f768 in CFRunLoopRunSpecific ()
    #22 0x2d96f54a in CFRunLoopRunInMode ()
    #23 0x328a96d2 in GSEventRunModal ()
    #24 0x302ce890 in UIApplicationMain ()
    #25 0x00175da2 in main at /Users/xtjiao/Documents/client/proj.ios_mac/ios/main.m:6
    #26 0x0000b148 in start ()

And the error message from console:

    cocos2d: OpenGL error 0x0502 in /Users/xtjiao/Documents/client/cocos2d/cocos/editor-support/spine/PolygonBatch.cpp flush 111
    cocos2d: OpenGL error 0x0502 in /Users/xtjiao/Documents/client/cocos2d/cocos/editor-support/spine/PolygonBatch.cpp flush 111
    ...

It seems related to PolygonBatch class and draw method of cocos2dx classes, but as I'm not familiar with opengl and low level cocos2dx, it's hard for me to have further investigation, hope some expert can help.

Thanks!


Source: (StackOverflow)