OpenGL ES 2.0 Summary (1)-vbo and rendering __opengl

Source: Internet
Author: User
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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.