Business FAQs

Why do WebGL textures require power-of-two dimensions and mipmaps?

0
(0)

WebGL 1 requires power-of-two texture dimensions to generate mipmaps and use REPEAT/MIRRORED_REPEAT wrapping; non-POT textures only support CLAMP_TO_EDGE and no mipmaps. WebGL 2 removed most of this restriction, but POT textures remain the safe, portable choice, especially for mobile.

At a glance

Fact Value Source
WebGL spec version most affected by POT rule WebGL 1 developer.mozilla.org
Common power-of-two texture sizes 128, 256, 512, 1024 docs.monogame.net
Safe max texture size for mobile browsers 2048px mobile, 4096px desktop docs.phaser.io

In WebGL 1, a texture whose width and height are both powers of two (128, 256, 512, 1024…) can use mipmapping and the REPEAT or MIRRORED_REPEAT wrap modes. A non-power-of-two texture is restricted to CLAMP_TO_EDGE wrapping and cannot generate mipmaps at all – the GPU pipeline that builds and samples mip levels was designed around the power-of-two math. WebGL 2, based on OpenGL ES 3.0, relaxed most of this: non-power-of-two textures can mipmap and wrap normally. But WebGL 2 support on older mobile browsers is not universal, so power-of-two sizes remain the safer default for any game meant to run across many devices and portal iframes.

When publishing through Playgama, the Playgama MCP server lets an AI agent handle the upload and publish a sandbox link for testing.

Mipmaps matter for a second reason beyond wrapping: they store pre-shrunk copies of a texture so the GPU samples a small version when an object is far from the camera, which reduces aliasing and cuts the memory bandwidth spent per frame. A texture atlas packed at power-of-two dimensions also avoids GPU texture swaps and simplifies loading, since you track one image instead of many. If you use compressed formats (KTX2, Basis), note that WebGL itself provides no compression or decompression – textures must already be compressed before upload to video memory.

Check your engine’s actual limit rather than assuming: Phaser exposes renderer.getMaxTextureSize(), and mobile Safari and Chrome commonly cap canvas/texture size lower than desktop.

Sources

Does WebGL 2 remove the power-of-two texture requirement entirely?

Mostly yes – non-power-of-two textures can mipmap and use all wrap modes in WebGL 2. Older devices without WebGL 2 still enforce the WebGL 1 restrictions, so POT remains the portable choice.

What happens if I load a non-power-of-two texture in WebGL 1?

It loads and renders, but only with CLAMP_TO_EDGE wrapping and no mipmaps – calling generateMipmap on it either fails or is ignored depending on the browser.

Last updated: 30 September 2026


How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Your email address will not be published. Required fields are marked *

Games categories