OpenGL / GLU
viewport
Viewport matrix
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
int
|
X origin (pixels) of the viewport (lower left) |
required |
y |
int
|
Y origin (pixels) of the viewport (lower left) |
required |
h |
int
|
Height (pixels) of the viewport |
required |
w |
int
|
Width (pixels) of the viewport |
required |
d |
float
|
Depth of the viewport. |
required |
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Viewport matrix |
Source code in glm/glm.py
frustum
View frustum matrix
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left |
float
|
Left coordinate of the field of view. |
required |
right |
float
|
Right coordinate of the field of view. |
required |
bottom |
float
|
Bottom coordinate of the field of view. |
required |
top |
float
|
Top coordinate of the field of view. |
required |
znear |
float
|
Near coordinate of the field of view. |
required |
zfar |
float
|
Far coordinate of the field of view. |
required |
dtype |
numpy dtype
|
dtype of the resulting array |
np.float32
|
transpose |
boolean
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
View frustum matrix |
Source code in glm/glm.py
ortho
Create orthographic projection matrix
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left |
float
|
Left coordinate of the field of view. |
required |
right |
float
|
Right coordinate of the field of view. |
required |
bottom |
float
|
Bottom coordinate of the field of view. |
required |
top |
float
|
Top coordinate of the field of view. |
required |
znear |
float
|
Near coordinate of the field of view. |
required |
zfar |
float
|
Far coordinate of the field of view. |
required |
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
boolean
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Orthographic projection matrix |
Source code in glm/glm.py
perspective
Perspective projection matrix
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fovy |
float
|
The field of view along the y axis. |
required |
aspect |
float
|
Aspect ratio of the view. |
required |
znear |
float
|
Near coordinate of the field of view. |
required |
zfar |
float
|
Far coordinate of the field of view. |
required |
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Perspective projection matrix |
Source code in glm/glm.py
lookat
Creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an up vector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
eye |
vec3
|
Eye point |
(0, 0, 4.5)
|
center |
vec3
|
Reference point |
(0, 0, 0)
|
up |
vec3
|
Up vector |
(0, 0, 1)
|
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
boolean
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
View matrix |
Source code in glm/glm.py
scale
Non-uniform scaling along the x, y, and z axes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale |
vec3
|
Scaling vector |
required |
dtype |
np dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Scaling matrix |
Source code in glm/glm.py
fit
Fit vertices to the normalized cube
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vertices |
np.array
|
Vertices to fit |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
vertices contained in the normalize cube |
Source code in glm/glm.py
translate
Translation by a given vector
Parameters:
Name | Type | Description | Default |
---|---|---|---|
translate |
vec3
|
Translation vector. |
required |
dtype |
np dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Translation matrix |
Source code in glm/glm.py
center
Center vertices around the origin.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vertices |
np.array
|
Vertices to center |
required |
Returns:
Type | Description |
---|---|
np.ndarray
|
vertices centered |
Source code in glm/glm.py
rotate
Rotation about an arbitrary X axis
Parameters:
Name | Type | Description | Default |
---|---|---|---|
theta |
float
|
Specifies the angle of rotation, in degrees. |
required |
axis |
vec3
|
Axis of rotation |
required |
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Rotation matrix |
Source code in glm/glm.py
xrotate
Rotation about the X axis
Parameters:
Name | Type | Description | Default |
---|---|---|---|
theta |
float
|
Specifies the angle of rotation, in degrees. |
0
|
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Rotation matrix |
Source code in glm/glm.py
yrotate
Rotation about the Y axis
Parameters:
Name | Type | Description | Default |
---|---|---|---|
theta |
float
|
Specifies the angle of rotation, in degrees. |
0
|
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Rotation matrix |
Source code in glm/glm.py
zrotate
Rotation about the Z axis
Parameters:
Name | Type | Description | Default |
---|---|---|---|
theta |
float
|
Specifies the angle of rotation, in degrees. |
0
|
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Rotation matrix |
Source code in glm/glm.py
align
Return the rotation matrix that aligns U to V
Parameters:
Name | Type | Description | Default |
---|---|---|---|
U |
vec[234]
|
First vector |
required |
U |
vec[234]
|
Second vector |
required |
dtype |
np.dtype
|
dtype of the resulting array |
np.float32
|
transpose |
bool
|
Whether to transpose result |
False
|
Returns:
Type | Description |
---|---|
mat4
|
Rotation matrix |