• Runtimes
  • Setting the texture of a spine in Phaser to a compressed image

Can I set the texture being used by a spine to a compressed image?
I am using the Phaser runtime (javascript in the browser).
Things I have tried are loading the .atlas, .json, and .pvr files into the game's cache and binding the cached texture's glTexture to each skeleton's slot's region, but that didn't work.

    Related Discussions
    ...

    machineman1357 Sorry for the delay in response! Mario, the person in charge of the spine-phaser runtime, is currently on vacation and will reply when he returns.

    4 天 后

    I have also tried to set the image property of teximage2D to an image element with the src of the data url gotten from parsing the texture's compressed data using code from compressed viewer, but I that didn't work and I just get webgl warning texImage2D: no image.
    I feel like I am so close but messing up somewhere with my lack of webgl texture understanding.

    We don't support this out of the box I'm afraid. Can you share what you got so far code wise? Maybe I can help figure it out that way.

    The gist of it is that I took code inspiration from https://toji.github.io/texture-tester/ and instead of calling texImage2D I called compressedTexImage2D with the PVR's array buffer that is loaded in the cache, but it's not quite as simple as that (you have to take other factors into account like the compressed texture format, ex.: ASTC/S3TC/etc.)

    We plan on creating a push to the Phaser run time so it can help others, so maybe I will post the link to that here so that it can help others.

    Now I am trying to figure out how to set the skin of a spine that has multiple atlases.
    If I set the skin where the images are in the second image, then the spine picks the correct position in the image, but in the first sheet always.
    Any idea where I can take a closer look at this?
    I tried removing the textures in the cache for a non-compressed spine and the skin is still proper, so I'm guessing the texture data is pulled from the skeleton data maybe?
    I guess I am trying to figure out how the spine determines which sheet to pull image data for.

    Nvm, figured it out.
    This post is resolved