Edricus

Phaser 2.7+ and Atlas Compression Questions

Recommended Posts

So I've been looking into the new updates to Phaser CE (2.7.0+) and what has caught my eye the most is the updates to the way Phaser handles textures. It now seems to have the ability to handle texture compression formats for WebGL which is exciting! Previous to this, all the games I had worked in were just loading PNG RGBA data into the graphics card and having come from other engines that support texture compression for GPU RAM optimizations, it was definitely a feature I missed.

I've branched on an old project I had in order to test this new compression system but I'm not sure how it would work with atlases. I was already using Texture Packer before to generate Texture Atlases for the game but they were just PNG atlases. I came across this Advanced Rendering Tutorial where it explains how to set up your Texture Packer project. I've gone ahead and done that but the examples only show the ability to load an image with those compression settings. Here is a doc reference to the load image function.

Currently, I am using 

this.game.load.atlasJSONHash('key', 'texturePNGURL', 'jsonURL');

It seems the new update only supports the following two calls

this.game.load.image('factory', {
    etc1: 'assets/factory_etc1.pkm',
    s3tc: 'assets/factory_dxt1.pvr',
    pvrtc: 'assets/factory_pvrtc.pvr',
    truecolor: 'assets/factory.png'
});

this.game.load.texture('factory', {
    etc1: 'assets/factory_etc1.pkm',
    s3tc: 'assets/factory_dxt1.pvr',
    pvrtc: 'assets/factory_pvrtc.pvr',
    truecolor: 'assets/factory.png'
});

How would I go about loading my atlases with the accompanying JSON information using the new compression system?

Share this post


Link to post
Share on other sites

Did you ever get this figured out? I'm trying to setup something similar to the below to get this working with an atlas; however, I can't even get the PVR file to load (it correctly selects the PVR file when on iOS, but it just hangs on loading forever).

 

Share this post


Link to post
Share on other sites

I have the same issue. I'm using texture packer to make the atlas, the json file makes a reference to the image as a .pvr, but I don't really know if this is enough. I am sure I'm using WebGL, and as the docs say, truecolor will be used if the navigator doesn't support WebGL or if it doesn't have a GPU. So, I tested it, and if I remove the png file nothing works, so I assume I am still using the .png file.

So, the same question as above, how do I use the pvr data while is a canvas?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.