Is it possible to use WebGL max texture size?

后端 未结 1 1766
北恋
北恋 2020-12-17 19:57

I am working on an app where higher resolution is always better.

But I\'m stuck with WebGL max_texture_size problems. I create an image of size exactly this dimensio

相关标签:
1条回答
  • 2020-12-17 20:52

    gl.getParameter(gl.MAX_TEXTURE_SIZE) returns the maximum dimension the GPU can address. In other words, you can make a 1xMAX or a MAXx1 texture and it should work all the way up to MAXxMAX if you have the memory.

    On the other hand you can not make (MAX+1)x1 because MAX+1 is > MAX.

    But, MAXxMAX, well, in your case

    16384 * 16384 * 4 (RGBA) * UNSIGNED_BYTE = 1073741824 or 1GIG!!!
    

    Does your GPU have 1Gig? In fact it will need more than 1Gig because it's using memory for the OS and Chrome itself and mips and whatever else. Maybe better example

    16384 * 16384 * 4 (RGBA) * FLOAT = 4294967296 or 4GIG!!!
    

    Even if it your GPU has lots of memory the browsers might limit the amount of memory you can access. Most likely your browser is running out of memory which is why it's crashing.

    As for knowing the limit on any device there is arguably no way to know that. First off you can't check which GPU the user's machine has except in Chrome (which other browsers argue is a privacy issue). Second you don't know what else is running on their machine and taking up memory.

    0 讨论(0)
提交回复
热议问题