Introduction 2
Opengl_es is customized by the khronos Association from OpenGL cropping. It is designed for embedded devices such as mobile phones and game consoles. Designed for devices. Its interface is actually very similar to Open GL. Opengl_es has several major versions, but for game development, there are only two to be concerned: Opengl_es_1.x _ and opengl_es_2.x. The features and main differences between the two are as follows: Opengl_es_1.x Designed for Fixed rendering pipelines (fixed_function. Sub-versions include: 1.0 and 1.1. 1.0 cut from opengl_1.3; 1.1 from Opengl_1.5 is removed. 1.1 downward compatible with 1.0. After research, because 1.1 is more advanced and more useful than 1.0, it is basically not worth considering 1.0. The 1.1 and 1.0 changes are not very big. Should the chip price be much higher? For technical specifications of 1.1, see es_full_spec.1.1.12.pdf or Es_cm_spec_1.1.12.pdf. Opengl_es_2.x is designed for the programmable rendering pipeline (Programmable. Only 2.0 The sub-version is removed from opengl_2.0. The difference from 1.x is that vertex and pixel are supported. Shader, so it can implement more special effects. In addition, 2.0 does not support the fixed Pipeline Function in 1.x. So 2.x is not backward compatible with 1.x. For technical specifications, see es_full_spec_2.0.22.pdf. Or: es_cm_spec_2.0.22.pdf. Compared with OpenGL, OpenGL ES reduces all the low-performance operations, and ensures high performance. That is, performance is not compatible. For example
- There is no double data type, but a high-performance fixed point decimal data type is added;
- No glbegin/glend/glvertex, you can only use gldrawarrays/gldraw ......;
- There is no function to convert non-compressed image data into a compressed texture in real time, and the program must provide Compression
;
Differences between OpenGL ES and OpenGL 3
Data Type:
- I glint Integer type
- F glfixed decimal point
- X glclampx fixed-point decimal number
Delete:
- Glbegin/glend
- Glarrayelement
- Display list
- Calculator
- Index color mode
- Custom cropping plane
- Glrect
- Image Processing (this is not a general graphics card, either firegl or Quadro)
- Feedback Buffer
- SELECT Buffer
- Cumulative Buffer
- Border flag
- Glpolygonmode
- Gl_quads, gl_quad_strip, gl_polygon
- Glpushattrib, glpopattrib, glpushclientattrib, glpopclientattrib
- Texture_1d, texture_3d, texture_rect, texture_cube_map
- Gl_combine
- Automatic texture coordinate generation
- Texture Boundary
- Gl_clamp, gl_clamp_to_border
- Deprecated texture Representation
- Texture levels
- Texture preferences
- Automatic texture compression and decompression
- Gldrawpixels, glpixeltransfer, glpixelzoom
- Glreadbuffer, gldrawbuffer, glcopypixels
Other considerations:
- Data in functions such as gldrawarrays must be closely arranged, that is, the interval is 0.
- Stack depth of various data is low
OpenGL Based Graphics : A State machine4
It's a state machine-setup the stage, lighting, actors... then draw It. Sample OpenGL ES 2.0 program as following: // Setup
Handle = get_platform_specific_window_handle(); eglGetDisplay (handle); eglInitialize (); eglBindAPI (EGL_OPENGL_ES_API); eglChooseConfig (); eglCreateWindowSurface (); eglCreateContex (); eglMakeCurrent ();
//Actors
float afVertices [] = {...}; glEnableVertexAttribArray (0); glVertexAttribPointer (VERTEX_ARRAY, GL_FLOAT, GL_FALSE, afVertices); glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
//Show eglSwapBuffers (eglDisplay, eglSurface);
OpenGL ES 2.0, OpenGL ES 1.1 and full function4
- Es2.0 offers programmable pipeline vs fixed function in es1.1
- Ex, lighting, fog functions in es1.1 not present in es2.0, so need to write code to generate these effects.
- More flexibility, little more work, but lot of available code
- Android
Uses es1.1
- Es2.0 not backward compatible with es1.1
- See companion paper for definitive comparison of available functions in es1.1 and es2.0.
- See "difference specification" Events in khronos OpenGL website,
For summary of changes compared to OpenGL "full" Function Specification
Introduction to OpenGL ES 2.xOpenGL ES 2.0 is very different thank es 1.1. You don't have Fixed-function pipeline anymore, so your faimilar "Push matrix, Translate, rotate ", etc are all gone. Instead you have the concept of shaders: vertex and frament. They're Little programs that get executed for each vertex and each pixel. That's Where all the transformation and other effects happen. Your code will Prepare the vertex data, tell OpenGL how it's structured, and hand it Over to the shaders. How to get started
- Reading
- OpenGL ES 2.0 programming guide
- A brief shader tutorial
- Write several shader programmers and recommend an online shader toy:
- Http://www.iquilezles.org/apps/shadertoy/
How to port the application from OpenGL ES 1.1 to OpenGL ES 2.05
You can translate easily:
- Textures Management
- Framebuffer objects
- Blending
More difficult (need shaders ):
- Fixed pipeline transformations (rotation, scale ...)
- Fog
- Lighting
To port your code, I recommand you:
- Learn glsl 1.2: You can read webgl tutorials try to write some shaders in shader toy.
- List all material you have (or rendering TechCrunch); list all vertices
Informations as vertices coordinates, normal, textures coord, color Informations you need for each material. With theses informations, you Will know which glsl programs (vertex + fragment shaders) You must Write.
- Write your shader compil functions and log each informations;
Implement a minimal program OpenGL ES 2.x with a quad (two triangles ); Implement and test your glsl programs one by one.
- Optimize
Reference
- Official Website
- OpenGL ES Overview
- Differences between OpenGL and OpenGL ES
- OpenGL ES based UI development on Ti platforms
- Port 3D app from OpenGL es1.x to OpenGL ES 2.x
|