Jump to content

RenderTexture not using DisplayObject rotation


Kartou
 Share

Recommended Posts

Hi!

 

Is it possible to render a rotated DisplayObject into a RenderTexture. Atm it looks like "RenderTexture.render" and "RenderTexture.renderXY" just ignores rotation on the object.

 

My current solution is to use "BitmapData.draw" which works fine. But I'm still wondering why RenderTexture ignores the rotation?

 

Cheers,

Klaus

Link to comment
Share on other sites

Yeah you can bypass the render function and do this:

    if (this.renderer.type === PIXI.WEBGL_RENDERER)    {        this.renderWebGL(displayObject, matrix, clear);    }    else    {        this.renderCanvas(displayObject, matrix, clear);    }

Where matrix is a matrix that is applied to the display object before being rendered.

Link to comment
Share on other sites

Thanks Rich!

 

Apparently another solution is to first add the rotated DisplayObject to a group and then call RenderTexture.renderXY with the group instead.

// Create arm with hand as child. Then rotate arm and render to RenderTexturevar arm = this.game.make.sprite(0, 0, 'Arm');var hand = this.game.make.sprite(this.options.ArmAttachmentPointX, this.options.ArmAttachmentPointY, 'Hand');arm.angle = 90;arm.addChild(hand);var group = this.game.make.group();group.add(arm);renderTexture.renderXY(group, 0, 0, false);
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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