Skip to content

Commit

Permalink
added parameter 'forcePotTexture' to RenderTexture constructor
Browse files Browse the repository at this point in the history
That way, you can use 'textureRepeat' with render textures.
Thanks to hardcoremore for making me aware of this omission!
  • Loading branch information
PrimaryFeather committed Apr 3, 2020
1 parent e02a71d commit f55e3ab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions starling/src/starling/textures/RenderTexture.as
Expand Up @@ -123,17 +123,18 @@ package starling.textures
* documentation of the <code>useDoubleBuffering</code> property.</p>
*/
public function RenderTexture(width:int, height:int, persistent:Boolean=true,
scale:Number=-1, format:String="bgra")
scale:Number=-1, format:String="bgra",
forcePotTexture:Boolean=false)
{
_isPersistent = persistent;
_activeTexture = Texture.empty(width, height, true, false, true, scale, format);
_activeTexture = Texture.empty(width, height, true, false, true, scale, format, forcePotTexture);
_activeTexture.root.onRestore = _activeTexture.root.clear;

super(_activeTexture, new Rectangle(0, 0, width, height), true, null, false);

if (persistent && useDoubleBuffering)
{
_bufferTexture = Texture.empty(width, height, true, false, true, scale, format);
_bufferTexture = Texture.empty(width, height, true, false, true, scale, format, forcePotTexture);
_bufferTexture.root.onRestore = _bufferTexture.root.clear;
_helperImage = new Image(_bufferTexture);
_helperImage.textureSmoothing = TextureSmoothing.NONE; // solves some aliasing-issues
Expand Down

0 comments on commit f55e3ab

Please sign in to comment.