Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/graphics/Mesh#constants) \| [Ctors](https://developer.android.com/reference/android/graphics/Mesh#pubctors) \| [Methods](https://developer.android.com/reference/android/graphics/Mesh#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/graphics/Mesh#inhmethods)

# Mesh

*** ** * ** ***

` public class Mesh `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.Mesh |

<br />

*** ** * ** ***

Class representing a mesh object. This class represents a Mesh object that can optionally be indexed. A `https://developer.android.com/reference/android/graphics/MeshSpecification` is required along with various attributes for detailing the mesh object, including a mode, vertex buffer, optional index buffer, and bounds for the mesh. Once generated, a mesh object can be drawn through `https://developer.android.com/reference/android/graphics/Canvas#drawMesh(android.graphics.Mesh,%20android.graphics.BlendMode,%20android.graphics.Paint)`

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLES` The mesh will be drawn with triangles without utilizing shared vertices. |
| `int` | `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLE_STRIP` The mesh will be drawn with triangles utilizing shared vertices. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/Mesh#Mesh(android.graphics.MeshSpecification,%20int,%20java.nio.Buffer,%20int,%20android.graphics.RectF)(https://developer.android.com/reference/android/graphics/MeshSpecification meshSpec, int mode, https://developer.android.com/reference/java/nio/Buffer vertexBuffer, int vertexCount, https://developer.android.com/reference/android/graphics/RectF bounds) ` Constructor for a non-indexed Mesh. |
| ` https://developer.android.com/reference/android/graphics/Mesh#Mesh(android.graphics.MeshSpecification,%20int,%20java.nio.Buffer,%20int,%20java.nio.ShortBuffer,%20android.graphics.RectF)(https://developer.android.com/reference/android/graphics/MeshSpecification meshSpec, int mode, https://developer.android.com/reference/java/nio/Buffer vertexBuffer, int vertexCount, https://developer.android.com/reference/java/nio/ShortBuffer indexBuffer, https://developer.android.com/reference/android/graphics/RectF bounds) ` Constructor for an indexed Mesh. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setColorUniform(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int color) ` Sets the uniform color value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setColorUniform(java.lang.String,%20long)(https://developer.android.com/reference/java/lang/String uniformName, long color) ` Sets the uniform color value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setColorUniform(java.lang.String,%20android.graphics.Color)(https://developer.android.com/reference/java/lang/String uniformName, https://developer.android.com/reference/android/graphics/Color color) ` Sets the uniform color value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setFloatUniform(java.lang.String,%20float[])(https://developer.android.com/reference/java/lang/String uniformName, float[] values) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setFloatUniform(java.lang.String,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setFloatUniform(java.lang.String,%20float,%20float,%20float,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value1, float value2, float value3, float value4) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setFloatUniform(java.lang.String,%20float,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value1, float value2) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setFloatUniform(java.lang.String,%20float,%20float,%20float)(https://developer.android.com/reference/java/lang/String uniformName, float value1, float value2, float value3) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setIntUniform(java.lang.String,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setIntUniform(java.lang.String,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value1, int value2, int value3) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setIntUniform(java.lang.String,%20int,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value1, int value2, int value3, int value4) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setIntUniform(java.lang.String,%20int[])(https://developer.android.com/reference/java/lang/String uniformName, int[] values) ` Sets the uniform value corresponding to the shader assigned to the mesh. |
| ` void` | ` https://developer.android.com/reference/android/graphics/Mesh#setIntUniform(java.lang.String,%20int,%20int)(https://developer.android.com/reference/java/lang/String uniformName, int value1, int value2) ` Sets the uniform value corresponding to the shader assigned to the mesh. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### TRIANGLES

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TRIANGLES
```

The mesh will be drawn with triangles without utilizing shared vertices.

<br />

Constant Value: 0 (0x00000000)

### TRIANGLE_STRIP

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int TRIANGLE_STRIP
```

The mesh will be drawn with triangles utilizing shared vertices.

<br />

Constant Value: 1 (0x00000001)

## Public constructors

### Mesh

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Mesh (MeshSpecification meshSpec, 
                int mode, 
                Buffer vertexBuffer, 
                int vertexCount, 
                RectF bounds)
```

Constructor for a non-indexed Mesh.

<br />

| Parameters ||
|---|---|
| `meshSpec` | `MeshSpecification`: `https://developer.android.com/reference/android/graphics/MeshSpecification` used when generating the mesh. This value cannot be `null`. <br /> |
| `mode` | `int`: Determines what mode to draw the mesh in. Must be one of `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLES` or `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLE_STRIP` Value is one of the following: - `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLES` - `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLE_STRIP` |
| `vertexBuffer` | `Buffer`: vertex buffer representing through `https://developer.android.com/reference/java/nio/Buffer`. This provides the data for all attributes provided within the meshSpec for every vertex. That is, a vertex buffer should be (attributes size \* number of vertices) in length to be valid. Note that currently implementation will have a CPU backed buffer generated. This value cannot be `null`. <br /> |
| `vertexCount` | `int`: the number of vertices represented in the vertexBuffer and mesh. <br /> |
| `bounds` | `RectF`: bounds of the mesh object. This value cannot be `null`. <br /> |

### Mesh

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Mesh (MeshSpecification meshSpec, 
                int mode, 
                Buffer vertexBuffer, 
                int vertexCount, 
                ShortBuffer indexBuffer, 
                RectF bounds)
```

Constructor for an indexed Mesh.

<br />

| Parameters ||
|---|---|
| `meshSpec` | `MeshSpecification`: `https://developer.android.com/reference/android/graphics/MeshSpecification` used when generating the mesh. This value cannot be `null`. <br /> |
| `mode` | `int`: Determines what mode to draw the mesh in. Must be one of `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLES` or `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLE_STRIP` Value is one of the following: - `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLES` - `https://developer.android.com/reference/android/graphics/Mesh#TRIANGLE_STRIP` |
| `vertexBuffer` | `Buffer`: vertex buffer representing through `https://developer.android.com/reference/java/nio/Buffer`. This provides the data for all attributes provided within the meshSpec for every vertex. That is, a vertex buffer should be (attributes size \* number of vertices) in length to be valid. Note that currently implementation will have a CPU backed buffer generated. This value cannot be `null`. <br /> |
| `vertexCount` | `int`: the number of vertices represented in the vertexBuffer and mesh. <br /> |
| `indexBuffer` | `ShortBuffer`: index buffer representing through `https://developer.android.com/reference/java/nio/ShortBuffer`. Indices are required to be 16 bits, so ShortBuffer is necessary. Note that currently implementation will have a CPU backed buffer generated. This value cannot be `null`. <br /> |
| `bounds` | `RectF`: bounds of the mesh object. This value cannot be `null`. <br /> |

## Public methods

### setColorUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setColorUniform (String uniformName, 
                int color)
