用 Java 绘制图像,在上网本上慢得要命

发布于 2024-08-31 02:31:19 字数 776 浏览 7 评论 0原文

跟进我之前的问题(尤其是这个:Java:VolatileImage 比 BufferedImage 慢),我注意到简单地绘制一个图像(无论它是缓冲的还是易失的,因为计算机没有加速内存*,并且测试表明它不会改变任何东西)往往会很长。

(*) System.out.println(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getAvailableAcceleratedMemory()); --> 0

多久?对于 500x400 的图像,大约需要 0.04 秒。这在后台缓冲区上绘制图像(通过缓冲区策略获得)。

现在考虑到《魔兽世界》在上网本上运行(尽管它相当滞后),而在线java游戏似乎没有任何问题,这相当发人深省。

我很确定我没有错过任何明显的东西,我已经在网上进行了广泛的搜索,但没有任何作用。那么,你们中的任何一个java高手是否知道可能是什么隐晦的问题导致了这种情况(或者也许这是正常的,我对此表示怀疑)?

PS:当我写这篇文章时,我意识到这可能是由于我的 Linux 安装 (archlinux) 造成的,因为我有正确的 Intel 驱动程序。但我的电脑通常有“集成英特尔图形媒体加速器 950”,这意味着它应该以某种方式加速视频内存。关于这方面的事情有什么想法吗?

In follow-up to my previous questions (especially this one : Java : VolatileImage slower than BufferedImage), i have noticed that simply drawing an Image (it doesn't matter if it's buffered or volatile, since the computer has no accelerated memory*, and tests shows it's doesn't change anything), tends to be very long.

(*) System.out.println(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getAvailableAcceleratedMemory()); --> 0

How long ? For a 500x400 image, about 0.04 seconds. This is only drawing the image on the backbuffer (obtained via buffer strategy).

Now considering that world of warcraft runs on that netbook (tough it is quite laggy) and that online java games seems to have no problem whatsoever, this is quite thought provoking.

I'm quite certain I didn't miss something obvious, I've searched extensively the web, but nothing will do. So do any of you java whiz have an idea of what obscure problem might be causing this (or maybe it is normal, tough I doubt it) ?

PS : As I'm writing this I realized this might be cause by my Linux installation (archlinux) tough I have the correct Intel driver. But my computer normally has "Integrated Intel Graphics Media Accelerator 950", which would mean it should have accelerated video memory somehow. Any ideas about this side of things ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无所的.畏惧 2024-09-07 02:31:19

我也在运行 Arch Linux,并注意到我的游戏有时会变慢,尤其是在图像中使用 alpha 透明度时。事实证明,不仅是Linux,甚至Windows有时也会默认关闭硬件加速。

我寻找问题的解决方案并发现了这个:
http://web.archive.org /web/20120926022918/http://www.systemparadox.co.uk/node/29

启用 OpenGL 大大加快了我的帧速率,我认为如果您再次运行测试,您会获得更快的绘制速度。

I'm also running Arch Linux and noticed my games going slow sometimes, especially when using alpha transparencies with my images. It turns out that even Windows, not only Linux sometimes turns off hardware acceleration by default.

I looked for a solution to the problem and found this:
http://web.archive.org/web/20120926022918/http://www.systemparadox.co.uk/node/29

Enabling OpenGL considerably sped up my framerates, and I assume if you ran your tests again, you'd get faster draws.

臻嫒无言 2024-09-07 02:31:19

我对java图形了解不多,但如果我处在你的立场上,我会认为如果没有比较值,测量就没有任何意义,听起来你可能有但没有共享。将此信息以及比较系统的规格添加到您的问题中(它是台式机吗?它有专用显卡吗?它运行 Windows 还是 Linux?)。


根据您的测量,另一台上网本的速度快了 10 倍,那台笔记本电脑运行的是 Windows 还是 Linux? Linux 历来拥有非常平庸的图形驱动程序 - 它们的运行效果几乎不如 Windows 的同类驱动程序。事实上,很长一段时间以来,您可以获得的唯一驱动程序不是由 ATI/nVidia/等公司编写的,而是由业余爱好者编写的。如果 Linux 机器运行图形程序的速度比运行 Windows 的类似机器慢十倍,我一点也不会感到惊讶。

这是我五年前所了解的情况。我怀疑它已经改变了很多。

I don't know much about java graphics, but if I were in your shoes, I would assume that the measurement means nothing without a comparison value, which it sounds like you might have but are not sharing. Add this information to your question, along with the specs of the comparison system (is it a desktop? does it have a dedicated video card? does it run windows or linux?).


Concerning your measurement that it's 10 times faster on another netbook, does that other notebook run Windows, or is that one also Linux? Linux has historically had very mediocre graphics drivers - they just don't run nearly as well as the Windows equivalents. In fact for a long time the only drivers you could get were not written by ATI/nVidia/etc., but rather by hobbyists. It would not surprise me at all if a Linux machine ran a graphical program ten times slower than a similar machine running Windows.

This was the situation as I understood it about five years ago. I doubt it's changed much.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文