Jump to content

TilingSprite and Texture Wrap modes.


MrChampion
 Share

Recommended Posts

Hello!

 

I seem to be having a problem with TilingSprite texture wrap mode to repeat when using render textures to generate a new texture.

 

When using a source texture with the correct size it works as expected:

    var _sprite = new PIXI.Sprite.fromImage("symbol_0.png");    var _tsprite = new PIXI.TilingSprite(_sprite.texture, 128, 128);    setInterval( function() {        _tsprite.tilePosition.y += 0.1;    }, 10);

If I try to render to a texture (to later use multiple sources dynamically batched together and to make a wrapping texture strip), the texture wrap mode seems to be using transforms with the original static frames and base texture despite the render texture size being smaller, instead of sliding the UVs in the texture.
 

    var _sprite = new PIXI.Sprite.fromImage("symbol_0.png");    var _sprite2 = new PIXI.Sprite.fromImage("symbol_1.png");    var _ct = new PIXI.DisplayObjectContainer();    _ct.addChild(_sprite);    _sprite2.position.y += 128;    _ct.addChild(_sprite2);        var _rtexture = new PIXI.RenderTexture(128, 256);    _rtexture.render(_ct);    var _tsprite = new PIXI.TilingSprite(_rtexture, 128, 128);    setInterval( function() {        _tsprite.tilePosition.y += 0.1;    }, 10);

Tried trimming but it didn't work:

"_rtexture.trim = new PIXI.Rectangle(0, 0, 128, 256);"

 

Any idea to achieve the same effect? Something to copy the actual image pixel buffer to a new WebGLTexture with gl wrap mode in repeat?

Link to comment
Share on other sites

Forgot to add, I've tried some different aproaches with the variations of the same code, one of which was with the new 1.5.2 generate texture and it's the same behaviour as the second example, like this:
 

    var _sprite = new PIXI.Sprite.fromImage("symbol_0.png");    var _sprite2 = new PIXI.Sprite.fromImage("symbol_1.png");    var _ct = new PIXI.DisplayObjectContainer();    _ct.addChild(_sprite);    _sprite2.position.y += 128;    _ct.addChild(_sprite2);        var _texture = _ct.generateTexture();    var _tsprite = new PIXI.TilingSprite(_texture, 128, 128);    setInterval( function() {        _tsprite.tilePosition.y += 0.1;    }, 10);

And still can't reproduce gl.WRAP, GL_REPEAT like with a POT single image texture source.

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