Android OpenGL ES 3D space and glDrawArrays

Source: Internet
Author: User

1. Four pyramid: composed of four triangles. Ry: consists of six triangles. Difficulty: when constructing the vertex coordinates of a 3D space, to make the object rotate around its own axis, the central coordinates of the object must always be (0.0f, 0.0f, 0.0f ), and the triangles are drawn in a counter-clockwise order. 2.3D space painting: GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); parameter description: mode, drawing method. The following parameters are provided after OpenGL2.0: GL_POINTS, GL_LINES, GL_LINE_LOOP, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP, and GL_TRIANGLE_FAN. First, which position in the array cache is drawn, generally 0. Count, number of vertices in the array. 3. draw the vertex array: // draw the triangle cone for (int I = 0; I <4; I ++) {gl. glDrawArrays (GL10.GL _ TRIANGLE_STRIP, I * 3, 3);} // draw a ry for (int I = 0; I <6; I ++) {gl. glDrawArrays (GL10.GL _ TRIANGLE_STRIP, I * 4, 4);} [appendix] Build a vertex array: [java] int one = 0x10000; // an array of four pyramid vertices: private IntBuffer triggerBuffer = IntBuffer. wrap (new int [] {0, one, 0,-one,-one, 0, one,-one, one, 0, one,-one, one, one,-one,-one, 0, one, 0, one,-one, 0, one, 0, -one, one}); // an array of Four-body vertices: private IntBuffer quaterBuffer = IntBuffer. wrap (new int [] {one, one,-one,-one, one,-one, one,-one,-one, one,-one, one,-one, one,-one,-one, one,-one, -one, one,-one, one, one,-one, one,-one, one ,});

Related Article

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.