Android 3D Game Study Notes (2)-Rendering Method

Source: Internet
Author: User

Small man (Bill man) Personal Original, welcome to reprint, reprint please indicate the address, small man (Bill man) column address http://blog.csdn.net/bill_man

The last time I talked about the triangle draw mode, there are other ways to draw the triangle, which will be described in this article.

1. gl_points

As the name suggests, it is a separate drawing point. The Nth point in the index draws the point N.

2. gl_lines

That is, two adjacent points (2N points and 2n + 1 points) are connected in groups. If the number of points is the base, the last point is ignored, for example) it is an index, with 0 and 1 digits in one group, and 2 and 3 digits in one group.

3. gl_line_strif

Connect two adjacent vertices. Different from the above, the N vertex is connected to the n + 1 vertex. For example, (,) is an index, and the 0 vertex is connected to 1 vertex, connect 1 to 2, and connect 2 to 3.

4. gl_line_loop

Connect two adjacent vertices. The same as above, the difference is that the last vertex must be connected to 0th. For example, (,) is an index and 0 is connected to 1, 1 to 2 connections, 2 to 3 connections, and 3 to 0 connections.

5. gl_triangles

3n, 3N + 1, and 3N + 2 vertices form a triangle, and the remainder vertex left is ignored. For example, (,) is an index, and 1, 2, and 3 constitute a triangle, 4, 5, and 6 form a triangle.

6. gl_triangles_strif

Connect two adjacent vertices into a triangle. Different from the preceding vertex, the nth vertex is connected to the nth vertex, for example (,) as the index, A triangle consists of 0, 1 and 2, and a triangle consists of 1 and 2 and 3.

7. gl_triangles_fan

A triangle consists of 0th vertices and the following vertices. For example, (,) is an index. A triangle consists of 0 and 2 and 3.

There are two ways to draw, respectively the index method and the vertex Method

1. the indexing method first defines the index buffer when drawing. The first parameter of gldrawelements is the fill type, the second parameter is the number of vertices, and the third parameter is the data cache type, here is the byte type, and the last parameter is the data cache parameter.

2. the vertex method does not need to define the index buffer. The first parameter of gldrawelements is the fill type, the index starts when the second parameter is used, and the third parameter is the number of vertices.

Refer to the detailed explanation and typical cases of Android 3D Game Development Technology. If there are any errors, I hope you can correct them more.

Next article: Projection

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.