具有硬件加速 3D 图形的 Java 小程序? OpenGL 和/或DirectX
我通过谷歌搜索找不到这个问题的明确答案。
如果我想要一个 Web 小程序,Java 中是否有一个库可以利用客户端计算机上的硬件加速图形驱动程序,如 OpenGL 和 directx? 我想象在小程序启动之前编写一些驱动程序检测代码来检测 3D 图形功能。
我意识到有很多 Java 3D 库,但无法弄清楚这一点。
我的印象是你可以做到这一点,但找不到它。
当我问时,Flash 和 Silverlight 怎么样? 我以为他们所有的 3D 图形都是软件渲染的?
编辑:
我看到问题的答案是肯定的,Java 确实有 3D 硬件支持。 感谢您提供的所有信息!
我想我真正的问题是(我的意思):
1)这在多大程度上支持充分使用? 例如,您可以使用 DirectX 或 OpenGL 着色器吗? 我可能期望某些功能会丢失,因为这往往会将事物抽象出来。 我可以制作一个 GPUID 程序或实用程序来详细列出客户端的 GPU 功能吗?
2)实用吗? 我能否将像《Quake》这样的旧 3D 游戏移植到 Java 小程序上并获得不错的性能? (当然取决于客户端系统)
I can't find a clear answer to this question with all my googling.
If I want a web applet, is there a library in Java that takes advantage of the hardware accelerated graphics drivers on the client's machine, as in OpenGL and directx? I'm picturing writing some driver detection code before the applet launches to detect 3D graphics capabilities.
I realize there are a lot of Java 3D libraries but can't figure this out.
I was under the impression that you could do that, but can't find it.
While i'm asking, how about Flash and Silverlight? I thought all their 3D graphics are software rendered?
EDIT:
I see the answer to the question is yes, Java does have 3D hardware support. Thanks for all the info!
I guess my real question is (what I'm getting at):
1) To what extent is this supported for full use? Can you use DirectX or OpenGL shaders, for example? I might expect some features to be missing as that tend to abstract things out. Could I make a GPUID program or a utility that list's the client's GPU capabilities in detail?
2) Is it practical? Could I port an old 3D game like Quake to a Java applet and have decent performance? (depends on client system of course)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
applet-launcher 项目 应该有帮助:
JOGL 有一个示例小程序此处,Java3D 有两个示例此处。
The applet-launcher project should help:
JOGL has a sample applet here, and Java3D has two samples here.
DirectX 是 Microsoft 专有的 3D 系统,因此除非您确定只能在 Microsoft 系统上运行,否则我会避免使用 DirectX。
JOGL 和 Java3D 有很大不同。 JOGL 是 OpenGL 上的一个薄层,具有其所暗示的所有优点和缺点。 Java3D 是一个完整的场景图系统。
DirectX is a proprietary Microsoft 3D system, so unless you are sure you will only run on Microsoft systems I would avoid DirectX.
JOGL and Java3D are very different. JOGL is a thin layer over OpenGL, with all the advantages and disadvantages that implies. Java3D is a full scenegraph system.
编写访问 3D 硬件的 Java 小程序是完全可能的。 env3d 项目 (http://env3d.org) 正是这样的——一个生成 3D 加速的 3D 小程序的 java 3D 引擎。 网站上有很多示例程序来演示如何在浏览器中使用硬件加速 3D。 唯一的要求是必须安装 Java,并且用户必须明确允许小程序访问本地资源的权限。
Env3D 基于 lwjgl,一个 Java 的 opengl/gaming 包装器。 它甚至支持着色器和其他高级功能。
It is totally possible to write java applets that access the 3D hardware. The env3d project (http://env3d.org) is exactly that -- a java 3D engine that produces 3D accelerated 3D applets. There are lots of example programs on the website to demonstrate the use of hardware accelerated 3D inside your browser. The only requirement is that Java has to be installed and the user has to explicitly allow the applet permission to access local resources.
Env3D is based on lwjgl, a opengl/gaming wrapper for Java. It even supports shaders and other advanced features.
Java 从 1.5 开始就支持硬件加速图形。
请参阅发行说明,了解如何操作< /a>. 注意:这是针对 2D 的。
对于 3D,J2SE 有 Java3D。
Support for hardware accelerated graphics has been in Java since 1.5.
See the release notes on how to do it. Note: this is for 2D.
For 3D, J2SE has Java3D.
Flash 支持伪 3D,但不支持任何类型的 OpenGL 加速全场景 3D(基本上只是透视扭曲效果)。 还有一些面向软件的解决方案(例如,Papervision3D)。
Silverlight 将在今年晚些时候发布 3.0 版本并支持伪 3D。 据我所知,目前还没有全 3D 的计划。
据说 JavaFX 计划的后续版本计划提供 3D 支持,这将(如果发生的话)大大改善小程序中的支持。
Flash supports pseudo-3D, but not any kind of OpenGL accelerated full-scene 3D (basically just perspective warping effects). There are some software oriented solutions as well (eg, Papervision3D).
Silverlight will support pseudo-3D as well with the 3.0 release later this year. As far as I know, there are currently no plans for full 3D there.
Supposedly 3D support is planned for a later release of the JavaFX initiative, which would (if it ever happens) improve support in applets quite a bit.
值得注意的是,在新版本的 Java(我认为是 1.6 版本 10?)中,Windows 的图形管道有了显着的改进。
It also may be useful to note that in the new versions of Java (I think 1.6 release 10?) there were significant improvements to the graphics pipeline for windows.
我上次检查过,你不会有着色器; 除了您可能认为的 DX5 或 DX6 级别功能之外,您基本上还会获得一个场景图形 API,具体取决于您正在做什么。
You won't have shaders, last I checked; you get basically a scenegraph API on top of what you might consider to be DX5 or DX6 level functionality, depending on what you're doing.