Search code examples
htmlcanvashtml5-canvas

Can you use canvas.getContext('3d')? If yes, how?


I read about the canvas tag in HTML5, and always saw getContext('2d').
The parameter is '2d', so isn't there another possibility like '3d'?
And, how could you use that? I tried 3D before, but didn't really understand (due to a non-explaining tutorial). Any Tutorials?


Solution

  • There is a 3D context for canvas, but it is not called "3d". Instead, there is "webgl" (for the WebGL API) and "webgpu" (for the newer, but lower-level WebGPU API).