Textures rising and falling with dispose()
MeshBasicMaterial is used so the count starts at 0 (a Standard material adds one lookup table). The last two lines: a texture disposed while still in the scene comes back at the next render.
A texture costs width × height × 4 bytes on the GPU, plus a third for mipmaps, whatever its file size. renderer.info.memory.textures counts them, and dispose() frees them.
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.
Your showroom uses 12 textures of 2048 × 2048 with mipmaps. What is the total, and is it a problem?
Write the code that changes a mesh's colour map and frees the old one.
Explain it without notes
A texture is a 300 KB JPEG at 2048 × 2048. How much GPU memory does it take, and how do you cut it?
What does renderer.info.memory.textures tell you, and what does it not?
Console
Nothing logged yet.Expected console output
created 6 textures, nothing drawn yet: 0
after the first render(): 6
removed 3 cards and disposed their textures: 3
disposed a texture that is still used: 2
after the next render(): 3 (it was uploaded again)