# Geometry

I2Djs provides a way to define custom geometry using a set of inbuilt geometry APIs. Geometries are used along with custom shader to create out of the box effects.

I2Djs provides APIs for **Mesh**, **line,** and **points** geometry.

### Mesh Geometry:

Used for rendering mesh geometrical polygons. Default drawType is '**TRIANGLES**'. Possible values are '**TRIANGLES**' , '**TRIANGLE\_STRIP**' and '**TRIANGLE\_FAN**'.

```
meshInstance = new MeshGeometry();
```

Example of Mesh Geometry:

```
meshInstance = new MeshGeometry();

geometry.setAttr('a_position', {
		value: new Float32Array([]),
		size: 2
	});
	
geometry.setDrawRange(0, 6);
```

### Line Geometry:

Used for rendering Line geometrical entities like lines, polylines. Default drayType is '**LINE**'. Possible values are '**LINE**', '**LINE\_STRIP**' and '**LINE\_LOOP**'.

```
lineInstance = new LineGeometry();
```

Example of Line Geometry :

```
lineInstance = new LineGeometry();

geometry.setAttr('a_position', {
		value: new Float32Array([]),
		size: 2
	});
	
geometry.setDrawRange(0, 6);
```

### Points Geometry:

Used in rendering points. Default drawType is '**POINT**'.

```
geometry = new PointsGeometry();
```

Example of Points Geometry :

```
geometry = new PointsGeometry();
geometry.setAttr('a_color', {
		value: new Float32Array([255,255,255,255]),
		size: 4
	});
geometry.setAttr('a_size', {
		value: new Float32Array([10]),
		size: 1
	});
geometry.setAttr('a_position', {
		value: new Float32Array([30,40]),
		size: 2
	});
```

*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nswamy14.gitbook.io/i2djs-v5/api-reference/webgl-api/geometry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
