trsh Posted September 7, 2020 Share Posted September 7, 2020 My code (you can paste it in PIXI's examples) I expect in a `smallScreen` in corner to show what's going on on stage. But no :/ const app = new PIXI.Application(); document.body.appendChild(app.view); const geometry = new PIXI.Geometry() .addAttribute('aVertexPosition', [-100, -50, 100, -50, 0, 100]); const shader = PIXI.Shader.from(` precision mediump float; attribute vec2 aVertexPosition; uniform mat3 translationMatrix; uniform mat3 projectionMatrix; void main() { gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); }`, `precision mediump float; void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); } `); const triangle = new PIXI.Mesh(geometry, shader); const container = new PIXI.Container(); container.addChild(triangle); const rtt = PIXI.RenderTexture.create(200,200); const smallSCreen = PIXI.Sprite.from(rtt); smallSCreen.x = 0; smallSCreen.y = 0; smallSCreen.width = 100; smallSCreen.height = 100; triangle.position.set(400, 300); app.stage.addChild(container); app.stage.addChild(smallSCreen); app.ticker.add((delta) => { triangle.rotation += 0.01; app.renderer.render(container, rtt); }); Quote Link to comment Share on other sites More sharing options...
trsh Posted September 7, 2020 Author Share Posted September 7, 2020 Ehh, never mind, got the sizes wrong.. Somehave I was thinking that `app.renderer.render(container, rtt);` would squeeze the whole thing into 200, 200 render texture Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.