和桌面Windows的3D应用一样,移动设备也需要API的支持。在Windows的发展进程中,有两种互相竞争的API存在,那就是DirectX和OpenGL。而移动设备自从推出以来一直采用的是OpenGL API的派生产物,也就是OpenGL ES。
正如你想象的一样,OpenGL ES继承了很多OpenGL的特色,其具有开放性的优点,让开发者能够更轻松的在移动平台上创建内容,并且由于和OpenGL的很多规则相同,使得一般电脑的内容转移到移动设备上也不会很复杂。
但是OpenGL ES也必须考虑到移动平台新层面的一些问题,其中最重要的可算是内存应用和功耗问题。这使得该API需要尽可能小的占用磁盘和内存空间,同时数据总量的交换也必须保持最小化,以此来保证功耗越低越好。
OpenGL ES还需要照顾到全系列的移动设备,能够让软件渲染模式的特效在尽可能多的硬件上实现。这同时也方便了开发者,这样他们可以开发软件渲染引擎,当技术可行后无缝转移到相应的渲染特性。
OpenGL ES基本上是OpenGL 1.3子集,同时加入了一些扩展。这使得该API更加灵活,比如现在一些用不到的功能可以暂时删除,当内嵌硬件发展到一定水平后,相应的功能可以从新添加回来。
目前的OpenGL ES包含两方面基本内容,Common Profile支持全3D功能,保证游戏正常运行。Safety Critical Profile,这是商业软件设计所需要的,华丽的界面在这里不是最优先考虑,安全性成为关键,它只能提供最小化的3D功能。
OpenGL ES具体特性如下:
Geometry Processing
- Vertex Arrays
- Points, Lines, Triangles
- Matrix Stack
- Viewport, DepthRange
- Vertex Lighting
- ShadeModelRasterization
- Multisampling (optional)
- Points & anti-aliased points
- Lines & anti-aliased lines
- Polygons
- Face Culling
- PolygonOffset - fill modeTexture Mapping
- 2D Textures
- Wrap repeat, edge_clamp
- Compressed Texture
- TexSubImage, CopyTexImage
- Multitexture
- RGBA pixel and packed pixel formats, L, LA
- All FiltersFragment Processing
- Fog
- Scissor Test
- Alpha Test
- Stencil Test (optional)
- Depth Test (optional)
- Blending
- Logic Op
- DitherFramebuffer Operations/Miscellaneous
- Clear
- ReadPixels / Alpha Test / Dither
- Flush/Finish
- Hint
- Get-static state (constants)