Back to the Shapespark home page

[API] Resolution of a texture when changing via script


I’m trying to change some high quality textures on the click of a button. When i do, everything is black. I tried with the textures in the API example and it works (brick.jpg for example). I noticed only a 512x512 pixels texture works. Is there a way to overpass this limit?

Thanks a lot !

Hi, the textures used in WebGL are required to have power of two dimensions, so try 1024x1024, 2048x2048 or 4096x4096. Non-square dimensions are also OK, as long as both are power of two, for example 512x4096 is OK. Some devices limit the texture dimensions to max 4096, so rather don’t use larger dimensions.

Note: these requirement apply only to textures loaded via JavaScript API. Importer textures or textures added via Shapespark editor are automatically converted to have power of two dimensions.

Oh that works ! Thanks a lot ! Would be helpful to mention it in the API doc :slight_smile: