Kartou Posted April 15, 2015 Share Posted April 15, 2015 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 More sharing options...
rich Posted April 15, 2015 Share Posted April 15, 2015 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 More sharing options...
Kartou Posted April 21, 2015 Author Share Posted April 21, 2015 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 More sharing options...
Recommended Posts