OpenGL ES 2.0 推荐的练习环境?
我决定学习一些 OpenGL ES 2.0,并尝试为其选择一个练习平台。可能的目标平台可能是 Android、iPhone 或 WebGL。但我不想花费太多时间和精力来正确设置环境。
您会推荐 WebGL 来快速开始 OpenGL ES 2.0 学习还是其他东西?
编辑:我使用的是 Mac,目前对 ES 1.x 并不真正感兴趣。
I decided to learn some OpenGL ES 2.0 and I am trying to pick a practice platform for it. What comes to possible target platform, it could be Android, iPhone or WebGL. But I don't want to spend too much time and effort to get the environment setup properly.
Would you recommend WebGL for a fast start to OpenGL ES 2.0 learning or something else?
Edit: I am using Mac and I am not really interested in ES 1.x at the moment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您在 iOS 开发人员中心(免费)注册为开发人员,您可以下载 Xcode 并iOS SDK(同样,当您获得 Xcode 3 时免费),其中包括一个支持 OpenGL ES 2.0 的模拟器。当然,这假设您有一台 Mac 来运行这一切。
获得 SDK 后,您只需启动 Xcode 并基于 OpenGL ES 应用程序模板创建一个新应用程序即可。该应用程序将是一个功能齐全的 OpenGL ES 1.1 和 2.0 iOS 应用程序,您可以在模拟器中构建和运行它。您可以忽略所有特定于 iOS 的设置代码,而专注于
xxxViewController.m
类中的-drawFrame
方法,这是 OpenGL ES 2.0 绘图代码所在的位置。这是一个可以非常快速地设置用于使用 OpenGL ES 2.0 着色器的环境。我还尝试了trenki 建议的PowerVR SDK 包,使用它进行设置需要更多的工作。如果您使用的是 Windows,那么它将比我在此描述的基于 Mac 的 iOS SDK 更可行。
另一种可以在 Mac 上方便地进行原型设计的着色器开发工具是 Quartz Composer。它与 Xcode 一起提供,并为各种效果(包括 OpenGL 着色器)提供了可视化原型环境。我在我写的一篇文章中演示了进行此类原型设计的示例 此处。桌面 GLSL 和 OpenGL ES 中的实现略有不同,但两者之间有很多相同之处。
虽然针对 iOS,我最近教授了有关 OpenGL ES 2.0 的课程,作为可以下载的课程的一部分 来自 iTunes U 免费。它可能有助于加快着色器的速度。
If you register as a developer at the iOS Developer Center (free), you can download Xcode and the iOS SDK (again, for free when you get Xcode 3), which includes a simulator capable of OpenGL ES 2.0. This of course assumes you have a Mac to run that all on.
Once you have the SDK, you can simply start up Xcode and create a new application based on the OpenGL ES Application template. This application will be a fully functional OpenGL ES 1.1 and 2.0 iOS application that you can build and run in the simulator. You can ignore all of the iOS-specific setup code and focus on the
-drawFrame
method in thexxxViewController.m
class, which is where the OpenGL ES 2.0 drawing code lies.This can be a pretty quick environment to set up for playing with OpenGL ES 2.0 shaders. I've also tried out the PowerVR SDK package that trenki suggests, and it is a little more involved to get something set up with that. If you're on Windows, it will be a lot more viable of a solution than the Mac-based iOS SDK I describe here.
One other shader development tool that can come in handy for prototyping on the Mac is Quartz Composer. It comes along with Xcode, and provides a visual prototyping environment for all sorts of effects, including OpenGL shaders. I demonstrate an example of doing this kind of prototyping in an article I wrote here. Desktop GLSL and the implementation in OpenGL ES differs slightly, but much is the same between the two.
While targeted at iOS, I taught a class on OpenGL ES 2.0 recently as part of a course that can be downloaded from iTunes U for free. It might helpful in getting up to speed on shaders.
我建议您下载并设置用于 POWERVR SGX PC 仿真的 Khronos OpenGL ES 2.0 SDK 包(不幸的是你必须注册才能下载)。这使您可以在台式计算机上启动并运行所有内容,这将使您的调试工作变得更加轻松。然后,您可以使用 C/C++ 开发 OpenGL ES 2.0 应用程序。
如果我没记错的话,我的 Android 手机(三星 Galaxy S)也使用这个 OpenGL 实现。
除了使用 Khronos SDK,您还可以使用 Mesa3D 项目中的 OpenGL ES 2.0 库(Ubuntu 的存储库中有它们)。它们工作得很好,但我不能推荐它们,因为我已经遇到过结果与 Khronos SDK 实现和我的 Android 设备不同的情况。
编辑:您还必须创建一个窗口和一个 OpenGL 渲染上下文才能实际使用 OpenGL。为此,我可以推荐 SDL (1.3),它也有适用于 Android 的官方端口。我使用上述 SDK 在 Android 和 Ubuntu 上进行了测试。它允许我对两者使用相同的代码。
I suggest you download and setup the Khronos OpenGL ES 2.0 SDKs for POWERVR SGX PC Emulation package (Unfortunately you have to register to be able to download). This allows you to get everything up and running on a desktop computer which will make your life a lot easier when it comes to debugging. You can then use C/C++ to develop your OpenGL ES 2.0 applications.
If I'm not mistaken my Android phone (Samsung Galaxy S) also uses this OpenGL implementation.
Instead of using the Khronos SDK you could also use the OpenGL ES 2.0 libraries from the Mesa3D Project (Ubuntu has them in the repository). They work fine but I can't recommend them because I already ran into a situation where the results differed from the Khronos SDK implementation and my Android device.
EDIT: You also have to create a Window and an OpenGL rendering context in order to actually use OpenGL. For that I can recommend SDL (1.3) which also has an official port for Android. I tested it on Android and Ubuntu with the mentioned SDK. It allows me to use the same code for both.
如果是为了游戏开发,请尝试使用框架,这样您就不必自己执行婴儿步骤:-)。
这里有一些可以帮助您入门的内容(我更喜欢 Android 的:-)):
Android
- Min3d
- Libgdx
- AndEngine
iPhone
- Cocos2d
- Sparrow
WebGL
- 教程
- glge
If its for game developing try using a framework, this way you don't have to do the baby steps yourself :-).
Here are some to get you started ( i prefer the android ones :-) ) :
Android
- Min3d
- Libgdx
- AndEngine
iPhone
- Cocos2d
- Sparrow
WebGL
- Tutorial
- glge
如果您想学习 OpenGL ES 并拥有一台 Mac,我建议您阅读这本书:
http://iphone- 3d-programming.labs.oreilly.com/(你可以从网上阅读它,或者购买它,我认为这是值得的)
除了OpenGL本身之外,它还解释了一些数学并显示了OpenGL ES所有示例均采用 1.1 和 2.0 方式。
(取决于您想要做什么,有时 1.1 更容易并且更适合。在 2.0 中,即使您只想绘制单个三角形,您也始终需要着色器。)
If you want to learn OpenGL ES and have a mac I suggest this book:
http://iphone-3d-programming.labs.oreilly.com/ (You can read it from the web, or buy it, I think it is worth it)
Besides the OpenGL itself it explains some of the mathematics and it shows the OpenGL ES 1.1 and 2.0 way for all examples.
(Depending of what you want to do sometimes 1.1 is much easier and suites better.. in 2.0 you always need shaders even if you only want to draw a single triangle.)
由于 Raspberry Pi 支持硬件加速 OpenGL ES 2.0,而且价格相当便宜,因此它将成为一个很好的平台,对于如果不是实际开发,则进行测试。它基本上是最后一代智能手机,没有电话功能。如果您在其上安装了 Linux 发行版(例如 Debian),您就可以开箱即用地对其进行编程。由于它是一个学习平台,因此非常适合该目的。您并不孤单,许多人都在尝试使用 Open GL ES。
Since the Raspberry Pi supports hardware accelerated OpenGL ES 2.0, and is quite inexpensive, it would make a good platform, for testing if not actual development. It's basically a last generation smartphone, without the phone bits. If you install a Linux distro on it (e.g. Debian) you are ready to program on it out of the box. Since it's a learning platform, it's well suited for the purpose. You won't be alone, many are dipping their toes into Open GL ES on it.