OpenGL/通用图形的最佳动态语言
哪些是最成熟且支持良好的图形程序编写解决方案?
我一直在使用 C++ 和 OpenGL/GLUT,但想尝试一种更灵活和更具表现力的方法。
Ruby 和处理? Python 和 OGRE?哪些事情对你来说效果很好?
Which are the most mature and well supported solutions for writing graphical programs?
I have been using C++ with OpenGL/GLUT, but would like to try a more flexible and expressive approach.
Ruby and Processing? Python and OGRE? What things have worked well for you?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您只是想尝试一下,我建议您选择一个带有您已经熟悉的动态语言绑定的 3D 框架。
我在一三年前开始使用 Ruby/OpenGL 进行实验,这很容易操作。
如果您真的想构建一个项目(无论出于何种原因),我建议您选择一个基于以下组合的框架:
如果您希望您的项目能够相当轻松地在不同的操作系统上运行,您可能需要选择一个用 Java 编写的框架(因为 JVM 随处运行),并使用 Ruby (jRuby) 或 JavaScript 进行绑定(因为这些语言在那里得到了很好的支持)。然而,这会限制您可用的框架。 (这是我对 OSS + linux 的偏见)。
维基百科有一个游戏引擎列表。基于几个标准,我使用 jMonkeyEngine (v2) 启动了一个项目,发现它很容易使用和控制 Rhino(一个 JVM JavaScript 实现)。
我最近看到了另一个基于 Java 的框架的演示,其中绑定了几种语言,看起来非常酷(受到 Ogre 引擎的启发),但我忘记了名称,并且无法在列表中找到它。
在做 C# 的时候,我确实研究过针对 dotNet 和 Mono 跨平台运行的项目/框架,但是让(Tao?)框架的开发版本和 Mono Lua 绑定运行起来太麻烦了。也许事情已经改变了。
总而言之,选择一个可以在您想要的环境上运行的框架,并绑定您想要使用的动态语言。即使您想要使用的动态语言可用的框架库代码相当少,如果您可以使用底层语言,您也可以轻松扩展它。如果您精通 C++,那么 Java 和 C# 应该不会太困难。
If you are just interested in experimenting, I'd suggest picking a 3D framework with bindings for a dynamic language you are already familiar with.
I started doing experiments with Ruby/OpenGL a year or three ago and that was easy enough to play around with.
If you seriously want to build a project (for whatever reason), I'd suggest picking a framework based on a combination of
If you want your project to be fairly easily running across different OS'es, you'll probably want to pick a framework written in Java (because the JVM runs everywhere) with bindings in Ruby (jRuby) or JavaScript (because these languages are well supported there). This would, however, limit the frameworks available to you. (This is my OSS + linux bias showing).
Wikipedia has a list of game engines. Based on several criteria I started a project with jMonkeyEngine (v2) and found it easy to work with and control from Rhino (a JVM JavaScript implementation).
I recently saw a presentation from another Java-based framework with bindings for several languages that looked really cool (inspired by the Ogre engine), but I forget the name and can't find it in the list.
Doing C# at the time I did look at projects/frameworks targeting both dotNet and Mono for running across platforms but it was too much hassle to get the development builds of the (Tao?) framework and the Mono Lua bindings running. Maybe things have changed.
To sum it up, pick a framework that can run on the environment(s) you want with bindings for the dynamic language that you want to use. Even if the framework library code available for the dynamic language you want to use is fairly minimal you can easily extend it if you can work with the underlying language. If you're fluent with C++, Java and C# shouldn't be too much of a stretch.
如果您熟悉 C++,您可以尝试 Lua。 Lua是一种动态语言,可以嵌入到任何C/C++程序中。它在游戏行业非常受欢迎。
Given you are familiar with C++, you might give Lua a try. Lua is a dynamic language that can be embedded in any C/C++ program. It is very popular in the game industry.
我想提到 Python 和 PyOpenGL 作为一个值得考虑的选项。
如果您已经熟悉 OpenGL,那么 PyOpenGL 基本上是用 Python 编写的 API 包装器。起初我很惊讶 Python 和 C++ 中的代码看起来如此相似。像这样(注意我也在使用 Pyglet):
看看它与 C++ 代码有多么相似。
我能够快速掌握 Python 中的 PyOpenGL,并在 200 行之内实现了一个四元数类。如果您对 Python 感到满意,我会毫不犹豫地推荐您检查一下。
顺便说一句, PyOpenGL 的 API 文档 比也是官方。
I would like to mention Python with PyOpenGL as an option to consider.
If you are already familiar with OpenGL, PyOpenGL is basically a API wrapper written in Python. I was surprised at first how similar the code looks in Python and in C++. Like this (note I'm also using Pyglet):
See how similar it is to C++ code.
I was able to quickly pick up PyOpenGL in Python, and implemented a Quaternion class under 200 lines. If you're comfortable with Python, I wouldn't hesitate to recommend you to check it out.
By the way, PyOpenGL's API documentation is far more readable than the official one, too.
如果您正在寻找支持开箱即用的 OpenGL(无外部绑定)的动态语言,请尝试以下操作:
If you are looking for dynamic languages that support OpenGL out-of-the-box (no external bindings) try these:
如果您在成熟和支持之后,我个人的建议是处理 - 非常灵活,开源,文档齐全,并且< a href="http://www.openprocessing.org/" rel="nofollow noreferrer">很棒的社区。语法与 C 类似,因此您应该不难掌握它。
一个看起来非常有前途的稍微前沿的解决方案(但我还没有时间进行测试!)是 Penumbra< /a> - 用于以动态函数式编程风格进行 OpenGL 开发的 Clojure 库。这是一个优雅的小片段:
请注意,由于 Clojure 宏的大量巧妙之处,它会自动且透明地处理诸如在正确的时间弹出转换矩阵之类的事情。其他看起来不错的东西还有 GPGPU 支持。
My personal suggestion if you are after maturity and support would be Processing - very flexible, open source, well documented and a great community. Syntax is C-like so you should have no difficulty picking it up.
One slightly more cutting edge solution that looks very promising (but I haven't got round to testing yet!) is Penumbra - a Clojure library for OpenGL development in a dynamic functional programming style. Here's a elegant little snippet:
Note that thanks to lots of Clojure macro cleverness, it automatically and transparently handles things like popping the transformation matrices at the right time. Other things that look good are things like GPGPU support.