Is there a max libGDX texture size for desktop?

与世无争的帅哥 提交于 2019-11-29 10:55:05
P.T.

The maximum texture size is a function of OpenGL, which leaves the size to the video card's device driver (within bounds).

You can check at run-time to see what the reported limits are (though see Confusion with GL_MAX_TEXTURE_SIZE for some caveats).

To find out what a variety of hardware reports in practice, there are some sites that collect databases of results from users (mostly concerned with benchmark performance), that often also collect data like max texture size. (E.g., gfxbench.com, or http://opengl.gpuinfo.org/gl_stats_caps_single.php?listreportsbycap=GL_MAX_TEXTURE_SIZE)

I think on a modern desktop GPU 5000x5000 will be well under the supported limit.

In addition to what P.T. said, I wanted to supply the code for that (in libGDX).

IntBuffer intBuffer = BufferUtils.newIntBuffer(16);
Gdx.gl20.glGetIntegerv(GL20.GL_MAX_TEXTURE_SIZE, intBuffer);
System.out.println(intBuffer.get());

On my desktop system this results in 4096, meaning that the max size supported is 4096x4096. My system is not that old though. You should probably not assume that 5000x5000 is available on all desktop systems. Usually you don't need textures that big so not all GPUs support that. You can always split it up in several textures and draw it on multiple quads next to each other to work around that problem.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!