Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
703 views
in Technique[技术] by (71.8m points)

opengl - Is there a max libGDX texture size for desktop?

I know that on mobile devices, the largest texture you could render in a single draw differs: sometimes it is a mere 1024x1024 - other times 2048x2048 etc.

What is the case for Desktop games? I am using OpenGL 2.0.

I intend to draw one single background sprite that could be as big as 5000x5000. I am guessing that TexturePacker is not quite useful in this scenario, because I don't really need an atlas since I'm just trying to make a single sprite.

Yes, I just tested for 5000x5000 and it works just fine. Just wondering if there's an actual limit to consider. Maybe it differs from one computer to another?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...