GM: Primitive types

From GMpedia.org Wiki

Jump to: navigation, search

Primitive types are the same in 2D and 3D primitives. Because of this, in the examples i have just written vertex 1, vertex 2 etc. The examples are in the format:

"vertex number - result from adding this vertex"

Contents

[edit] pr_pointlist

The vertices are a set of points. This means that each vertex will be a single pixel.

[edit] Example

vertex 1 - a point
vertex 2 - a point
vertex 3 - a point

[edit] pr_linelist

The vertices are a set of line segments. Each pair of vertices forms a line segment. So there must be an even set of vertices.

[edit] Example

vertex 1
vertex 2 - a line between this vertex and the previous one
vertex 3
vertex 4 - a line between this vertex and the previous one

[edit] pr_linestrip

The vertices form a polyline with the first connected to the second, the second to the third, etc. The last one is not connected to the first one. You have to specify an extra copy of the first vertex for this.

[edit] Example

vertex 1
vertex 2 - a line between this vertex and the previous one
vertex 3 - a line between this vertex and the previous one
vertex 4 - a line between this vertex and the previous one

[edit] pr_trianglelist

The vertices are a set of triangles. Each triple of vertices forms a triangle. So the number of vertices must be a multiple of 3.

[edit] Example

vertex 1
vertex 2
vertex 3 - a triangle formed with this vertex and the 2 previous ones
vertex 4
vertex 5
vertex 6 - a triangle formed with this vertex and the 2 previous ones

[edit] pr_trianglestrip

The vertices again form triangles but this time it works slightly different. The first three form the first triangle. The last two of these vertices, together with the next vertex, form the second triangle, etc. So each new vertex specifies a new triangle, connected to the previous one.

[edit] Example

vertex 1
vertex 2
vertex 3 - a triangle formed with this vertex and the 2 previous ones
vertex 4 - a triangle formed with this vertex and the 2 previous ones
vertex 5 - a triangle formed with this vertex and the 2 previous ones

[edit] pr_trianglefan

Similar to a triangle list but this time the first vertex is part of all the triangles. Again, each new vertex specifies a new triangle, connected to the previous vertex and the first vertex.

[edit] Example

vertex 1
vertex 2
vertex 3 - a triangle formed with this vertex, the previous one and the first one
vertex 4 - a triangle formed with this vertex, the previous one and the first one
vertex 5 - a triangle formed with this vertex, the previous one and the first one
This article was originally found at the Game Maker Knowledge Base, contributed by nickydude.
See the talk page for details
Personal tools