Class PMVMatrix
- java.lang.Object
-
- com.jogamp.math.util.PMVMatrix4f
-
- com.jogamp.opengl.util.PMVMatrix
-
- All Implemented Interfaces:
GLMatrixFunc
public final class PMVMatrix extends com.jogamp.math.util.PMVMatrix4f implements GLMatrixFunc
PMVMatrix implements a subset of the fixed function pipelineGLMatrixFunc
usingPMVMatrix4f
.PMVMatrix provides the
inverse modelview matrix (Mvi)
andinverse transposed modelview matrix (Mvit)
.Frustum
is also provided byPMVMatrix4f.getFrustum()
. To keep these derived values synchronized after mutable Mv operations likeglRotatef(..)
inglMatrixMode
(GL_MODELVIEW
), users have to callPMVMatrix4f.update()
before using Mvi and Mvit.PMVMatrix can supplement
GL2ES2
applications w/ the lack of the described matrix functionality.
-
-
Field Summary
-
Fields inherited from class com.jogamp.math.util.PMVMatrix4f
FRUSTUM, INVERSE_MODELVIEW, INVERSE_TRANSPOSED_MODELVIEW, MANUAL_BITS, MODIFIED_ALL, MODIFIED_MODELVIEW, MODIFIED_PROJECTION, MODIFIED_TEXTURE, PREMUL_PMV, PREMUL_PMVI
-
Fields inherited from interface com.jogamp.opengl.fixedfunc.GLMatrixFunc
GL_MATRIX_MODE, GL_MODELVIEW, GL_MODELVIEW_MATRIX, GL_PROJECTION, GL_PROJECTION_MATRIX, GL_TEXTURE_MATRIX
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.jogamp.math.Matrix4f
getCurrentMat()
com.jogamp.math.Matrix4f
getMat(int matrixName)
void
glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar)
Multiply
the current matrix with the frustum matrix.void
glGetFloatv(int matrixGetName, float[] params, int params_offset)
Copy the named matrix to the given storage at offset.void
glGetFloatv(int matrixGetName, FloatBuffer params)
Copy the named matrix into the given storage.void
glGetIntegerv(int pname, int[] params, int params_offset)
void
glGetIntegerv(int pname, IntBuffer params)
glGetIntegervint
glGetMatrixMode()
void
glLoadIdentity()
Load the current matrix with the identity matrixvoid
glLoadMatrix(com.jogamp.math.Quaternion quat)
Load the current matrix with the values of the givenQuaternion
's rotationmatrix representation
.void
glLoadMatrixf(float[] values, int offset)
Load the current matrix w/ the provided one.void
glLoadMatrixf(com.jogamp.math.Matrix4f m)
Load the current matrix with the values of the givenMatrix4f
.void
glLoadMatrixf(FloatBuffer m)
Load the current matrix w/ the provided one.void
glMatrixMode(int matrixName)
Sets the current matrix mode.void
glMultMatrixf(float[] m, int m_offset)
Multiply the current matrix: [c] = [c] x [m]PMVMatrix
glMultMatrixf(com.jogamp.math.Matrix4f m)
Multiply the current matrix: [c] = [c] x [m]void
glMultMatrixf(FloatBuffer m)
Multiply the current matrix: [c] = [c] x [m]void
glOrthof(float left, float right, float bottom, float top, float zNear, float zFar)
Multiply
the current matrix with the orthogonal matrix.void
glPopMatrix()
Pop the current matrix from it's stack.void
glPushMatrix()
Push the current matrix to it's stack, while preserving it's values.PMVMatrix
glRotate(com.jogamp.math.Quaternion quat)
Rotate the current matrix with the givenQuaternion
's rotationmatrix representation
.void
glRotatef(float ang_deg, float x, float y, float z)
Rotate the current matrix.PMVMatrix
glRotatef(float ang_rad, com.jogamp.math.Vec3f axis)
Rotate the current matrix by the given axis and angle in radians.void
glScalef(float x, float y, float z)
Scale the current matrix.PMVMatrix
glScalef(com.jogamp.math.Vec3f s)
Scale the current matrix.void
glTranslatef(float x, float y, float z)
Translate the current matrix.PMVMatrix
glTranslatef(com.jogamp.math.Vec3f t)
Translate the current matrix.void
gluLookAt(com.jogamp.math.Vec3f eye, com.jogamp.math.Vec3f center, com.jogamp.math.Vec3f up)
Multiply
thecurrent matrix
with the eye, object and orientation, i.e.void
gluPerspective(float fovy_rad, float aspect, float zNear, float zFar)
Multiply
thecurrent matrix
with the perspective/frustum matrix.void
gluPickMatrix(float x, float y, float deltaX, float deltaY, com.jogamp.math.Recti viewport)
Make given matrix the pick matrix based on given parameters.static boolean
isMatrixGetName(int matrixGetName)
static boolean
isMatrixModeName(int matrixModeName)
static int
matrixGetName2MatrixModeName(int matrixGetName)
static int
matrixModeName2MatrixGetName(int matrixModeName)
void
reset()
IssuesMatrix4f.loadIdentity()
on all matrices and resets all internal states.-
Methods inherited from class com.jogamp.math.util.PMVMatrix4f
frustumP, getDirtyBits, getFrustum, getModifiedBits, getMulMvP, getMulPMv, getMv, getMvi, getMvit, getP, getPMv, getPMvi, getReqBits, getSyncMv, getSyncMvi, getSyncMvit, getSyncP, getSyncPMv, getSyncPMvMvi, getSyncPMvMviMvit, getSyncT, getT, isReqDirty, loadMv, loadMv, loadMv, loadMv, loadMvIdentity, loadP, loadP, loadP, loadP, loadPIdentity, loadT, loadT, loadT, loadT, loadTIdentity, lookAtP, mapObjToWin, mapWinToObj, mapWinToObj4, mapWinToRay, mulMv, mulP, mulT, mulWithMv, mulWithMv, mulWithMv, orthoP, perspectiveP, popMv, popP, popT, pushMv, pushP, pushT, rotateMv, rotateMv, rotateMv, rotateP, rotateP, rotateP, scaleMv, scaleMv, scaleP, scaleP, setModelviewDirty, setProjectionDirty, setTextureDirty, toString, toString, translateMv, translateMv, translateP, translateP, update
-
-
-
-
Constructor Detail
-
PMVMatrix
public PMVMatrix()
Creates an instance of PMVMatrix.This constructor only sets up an instance w/o additional
PMVMatrix4f.INVERSE_MODELVIEW
orPMVMatrix4f.INVERSE_TRANSPOSED_MODELVIEW
.Implementation uses non-direct non-NIO Buffers with guaranteed backing array, which are synchronized to the actual Matrix4f instances. This allows faster access in Java computation.
- See Also:
PMVMatrix(int)
-
PMVMatrix
public PMVMatrix(int derivedMatrices)
Creates an instance of PMVMatrix.Additional derived matrices can be requested via `derivedMatrices`, i.e. -
PMVMatrix4f.INVERSE_MODELVIEW
-PMVMatrix4f.INVERSE_TRANSPOSED_MODELVIEW
Implementation uses non-direct non-NIO Buffers with guaranteed backing array, which are synchronized to the actual Matrix4f instances. This allows faster access in Java computation.
- Parameters:
derivedMatrices
- additional matrices can be requested by passing bitsPMVMatrix4f.INVERSE_MODELVIEW
andPMVMatrix4f.INVERSE_TRANSPOSED_MODELVIEW
.- See Also:
PMVMatrix4f.getReqBits()
,PMVMatrix4f.isReqDirty()
,PMVMatrix4f.getDirtyBits()
,PMVMatrix4f.update()
-
-
Method Detail
-
isMatrixModeName
public static final boolean isMatrixModeName(int matrixModeName)
- Parameters:
matrixModeName
- One ofGL_MODELVIEW
,GL_PROJECTION
orGL_TEXTURE
- Returns:
- true if the given matrix-mode name is valid, otherwise false.
-
matrixModeName2MatrixGetName
public static final int matrixModeName2MatrixGetName(int matrixModeName)
- Parameters:
matrixModeName
- One ofGL_MODELVIEW
,GL_PROJECTION
orGL_TEXTURE
- Returns:
- The corresponding matrix-get name, one of
GL_MODELVIEW_MATRIX
,GL_PROJECTION_MATRIX
orGL_TEXTURE_MATRIX
-
isMatrixGetName
public static final boolean isMatrixGetName(int matrixGetName)
- Parameters:
matrixGetName
- One ofGL_MODELVIEW_MATRIX
,GL_PROJECTION_MATRIX
orGL_TEXTURE_MATRIX
- Returns:
- true if the given matrix-get name is valid, otherwise false.
-
matrixGetName2MatrixModeName
public static final int matrixGetName2MatrixModeName(int matrixGetName)
- Parameters:
matrixGetName
- One ofGL_MODELVIEW_MATRIX
,GL_PROJECTION_MATRIX
orGL_TEXTURE_MATRIX
- Returns:
- The corresponding matrix-mode name, one of
GL_MODELVIEW
,GL_PROJECTION
orGL_TEXTURE
-
reset
public void reset()
IssuesMatrix4f.loadIdentity()
on all matrices and resets all internal states.Leaves
GL_MODELVIEW
the active matrix mode.- Overrides:
reset
in classcom.jogamp.math.util.PMVMatrix4f
-
glGetMatrixMode
public final int glGetMatrixMode()
-
getCurrentMat
public final com.jogamp.math.Matrix4f getCurrentMat()
- Returns:
- the matrix of the current matrix-mode
-
getMat
public final com.jogamp.math.Matrix4f getMat(int matrixName)
- Parameters:
matrixName
- Either a matrix-get-name, i.e.GL_MODELVIEW_MATRIX
,GL_PROJECTION_MATRIX
orGL_TEXTURE_MATRIX
, or a matrix-mode-name, i.e.GL_MODELVIEW
,GL_PROJECTION
orGL_TEXTURE
- Returns:
- the named matrix, not a copy!
-
glMatrixMode
public final void glMatrixMode(int matrixName)
Description copied from interface:GLMatrixFunc
Sets the current matrix mode.- Specified by:
glMatrixMode
in interfaceGLMatrixFunc
- Parameters:
matrixName
-GLMatrixFunc.GL_MODELVIEW
,GLMatrixFunc.GL_PROJECTION
orGL_TEXTURE
.
-
glGetFloatv
public final void glGetFloatv(int matrixGetName, FloatBuffer params)
Description copied from interface:GLMatrixFunc
Copy the named matrix into the given storage.- Specified by:
glGetFloatv
in interfaceGLMatrixFunc
- Parameters:
matrixGetName
-GLMatrixFunc.GL_MODELVIEW_MATRIX
,GLMatrixFunc.GL_PROJECTION_MATRIX
orGLMatrixFunc.GL_TEXTURE_MATRIX
params
- the FloatBuffer's position remains unchanged, which is the same behavior than the native JOGL GL impl
-
glGetFloatv
public final void glGetFloatv(int matrixGetName, float[] params, int params_offset)
Description copied from interface:GLMatrixFunc
Copy the named matrix to the given storage at offset.- Specified by:
glGetFloatv
in interfaceGLMatrixFunc
- Parameters:
matrixGetName
-GLMatrixFunc.GL_MODELVIEW_MATRIX
,GLMatrixFunc.GL_PROJECTION_MATRIX
orGLMatrixFunc.GL_TEXTURE_MATRIX
params
- storageparams_offset
- storage offset
-
glGetIntegerv
public final void glGetIntegerv(int pname, IntBuffer params)
Description copied from interface:GLMatrixFunc
glGetIntegerv- Specified by:
glGetIntegerv
in interfaceGLMatrixFunc
- Parameters:
pname
-GLMatrixFunc.GL_MATRIX_MODE
to receive the current matrix modeparams
- the FloatBuffer's position remains unchanged which is the same behavior than the native JOGL GL impl
-
glGetIntegerv
public final void glGetIntegerv(int pname, int[] params, int params_offset)
- Specified by:
glGetIntegerv
in interfaceGLMatrixFunc
-
glLoadMatrixf
public final void glLoadMatrixf(float[] values, int offset)
Description copied from interface:GLMatrixFunc
Load the current matrix w/ the provided one.- Specified by:
glLoadMatrixf
in interfaceGLMatrixFunc
-
glLoadMatrixf
public final void glLoadMatrixf(FloatBuffer m)
Description copied from interface:GLMatrixFunc
Load the current matrix w/ the provided one.- Specified by:
glLoadMatrixf
in interfaceGLMatrixFunc
-
glLoadMatrixf
public final void glLoadMatrixf(com.jogamp.math.Matrix4f m)
Load the current matrix with the values of the givenMatrix4f
.Extension to
GLMatrixFunc
.
-
glLoadMatrix
public final void glLoadMatrix(com.jogamp.math.Quaternion quat)
Load the current matrix with the values of the givenQuaternion
's rotationmatrix representation
.Extension to
GLMatrixFunc
.
-
glLoadIdentity
public final void glLoadIdentity()
Description copied from interface:GLMatrixFunc
Load the current matrix with the identity matrix- Specified by:
glLoadIdentity
in interfaceGLMatrixFunc
-
glMultMatrixf
public final void glMultMatrixf(FloatBuffer m)
Description copied from interface:GLMatrixFunc
Multiply the current matrix: [c] = [c] x [m]- Specified by:
glMultMatrixf
in interfaceGLMatrixFunc
- Parameters:
m
- the FloatBuffer's position remains unchanged, which is the same behavior than the native JOGL GL impl
-
glMultMatrixf
public final void glMultMatrixf(float[] m, int m_offset)
Description copied from interface:GLMatrixFunc
Multiply the current matrix: [c] = [c] x [m]- Specified by:
glMultMatrixf
in interfaceGLMatrixFunc
-
glMultMatrixf
public final PMVMatrix glMultMatrixf(com.jogamp.math.Matrix4f m)
Multiply the current matrix: [c] = [c] x [m]Extension to
GLMatrixFunc
.- Parameters:
m
- the right hand Matrix4f- Returns:
- this instance of chaining
-
glTranslatef
public final void glTranslatef(float x, float y, float z)
Description copied from interface:GLMatrixFunc
Translate the current matrix.- Specified by:
glTranslatef
in interfaceGLMatrixFunc
-
glTranslatef
public final PMVMatrix glTranslatef(com.jogamp.math.Vec3f t)
Translate the current matrix.Extension to
GLMatrixFunc
.- Parameters:
t
- translation vec3- Returns:
- this instance of chaining
-
glScalef
public final void glScalef(float x, float y, float z)
Description copied from interface:GLMatrixFunc
Scale the current matrix.- Specified by:
glScalef
in interfaceGLMatrixFunc
-
glScalef
public final PMVMatrix glScalef(com.jogamp.math.Vec3f s)
Scale the current matrix.Extension to
GLMatrixFunc
.- Parameters:
s
- scale vec4f- Returns:
- this instance of chaining
-
glRotatef
public final void glRotatef(float ang_deg, float x, float y, float z)
Description copied from interface:GLMatrixFunc
Rotate the current matrix.- Specified by:
glRotatef
in interfaceGLMatrixFunc
-
glRotatef
public final PMVMatrix glRotatef(float ang_rad, com.jogamp.math.Vec3f axis)
Rotate the current matrix by the given axis and angle in radians.Consider using
glRotate(Quaternion)
Extension to
GLMatrixFunc
.- Parameters:
ang_rad
- angle in radiansaxis
- rotation axis- Returns:
- this instance of chaining
- See Also:
glRotate(Quaternion)
-
glRotate
public final PMVMatrix glRotate(com.jogamp.math.Quaternion quat)
Rotate the current matrix with the givenQuaternion
's rotationmatrix representation
.Extension to
GLMatrixFunc
.- Parameters:
quat
- theQuaternion
- Returns:
- this instance of chaining
-
glPopMatrix
public final void glPopMatrix()
Description copied from interface:GLMatrixFunc
Pop the current matrix from it's stack.- Specified by:
glPopMatrix
in interfaceGLMatrixFunc
- See Also:
GLMatrixFunc.glPushMatrix()
-
glPushMatrix
public final void glPushMatrix()
Description copied from interface:GLMatrixFunc
Push the current matrix to it's stack, while preserving it's values.There exist one stack per matrix mode, i.e.
GLMatrixFunc.GL_MODELVIEW
,GLMatrixFunc.GL_PROJECTION
andGL_TEXTURE
.- Specified by:
glPushMatrix
in interfaceGLMatrixFunc
-
glOrthof
public final void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar)
Description copied from interface:GLMatrixFunc
Multiply
the current matrix with the orthogonal matrix.- Specified by:
glOrthof
in interfaceGLMatrixFunc
-
glFrustumf
public final void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) throws IllegalArgumentException
Multiply
the current matrix with the frustum matrix.- Specified by:
glFrustumf
in interfaceGLMatrixFunc
- Throws:
IllegalArgumentException
- ifzNear <= 0
orzFar <= zNear
orleft == right
, orbottom == top
.- See Also:
Matrix4f.setToFrustum(float, float, float, float, float, float)
-
gluPerspective
public final void gluPerspective(float fovy_rad, float aspect, float zNear, float zFar) throws IllegalArgumentException
Multiply
thecurrent matrix
with the perspective/frustum matrix.- Parameters:
fovy_rad
- fov angle in radiansaspect
- aspect ratio width / heightzNear
-zFar
-- Throws:
IllegalArgumentException
- ifzNear <= 0
orzFar <= zNear
- See Also:
Matrix4f.setToPerspective(float, float, float, float)
-
gluLookAt
public final void gluLookAt(com.jogamp.math.Vec3f eye, com.jogamp.math.Vec3f center, com.jogamp.math.Vec3f up)
Multiply
thecurrent matrix
with the eye, object and orientation, i.e.Matrix4f.setToLookAt(Vec3f, Vec3f, Vec3f, Matrix4f)
.
-
gluPickMatrix
public final void gluPickMatrix(float x, float y, float deltaX, float deltaY, com.jogamp.math.Recti viewport)
Make given matrix the pick matrix based on given parameters.Traditional
gluPickMatrix
implementation.See
for details.
- Parameters:
x
- the center x-component of a picking region in window coordinatesy
- the center y-component of a picking region in window coordinatesdeltaX
- the width of the picking region in window coordinates.deltaY
- the height of the picking region in window coordinates.viewport
- Rect4i viewport vector
-
-