我应该为 android 使用 OpenGL ES 1 还是 2
我对 Android 开发和 Java 都相当陌生,我希望创建一个行为类似于谷歌天空地图的应用程序活动。我本质上想要一个自定义相机视图,我已经设置并正在工作,然后我想我想在该相机视图之上放置一个透明的表面视图,我可以在其中绘制 2D 图像文件。使用 SENSOR_ORIENTATION 我将希望透明的 SurfaceView 覆盖层四处移动。我假设我想使用 GLsurfaceview 来实现这一点,假设我能够将图像绘制到该视图上,并且只需更改传感器变化时的 GLcamera 视点。
对 Android 的 GL 不太了解,在我埋头于 Android OpenGL 之前,我想问这是否是正确的方法。我注意到在developer.android资源上有两种类型的OpenGL适用于android ES 1和ES 2。其中一种比另一种更好吗?
埃里克
I am fairly new to Android development as well as Java and i am looking to create an app activity that behaves much like google sky map. I want to essentially have a custom camera view, which i have already set up and have working and am then thinking i want to put a transparent surfaceview on top of that camera view which i can draw 2D image files to. Using the SENSOR_ORIENTATION I will want that transparent surfaceView overlay to move around. I am assuming that I will want to use a GLsurfaceview for this assuming that i will be able to draw the images to that view and just change the GLcamera view point on the sensor change.
Not knowing much about GL for android I am asking if this is the right approach before i burry myself in Android OpenGL. In that i noticed on the developer.android resources that there are two types of OpenGL for android ES 1 and ES 2. Is one better than the other for this?
Erik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用适用于 Android 的 OpenGL ES 2。 ES 1 更像是 GL 的仅 FF(固定功能)版本,您无法访问着色器或您最可能想要的其他更有趣和小众的功能。 ES 2 则完全相反,没有固定的功能管道,而是一切都是顶点和片段着色器。这样做的好处是它更现代,并且您可以使用可编程管道。我相当确定一些(较新的)Android 设备根本不支持 ES 1。或者,如果他们这样做了,它会被 ES 2 模拟,但速度要慢得多。与台式电脑不同,您可以在自己的风险下混合 GL 版本代码,而在 Android 上则不能。如果你选择ES 1,你就不能使用ES 2,如果你选择ES 2,你就不能选择ES 1。我建议你使用ES 2,这不是很难。如果您有编写 FF 代码的背景,您会发现 PP(可编程管道)的概念确实很奇怪且多余。
You should use OpenGL ES 2 for android. ES 1 is more of a FF ( fixed function ) only version of GL where you don't have access to shaders or other more interesting and niche features that you would most likely want. With ES 2 it's the complete opposite, there is no fixed function pipeline, and instead everything is vertex and fragment shaders. The benefit of this is it's more modern, and you have a programmable pipeline to work with. I'm fairly certian some (newer) android devices don't support ES 1 at all. Or if they do it's emulated by ES 2, which is a lot slower. Unlike desktop PCs where you can mix GL version code at your own peril, with android you cannot. If you choose ES 1, you can't use ES 2, if you choose ES 2 you can't choose ES 1. I'd suggest you use ES 2, it's not terribly hard. If you're coming from a background of writing FF code you'll find the concept of PP ( programmable pipeline ) realy odd and redundant.