Sign in to follow this  
javalang

PIXI.WRAP_MODES.REPEAT not working?

Recommended Posts

Hello, I'm asking because I'm not sure of my understanding  the  PIXI.basetexture WRAP_MODES:

For example:  given one container, one texture (loaded with loader) and one smaller sprite, defining PIXI.WRAP_MODES.REPEAT should fill the whole container, but it doesn't.

The following code shows a sprite inbetween the container without repeating, what I'm doing wrong ? see WRAPMODE_TEST_HERE

Thanks in advance

PS: using PIXI 4.5.5

loader.load((loader, ressources) => {
    var texture = ressources.rgba.texture;
    texture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
    var sprite = new PIXI.Sprite(texture);
    sprite.width = 312
    sprite.height = 312
    stage.addChild(sprite);
...
})

 

Share this post


Link to post
Share on other sites

In general, REPEAT is passed to WebGL, it does not affect stage tree. However there are some cases where it also can be used, like DisplacementFilter. Its not possible to understand its logic and why certain elements can be affected by it, unless you start working with WebGL directly.

Share this post


Link to post
Share on other sites

@ivan.popelyshev thanks for reply, TilingSprite is not suitable for me because my scale factors are not whole numbers.

I added a link of the testcase in the first thread .

So you think I should implement the repeat function for example in a filter?

 

Edit: Changed my scenario to TilingSprite, using tileScale and tilePosition works fine now, but how to rotate?

Share this post


Link to post
Share on other sites

That's one of features I had add to TilingSprite personally :)

Look closer at https://github.com/pixijs/pixi.js/blob/dev/src/extras/TilingSprite.js#L116 , TilingSprite have actual transform on the inside! You can specify not only position and scale but also other things!

You might want to synchronize it with some other container to create elements that will live "on top" of that tilingSprite.

Btw, nice nickname! I'm also java/scala/kotlin developer ^_^ 

 

Share this post


Link to post
Share on other sites

I understand, I will test it.

BTW , better java/kotlin/scala than FORTRAN :)

But, since I changed to javascript, i will never change to java again, I should change the Nic to something like 'javascriptfunction' :)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.