Reading and writing the same texture
1282 is the WebGL error code INVALID_OPERATION. Two targets taking turns (ping-pong) avoid it.
A render target is a picture the GPU draws into instead of the screen. It becomes a texture you can show on a mirror, a screen inside the scene, or feed to an effect. It costs memory, and it does not resize by itself.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 4 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Compute the memory of a half-float target for a 1366 × 768 screen at ratio 1, and of a chain holding two.
Write the lines that draw photoScene into target and then world to the canvas, restoring whatever target was active before.
Explain it without notes
What is a render target, and when would a showroom need one?
Why does a render target not resize with the canvas, and how do you keep them in step on a phone with pixel ratio 3?
Console
Nothing logged yet.Expected console output
a shows a: 1282 (1282 = INVALID_OPERATION: reading and writing one texture)
a shows b: 0
b shows a: 0 (two targets, taking turns: ping-pong)