Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify sprite limits (addImage) #9879

Closed
pathmapper opened this issue Jul 16, 2020 · 3 comments
Closed

Clarify sprite limits (addImage) #9879

pathmapper opened this issue Jul 16, 2020 · 3 comments

Comments

@pathmapper
Copy link
Contributor

mapbox-gl-js version: v1.11.1

Question

From the docs for addImage:

A Map.event:error event will be fired if there is not enough space in the sprite to add this image.

Could you please clarify "not enough space in the sprite"?

Links to related documentation

@mourner
Copy link
Member

mourner commented Jul 16, 2020

We should document this better, but basically this is bounded by WebGL MAX_TEXTURE_SIZE, which depends on the user's GPU. Most of the time it's at least 4096x4096, and many modern GPUs have 8192x8192 or 16384x16384. You can check yours through map.painter.context.maxTextureSize.

@pathmapper
Copy link
Contributor Author

Thanks @mourner, map.painter.context.maxTextureSize worked (with main, #9694 didn't make it into a release until now).

Is there a way to get the current sprite size to find out how much space is left until maxTextureSize is reached?

@pathmapper
Copy link
Contributor Author

pathmapper commented Jul 16, 2020

The use case is to add several images with addImage and make sure that it's working for most users, so 4096x4096 seems to be an appropriate maximum sprite size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants