# GLU

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

# GLU

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/opengl/GLU "View this page in Kotlin") \|Java


`
public


class
GLU
`


`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


`

`


`

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

<br />

*** ** * ** ***

A set of GL utilities inspired by the OpenGL Utility Toolkit.

## Summary

|                              ### Public constructors                               ||
|---------------------------------------------------------------------------------|---|
| ` `[GLU](https://developer.android.com/reference/android/opengl/GLU#GLU())`() ` |

|                                                                                                                                                                                                                                                                                               ### Public methods                                                                                                                                                                                                                                                                                                ||
|------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[String](https://developer.android.com/reference/java/lang/String) | ` `[gluErrorString](https://developer.android.com/reference/android/opengl/GLU#gluErrorString(int))`(int error) ` Return an error string from a GL or GLU error code.                                                                                                                                                                                                                                                                                                                                                             |
| ` static void`                                                               | ` `[gluLookAt](https://developer.android.com/reference/android/opengl/GLU#gluLookAt(javax.microedition.khronos.opengles.GL10,%20float,%20float,%20float,%20float,%20float,%20float,%20float,%20float,%20float))`(`[GL10](https://developer.android.com/reference/javax/microedition/khronos/opengles/GL10)` gl, float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) ` Define a viewing transformation in terms of an eye point, a center of view, and an up vector. |
| ` static void`                                                               | ` `[gluOrtho2D](https://developer.android.com/reference/android/opengl/GLU#gluOrtho2D(javax.microedition.khronos.opengles.GL10,%20float,%20float,%20float,%20float))`(`[GL10](https://developer.android.com/reference/javax/microedition/khronos/opengles/GL10)` gl, float left, float right, float bottom, float top) ` Set up a 2D orthographic projection matrix                                                                                                                                                               |
| ` static void`                                                               | ` `[gluPerspective](https://developer.android.com/reference/android/opengl/GLU#gluPerspective(javax.microedition.khronos.opengles.GL10,%20float,%20float,%20float,%20float))`(`[GL10](https://developer.android.com/reference/javax/microedition/khronos/opengles/GL10)` gl, float fovy, float aspect, float zNear, float zFar) ` Set up a perspective projection matrix                                                                                                                                                          |
| ` static int`                                                                | ` `[gluProject](https://developer.android.com/reference/android/opengl/GLU#gluProject(float,%20float,%20float,%20float[],%20int,%20float[],%20int,%20int[],%20int,%20float[],%20int))`(float objX, float objY, float objZ, float[] model, int modelOffset, float[] project, int projectOffset, int[] view, int viewOffset, float[] win, int winOffset) ` Map object coordinates into window coordinates.                                                                                                                          |
| ` static int`                                                                | ` `[gluUnProject](https://developer.android.com/reference/android/opengl/GLU#gluUnProject(float,%20float,%20float,%20float[],%20int,%20float[],%20int,%20int[],%20int,%20float[],%20int))`(float winX, float winY, float winZ, float[] model, int modelOffset, float[] project, int projectOffset, int[] view, int viewOffset, float[] obj, int objOffset) ` Map window coordinates to object coordinates.                                                                                                                        |

| ### Inherited methods |
|-----------------------|---|
| From class ` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                        | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                             | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`.                                                                                                                                                 | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                   | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                              | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                           | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                              | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Public constructors

### GLU

```
public GLU ()
```

<br />

<br />

## Public methods

### gluErrorString

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

```
public static String gluErrorString (int error)
```

Return an error string from a GL or GLU error code.

<br />

|                    Parameters                    ||
|---------|-----------------------------------------|
| `error` | `int`: - a GL or GLU error code. <br /> |

|                                                                                     Returns                                                                                      ||
|--------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the error string for the input error code, or NULL if the input was not a valid GL or GLU error code. <br /> |

### gluLookAt

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

```
public static void gluLookAt (GL10 gl, 
                float eyeX, 
                float eyeY, 
                float eyeZ, 
                float centerX, 
                float centerY, 
                float centerZ, 
                float upX, 
                float upY, 
                float upZ)
```

Define a viewing transformation in terms of an eye point, a center of
view, and an up vector.

<br />

|                 Parameters                  ||
|-----------|----------------------------------|
| `gl`      | `GL10`: a GL10 interface <br />  |
| `eyeX`    | `float`: eye point X <br />      |
| `eyeY`    | `float`: eye point Y <br />      |
| `eyeZ`    | `float`: eye point Z <br />      |
| `centerX` | `float`: center of view X <br /> |
| `centerY` | `float`: center of view Y <br /> |
| `centerZ` | `float`: center of view Z <br /> |
| `upX`     | `float`: up vector X <br />      |
| `upY`     | `float`: up vector Y <br />      |
| `upZ`     | `float`: up vector Z <br />      |

### gluOrtho2D

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

```
public static void gluOrtho2D (GL10 gl, 
                float left, 
                float right, 
                float bottom, 
                float top)
```

Set up a 2D orthographic projection matrix

<br />

### gluPerspective

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

```
public static void gluPerspective (GL10 gl, 
                float fovy, 
                float aspect, 
                float zNear, 
                float zFar)
```

Set up a perspective projection matrix

<br />

|                                                                              Parameters                                                                              ||
|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `gl`     | `GL10`: a GL10 interface <br />                                                                                                                            |
| `fovy`   | `float`: specifies the field of view angle, in degrees, in the Y direction. <br />                                                                         |
| `aspect` | `float`: specifies the aspect ration that determins the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height). <br /> |
| `zNear`  | `float`: specifies the distance from the viewer to the near clipping plane (always positive). <br />                                                       |
| `zFar`   | `float`: specifies the distance from the viewer to the far clipping plane (always positive). <br />                                                        |

### gluProject

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

```
public static int gluProject (float objX, 
                float objY, 
                float objZ, 
                float[] model, 
                int modelOffset, 
                float[] project, 
                int projectOffset, 
                int[] view, 
                int viewOffset, 
                float[] win, 
                int winOffset)
```

Map object coordinates into window coordinates. gluProject transforms the
specified object coordinates into window coordinates using model, proj,
and view. The result is stored in win.


Note that you can use the OES_matrix_get extension, if present, to get
the current modelView and projection matrices.

<br />

|                                                      Parameters                                                      ||
|-----------------|-----------------------------------------------------------------------------------------------------|
| `objX`          | `float`: object coordinates X <br />                                                                |
| `objY`          | `float`: object coordinates Y <br />                                                                |
| `objZ`          | `float`: object coordinates Z <br />                                                                |
| `model`         | `float`: the current modelview matrix <br />                                                        |
| `modelOffset`   | `int`: the offset into the model array where the modelview maxtrix data starts. <br />              |
| `project`       | `float`: the current projection matrix <br />                                                       |
| `projectOffset` | `int`: the offset into the project array where the project matrix data starts. <br />               |
| `view`          | `int`: the current view, {x, y, width, height} <br />                                               |
| `viewOffset`    | `int`: the offset into the view array where the view vector data starts. <br />                     |
| `win`           | `float`: the output vector {winX, winY, winZ}, that returns the computed window coordinates. <br /> |
| `winOffset`     | `int`: the offset into the win array where the win vector data starts. <br />                       |

|                                                 Returns                                                  ||
|-------|---------------------------------------------------------------------------------------------------|
| `int` | A return value of GL_TRUE indicates success, a return value of GL_FALSE indicates failure. <br /> |

### gluUnProject

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

```
public static int gluUnProject (float winX, 
                float winY, 
                float winZ, 
                float[] model, 
                int modelOffset, 
                float[] project, 
                int projectOffset, 
                int[] view, 
                int viewOffset, 
                float[] obj, 
                int objOffset)
```

Map window coordinates to object coordinates. gluUnProject maps the
specified window coordinates into object coordinates using model, proj,
and view. The result is stored in obj.


Note that you can use the OES_matrix_get extension, if present, to get
the current modelView and projection matrices.

<br />

|                                                               Parameters                                                               ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------|
| `winX`          | `float`: window coordinates X <br />                                                                                  |
| `winY`          | `float`: window coordinates Y <br />                                                                                  |
| `winZ`          | `float`: window coordinates Z <br />                                                                                  |
| `model`         | `float`: the current modelview matrix <br />                                                                          |
| `modelOffset`   | `int`: the offset into the model array where the modelview maxtrix data starts. <br />                                |
| `project`       | `float`: the current projection matrix <br />                                                                         |
| `projectOffset` | `int`: the offset into the project array where the project matrix data starts. <br />                                 |
| `view`          | `int`: the current view, {x, y, width, height} <br />                                                                 |
| `viewOffset`    | `int`: the offset into the view array where the view vector data starts. <br />                                       |
| `obj`           | `float`: the output vector {objX, objY, objZ, objW}, that returns the computed homogeneous object coordinates. <br /> |
| `objOffset`     | `int`: the offset into the obj array where the obj vector data starts. <br />                                         |

|                                                      Returns                                                       ||
|-------|-------------------------------------------------------------------------------------------------------------|
| `int` | A return value of GL10.GL_TRUE indicates success, a return value of GL10.GL_FALSE indicates failure. <br /> |