# Class Mesh

java.lang.Object
com.codename1.gpu.Mesh

public final class Mesh extends Object
Renderable geometry: a `VertexBuffer`, an optional `IndexBuffer` and the `PrimitiveType` that ties the vertices into shapes. A mesh carries no material; the same mesh can be drawn with different materials through `GraphicsDevice.draw(Mesh, Material, float[])`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Mesh(VertexBuffer vertices, IndexBuffer indices, PrimitiveType primitiveType)`
  Creates an indexed mesh.
  `Mesh(VertexBuffer vertices, PrimitiveType primitiveType)`
  Creates a non indexed mesh.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `IndexBuffer`
  `getIndices()`
  Returns the index buffer, or null for a non indexed mesh.
  `PrimitiveType`
  `getPrimitiveType()`
  Returns the primitive assembly type.
  `VertexBuffer`
  `getVertices()`
  Returns the vertex buffer.
  `boolean`
  `isIndexed()`
  Returns true if this mesh is drawn with an index buffer.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Mesh

    public Mesh(VertexBuffer vertices, PrimitiveType primitiveType)

    Creates a non indexed mesh.

    ###### Parameters

    - `vertices`: the vertex data

    - `primitiveType`: how the vertices are assembled into primitives

  - ### Mesh

    public Mesh(VertexBuffer vertices, IndexBuffer indices, PrimitiveType primitiveType)

    Creates an indexed mesh.

    ###### Parameters

    - `vertices`: the vertex data

    - `indices`: the element indices, or null for a non indexed mesh

    - `primitiveType`: how the vertices are assembled into primitives

- ## Method Details

  - ### getVertices

    public VertexBuffer getVertices()
    Returns the vertex buffer.

  - ### getIndices

    public IndexBuffer getIndices()
    Returns the index buffer, or null for a non indexed mesh.

  - ### isIndexed

    public boolean isIndexed()
    Returns true if this mesh is drawn with an index buffer.

  - ### getPrimitiveType

    public PrimitiveType getPrimitiveType()
    Returns the primitive assembly type.