Hey, I’m interested in using RenderTexture, similarly as I would in SFML. However after viewing an example, I’m left with more questions than answers.
Regarding this example (press edit): https://labs.phaser.io/view.html?src=src/game%20objects\render%20texture\render%20texture%20to%20render%20texture.js
There contains a few lines of concern:
var gridFrame = this.textures.getFrame(‘grid’);
var gridImage = this.add.image(0, 0, ‘grid’).setVisible(false).setOrigin(0);
rt1 = this.add.renderTexture(0, 0, 800, 600);
rt1.draw(gridFrame, 0, 0);
rt1.draw(gridImage, 128, 0);
I’m having trouble understanding how these two lines can display the same image.
this.textures.getFrame(‘grid’);
// Equivalent to
this.add.image(0, 0, ‘grid’).setOrigin(0);
I apologise if it is a daft question. Are one of these methods preferred and when might I want to use one over the other?
Thank you.