tezvyn:

WebGL Textures: From Image File to GPU Pixels

Source: developer.mozilla.orgadvanced

WebGL textures are images uploaded to the GPU for fast access when "painting" 3D models. They're used to apply detailed surfaces like brick patterns. The footgun: images must be CORS-approved, and non-power-of-two dimensions break mipmapping in WebGL1.

A WebGL texture is an image buffer on the GPU, giving shaders high-speed access to pixel data. It's like applying a decal to a 3D model to add rich detail. This is key for rendering realistic surfaces like wood grain or brick. The footgun: texture loading is subject to cross-domain CORS policies, and in WebGL1, images with non-power-of-two dimensions (like 300x500) can't use mipmaps and have restricted wrapping modes.

Read the original → developer.mozilla.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

WebGL Textures: From Image File to GPU Pixels · Tezvyn