Jump to content

[Pixi] Resolution questions...


d13
 Share

Recommended Posts

Hello!

 

The only article I've been able to find on working with multiple resolution images in Pixi is this very old one:

 

http://www.goodboydigital.com/pixi-js-v2-fastest-2d-webgl-renderer/

 

But there are few details that I don't understand.

 

The text recommends adding "@2x" to image names to set the texture's `resolution` property, but the example code uses "@x2".

I guess that "@2x" the correct one?

 

The text also says:

"When Pixi detects this it will automatically set the resolution to 2"

Does that mean it sets the `texture.baseTexture.resolution` to 2, or does it set the `renderer.resolution` property to 2 - or both?

 

And, if I used `window.DevicePixelRatio` to set the renderer's resolution, does manually using @2x override that value?

Link to comment
Share on other sites

@2x is correct:

 

https://github.com/pixijs/pixi.js/blob/master/src/core/const.js#L160

 

Having that string in your filename will set the baseTexture.resolution property for you. It is done at load time:

 

https://github.com/pixijs/pixi.js/blob/07e4e26f8fd404524a7ebaa73c210de3d8f2cf25/src/loaders/textureParser.js#L10

 

It does not effect renderer.resolution.

Link to comment
Share on other sites

Having that string in your filename will set the baseTexture.resolution property for you.

If you don't use @_x in the filename, will the `baseTexture.resolution` be set to 1, or default to the `renderer.resolution` ?

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...