Java:VolatileImage比BufferedImage慢 [英] Java : VolatileImage slower than BufferedImage

查看:362
本文介绍了Java:VolatileImage比BufferedImage慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用java编写游戏,并使用BufferedImages将内容呈现在屏幕上。我在运行游戏的低端机器上遇到了性能问题,所以我转而使用速度更快的VolatileImage。



使用GraphicsConfiguration.createCompatibleVolatileImage(...)创建图像,并使用 Graphics.drawImage(...)(点击链接查看哪一个特别)。它们被绘制在使用双缓冲的Canvas上。



是否有人对这里出了什么问题有了解?

解决方案

很可能你的代码混合了加速和不加速的操作。

文档是必须阅读的。对于使用加速Java图形的人来说,特别是3.2节是必不可少的。


I'm making a game in java and in used BufferedImages to render content to the screen. I had performance issues on low end machines where the game is supposed to run, so I switched to VolatileImage which are normally faster. Except they actually slow the whole thing down.

The images are created with GraphicsConfiguration.createCompatibleVolatileImage(...) and are drawn to the screen with Graphics.drawImage(...) (follow link to see which one specifically). They are drawn upon a Canvas using double buffering.

Does someone has an idea of what is going wrong here ?

解决方案

Most likely your code is mixing accelerated and unaccelerated operations.

This document is a must read. Section 3.2 in particular is essential for anyone working with accelerated Java graphics.

这篇关于Java:VolatileImage比BufferedImage慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