```

Sets the uniform color value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than vec3 or vec4 and corresponding layout(color) annotation then an IllegalArgumentExcepton is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the color uniform declared in the shader program. This value cannot be `null`. <br /> |
| `color` | `int`: the provided sRGB color will be converted into the shader program's output colorspace and be available as a vec4 uniform in the program. <br /> |

### setColorUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setColorUniform (String uniformName, 
                long color)
```

Sets the uniform color value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than vec3 or vec4 and corresponding layout(color) annotation then an IllegalArgumentExcepton is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the color uniform declared in the shader program. This value cannot be `null`. <br /> |
| `color` | `long`: the provided sRGB color will be converted into the shader program's output colorspace and be available as a vec4 uniform in the program. <br /> |

### setColorUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setColorUniform (String uniformName, 
                Color color)
```

Sets the uniform color value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than vec3 or vec4 and corresponding layout(color) annotation then an IllegalArgumentExcepton is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the color uniform declared in the shader program. This value cannot be `null`. <br /> |
| `color` | `Color`: the provided sRGB color will be converted into the shader program's output colorspace and will be made available as a vec4 uniform in the program. This value cannot be `null`. <br /> |

### setFloatUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setFloatUniform (String uniformName, 
                float[] values)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than a float (for N=1), vecN, or float\[N\], where N is the length of the values param, then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the float uniform declared in the shader program. This value cannot be `null`. <br /> |
| `values` | `float`: float value corresponding to the vec4 float uniform with the given name. This value cannot be `null`. <br /> |

### setFloatUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setFloatUniform (String uniformName, 
                float value)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than a float or float\[1\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the float uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value` | `float`: float value corresponding to the float uniform with the given name. <br /> |

### setFloatUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setFloatUniform (String uniformName, 
                float value1, 
                float value2, 
                float value3, 
                float value4)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than a vec4 or float\[4\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the float uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value1` | `float`: first float value corresponding to the float uniform with the given name. <br /> |
| `value2` | `float`: second float value corresponding to the float uniform with the given name. <br /> |
| `value3` | `float`: third float value corresponding to the float uniform with the given name. <br /> |
| `value4` | `float`: fourth float value corresponding to the float uniform with the given name. <br /> |

### setFloatUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setFloatUniform (String uniformName, 
                float value1, 
                float value2)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than a vec2 or float\[2\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the float uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value1` | `float`: first float value corresponding to the float uniform with the given name. <br /> |
| `value2` | `float`: second float value corresponding to the float uniform with the given name. <br /> |

### setFloatUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setFloatUniform (String uniformName, 
                float value1, 
                float value2, 
                float value3)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than a vec3 or float\[3\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the float uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value1` | `float`: first float value corresponding to the float uniform with the given name. <br /> |
| `value2` | `float`: second float value corresponding to the float uniform with the given name. <br /> |
| `value3` | `float`: third float value corresponding to the float unifiform with the given name. <br /> |

### setIntUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setIntUniform (String uniformName, 
                int value)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than int or int\[1\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the int uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value` | `int`: value corresponding to the int uniform with the given name. <br /> |

### setIntUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setIntUniform (String uniformName, 
                int value1, 
                int value2, 
                int value3)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than ivec3 or int\[3\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the int uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value1` | `int`: first value corresponding to the int uniform with the given name. <br /> |
| `value2` | `int`: second value corresponding to the int uniform with the given name. <br /> |
| `value3` | `int`: third value corresponding to the int uniform with the given name. <br /> |

### setIntUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setIntUniform (String uniformName, 
                int value1, 
                int value2, 
                int value3, 
                int value4)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than ivec4 or int\[4\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the int uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value1` | `int`: first value corresponding to the int uniform with the given name. <br /> |
| `value2` | `int`: second value corresponding to the int uniform with the given name. <br /> |
| `value3` | `int`: third value corresponding to the int uniform with the given name. <br /> |
| `value4` | `int`: fourth value corresponding to the int uniform with the given name. <br /> |

### setIntUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setIntUniform (String uniformName, 
                int[] values)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than an int (for N=1), ivecN, or int\[N\], where N is the length of the values param, then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the int uniform declared in the shader program. This value cannot be `null`. <br /> |
| `values` | `int`: int values corresponding to the vec4 int uniform with the given name. This value cannot be `null`. <br /> |

### setIntUniform

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setIntUniform (String uniformName, 
                int value1, 
                int value2)
```

Sets the uniform value corresponding to the shader assigned to the mesh. If the shader does not have a uniform with that name or if the uniform is declared with a type other than ivec2 or int\[2\] then an IllegalArgumentException is thrown.

<br />

| Parameters ||
|---|---|
| `uniformName` | `String`: name matching the int uniform declared in the shader program. This value cannot be `null`. <br /> |
| `value1` | `int`: first value corresponding to the int uniform with the given name. <br /> |
| `value2` | `int`: second value corresponding to the int uniform with the given name. <br /> |