简体   繁体   English

Java中的双缓冲替代

[英]Double Buffering Alternative in Java

Basicly, I have an falling sand type game that is getting pretty complex and laggy, and my friend which is also working on it keep saying me that the double buffering is the main source of lag. 基本上,我有一款摔落式的游戏,变得越来越复杂和漫长,而我也在努力工作的朋友一直在说我,双重缓冲是延迟的主要来源。 I know that without double buffering, the game would be totally unplayable. 我知道没有双重缓冲,游戏将完全无法进行。 So, is there another way to have smooth graphic and better performances, or this is impossible and I should just deal with it? 因此,是否还有另一种方法可以使图形平滑并具有更好的性能,或者这是不可能的,我应该解决它?

Thanks 谢谢

I assume you currently use Java2D. 我假设您当前正在使用Java2D。 You can easily run into trouble regarding performance. 您很容易遇到性能方面的麻烦。 Sometimes simply changing the image format is sufficient to make your application run twice as fast. 有时,仅更改图像格式就足以使您的应用程序运行速度快两倍。 You are probably looking for something like this: What are some faster alternatives to Java2d? 您可能正在寻找这样的东西: Java2d有哪些更快的替代品?

For a real computer game (more complex graphics or not) you could entirely switch to openGL. 对于真正的计算机游戏(是否使用更复杂的图形),您可以完全切换到openGL。 There is LWJGL that also provides input and audio playback for games: http://lwjgl.org/ 有LWJGL还可以为游戏提供输入和音频回放: http ://lwjgl.org/

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

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