OpenGL ES 2.0 VBO and rendering
1.VBO Initialization1) glgenbuffers () generates Bufferid 2) Glbindbuffer () operates it, the parameter is Vbo Bufferid 3) glbufferdata () specifies the data and usage inside
When you want to use this VBO then Glbindbuffer () its bufferid, which generally put vertex data (including the model of XYZ and texture coordinates UV), in addition to the premise is already compiled and set up the shader program 2. Using VBO rendering 1) Glenablevertexattribarray () enable the amount of vertex-related shader
Need to get to its handle beforehand,
Like what
Mapositionhandle = Gles20.glgetattriblocation (Mprogram, "aposition"); 2) Glbindbuffer () the VBO that the operation wants to use, the parameter is Vbo Bufferid 3) glvertexattribpointer () specify how to use the data in Vbo there may be more than one glvertexattribpointer ( , its last parameter is the offset of each element when it is used, for example, the vertex is the float vertex of the xyzuv, and each 4*5 byte repeats, then the value of the last parameter is 0 and 12, respectively, when the XYZ coordinates and the texture coordinates are specified separately.
In addition, finally, when VBO is not available, the last parameter can directly specify the buffer 4 to render () gldrawarrays () specify the drawing (usually gl_triangles, that is, the triangle), the number, and so on, you can use VBO to draw 5) gldrawelements () This is another way to draw a graph by specifying a vertex index
When rendering using this method, you should generate two VBO buffer, one to hold the vertex information, the other to hold the index information, and the normal vertex VBO difference is that the VBO that holds the vertex should use the Gl_element_array_buffer when using and specifying the data, Use Gldrawelements () again. For example
Glbindbuffer (Gl_element_array_buffer, mbufferhandle[1]);
Glbufferdata (Gl_element_array_buffer,count,buffer,gl_static_draw);
Gldrawelements (gl_triangles,count,gl_unsigned_short, 0);
reference [OpenGL ES 06] using VBO: Vertex caching
http://blog.csdn.net/kesalin/article/details/8351935
Gles Official documents
https://www.khronos.org/opengles/sdk/docs/man/