Jump to content

Difference between .texture and new PIXI.Texture?


Jambutters
 Share

Recommended Posts

What are the things that differentiate the two ? 

Example: 

let texture = PIXI.loader.resources("player.png).texture; 

let otherTexture = new PIXI.Texture(PIXI.loader.resources("player.png).texture);

 

I assumed they were the same thing and I don't understand the mechanisms behind the two. 

Link to comment
Share on other sites

The texture you are reading from the loader's resource is a PIXI.Texture instance. When you do new PIXI.Texture and pass in the other texture, it is just creating a new texture instance that uses the same base texture of the first one you passed in.

The end result of your code above is two texture instances with the same baseTexture. Not super useful unless you want the same image but different frame values (like in a spritesheet).

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...