简体   繁体   English

libgdx游戏,ldpi屏幕上不显示图形

[英]libgdx game, graphics are not displayed on ldpi screen

I am loading all assets at the beginning of game play but on ldpi mobiles, after splash screen, it shows a white screen and I get the error egl swap memory buffer. 我在游戏开始时正在加载所有资产,但是在ldpi手机上,启动屏幕之后,它显示白色屏幕,并且出现错误egl swap内存缓冲区。 my code is as follows: in splash screen at constructor: 我的代码如下:在构造器的初始屏幕中:

Assets.loadAssets();

in updateMethod 在updateMethod中

if(Assets.manager.update())    
{
    Assets.getLoadAssets();
    gameSplashObj.setScreen(new MainMenu(gameSplashObj));    
}

but I will get white screen. 但我会出现白屏。 Am I doing something wrong or any other optimize way to achieve this. 我在做错什么或任何其他优化方法来实现这一目标。

That usually happens (images as plain white) when the texture you are loading is bigger than the max texture size the device can handle (GL_MAX_TEXTURE_SIZE). 当您加载的纹理大于设备可以处理的最大纹理大小(GL_MAX_TEXTURE_SIZE)时,通常会发生这种情况(图像为纯白色)。

If you plan on supporting ldpi devices, consider making your textures smaller. 如果计划支持ldpi设备,请考虑缩小纹理。

one easy way to solve this problem is While packing the image ** 解决此问题的一种简单方法是打包图像时**

set maximun width and height to 512 ,512 or even lower 256 ; 将最大宽度和高度设置为512,512或更低的256; instead of 1024 or 2048. 而不是1024或2048。

** this way your graphics size will also not increase and on same time it solves problems with ldpi devices **这样,您的图形大小也不会增加,并且同时可以解决ldpi设备的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM