JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
PMVMatrix.java
Go to the documentation of this file.
1/**
2 * Copyright 2009-2023 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.util;
29
30import java.nio.FloatBuffer;
31import java.nio.IntBuffer;
32
33import com.jogamp.opengl.GL;
34import com.jogamp.opengl.GLException;
35import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
36
37import com.jogamp.math.FloatUtil;
38import com.jogamp.math.Matrix4f;
39import com.jogamp.math.Quaternion;
40import com.jogamp.math.Recti;
41import com.jogamp.math.Vec3f;
42import com.jogamp.math.geom.Frustum;
43import com.jogamp.math.util.PMVMatrix4f;
44
45/**
46 * PMVMatrix implements a subset of the fixed function pipeline {@link GLMatrixFunc}
47 * using {@link PMVMatrix4f}.
48 * <p>
49 * PMVMatrix provides the {@link #getMvi() inverse modelview matrix (Mvi)} and
50 * {@link #getMvit() inverse transposed modelview matrix (Mvit)}.
51 * {@link Frustum} is also provided by {@link #getFrustum()}.
52 *
53 * To keep these derived values synchronized after mutable Mv operations like {@link #glRotatef(float, float, float, float) glRotatef(..)}
54 * in {@link #glMatrixMode(int) glMatrixMode}({@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}),
55 * users have to call {@link #update()} before using Mvi and Mvit.
56 * </p>
57 * <p>
58 * PMVMatrix can supplement {@link com.jogamp.opengl.GL2ES2 GL2ES2} applications w/ the
59 * lack of the described matrix functionality.
60 * </p>
61 */
62public final class PMVMatrix extends PMVMatrix4f implements GLMatrixFunc {
63
64 /**
65 * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
66 * @return true if the given matrix-mode name is valid, otherwise false.
67 */
68 public static final boolean isMatrixModeName(final int matrixModeName) {
69 switch(matrixModeName) {
73 return true;
74 }
75 return false;
76 }
77
78 /**
79 * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
80 * @return The corresponding matrix-get name, one of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
81 */
82 public static final int matrixModeName2MatrixGetName(final int matrixModeName) {
83 switch(matrixModeName) {
84 case GL_MODELVIEW:
86 case GL_PROJECTION:
88 case GL.GL_TEXTURE:
89 return GL_TEXTURE_MATRIX;
90 default:
91 throw new GLException("unsupported matrixName: "+matrixModeName);
92 }
93 }
94
95 /**
96 * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
97 * @return true if the given matrix-get name is valid, otherwise false.
98 */
99 public static final boolean isMatrixGetName(final int matrixGetName) {
100 switch(matrixGetName) {
101 case GL_MATRIX_MODE:
105 return true;
106 }
107 return false;
108 }
109
110 /**
111 * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
112 * @return The corresponding matrix-mode name, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
113 */
114 public static final int matrixGetName2MatrixModeName(final int matrixGetName) {
115 switch(matrixGetName) {
117 return GL_MODELVIEW;
119 return GL_PROJECTION;
121 return GL.GL_TEXTURE;
122 default:
123 throw new GLException("unsupported matrixGetName: "+matrixGetName);
124 }
125 }
126
127 /**
128 * Creates an instance of PMVMatrix.
129 * <p>
130 * This constructor only sets up an instance w/o additional {@link #INVERSE_MODELVIEW} or {@link #INVERSE_TRANSPOSED_MODELVIEW}.
131 * </p>
132 * <p>
133 * Implementation uses non-direct non-NIO Buffers with guaranteed backing array,
134 * which are synchronized to the actual Matrix4f instances.
135 * This allows faster access in Java computation.
136 * </p>
137 * @see #PMVMatrix(int)
138 */
139 public PMVMatrix() {
140 this(0);
141 }
142
143 /**
144 * Creates an instance of PMVMatrix.
145 * <p>
146 * Additional derived matrices can be requested via `derivedMatrices`, i.e.
147 * - {@link #INVERSE_MODELVIEW}
148 * - {@link #INVERSE_TRANSPOSED_MODELVIEW}
149 * </p>
150 * <p>
151 * Implementation uses non-direct non-NIO Buffers with guaranteed backing array,
152 * which are synchronized to the actual Matrix4f instances.
153 * This allows faster access in Java computation.
154 * </p>
155 * @param derivedMatrices additional matrices can be requested by passing bits {@link #INVERSE_MODELVIEW} and {@link #INVERSE_TRANSPOSED_MODELVIEW}.
156 * @see #getReqBits()
157 * @see #isReqDirty()
158 * @see #getDirtyBits()
159 * @see #update()
160 */
161 public PMVMatrix(final int derivedMatrices) {
162 super(derivedMatrices);
163 }
164
165
166 /**
167 * {@inheritDoc}
168 * <p>
169 * Leaves {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW} the active matrix mode.
170 * </p>
171 */
172 @Override
173 public void reset() {
174 super.reset();
175 matrixMode = GL_MODELVIEW;
176 }
177
178 //
179 // GLMatrixFunc implementation
180 //
181
182 /** Returns the current matrix-mode, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}. */
183 public final int glGetMatrixMode() {
184 return matrixMode;
185 }
186
187 /**
188 * @return the matrix of the current matrix-mode
189 */
190 public final Matrix4f getCurrentMat() {
191 return getMat(matrixMode);
192 }
193
194 /**
195 * @param matrixName Either a matrix-get-name, i.e.
196 * {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX},
197 * or a matrix-mode-name, i.e.
198 * {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
199 * @return the named matrix, not a copy!
200 */
201 public final Matrix4f getMat(final int matrixName) {
202 switch(matrixName) {
204 case GL_MODELVIEW:
205 return matMv;
207 case GL_PROJECTION:
208 return matP;
210 case GL.GL_TEXTURE:
211 return matTex;
212 default:
213 throw new GLException("unsupported matrixName: "+matrixName);
214 }
215 }
216
217 @Override
218 public final void glMatrixMode(final int matrixName) {
219 switch(matrixName) {
220 case GL_MODELVIEW:
221 case GL_PROJECTION:
222 case GL.GL_TEXTURE:
223 break;
224 default:
225 throw new GLException("unsupported matrixName: "+matrixName);
226 }
227 matrixMode = matrixName;
228 }
229
230 @Override
231 public final void glGetFloatv(final int matrixGetName, final FloatBuffer params) {
232 final int pos = params.position();
233 if(matrixGetName==GL_MATRIX_MODE) {
234 params.put(matrixMode);
235 } else {
236 getMat(matrixGetName).get(params); // matrix -> params
237 }
238 params.position(pos);
239 }
240
241 @Override
242 public final void glGetFloatv(final int matrixGetName, final float[] params, final int params_offset) {
243 if(matrixGetName==GL_MATRIX_MODE) {
244 params[params_offset]=matrixMode;
245 } else {
246 getMat(matrixGetName).get(params, params_offset); // matrix -> params
247 }
248 }
249
250 @Override
251 public final void glGetIntegerv(final int pname, final IntBuffer params) {
252 final int pos = params.position();
253 if(pname==GL_MATRIX_MODE) {
254 params.put(matrixMode);
255 } else {
256 throw new GLException("unsupported pname: "+pname);
257 }
258 params.position(pos);
259 }
260
261 @Override
262 public final void glGetIntegerv(final int pname, final int[] params, final int params_offset) {
263 if(pname==GL_MATRIX_MODE) {
264 params[params_offset]=matrixMode;
265 } else {
266 throw new GLException("unsupported pname: "+pname);
267 }
268 }
269
270 @Override
271 public final void glLoadMatrixf(final float[] values, final int offset) {
272 if(matrixMode==GL_MODELVIEW) {
273 loadMv(values, offset);
274 } else if(matrixMode==GL_PROJECTION) {
275 loadP(values, offset);
276 } else if(matrixMode==GL.GL_TEXTURE) {
277 loadT(values, offset);
278 }
279 }
280
281 @Override
282 public final void glLoadMatrixf(final java.nio.FloatBuffer m) {
283 if(matrixMode==GL_MODELVIEW) {
284 loadMv(m);
285 } else if(matrixMode==GL_PROJECTION) {
286 loadP(m);
287 } else if(matrixMode==GL.GL_TEXTURE) {
288 loadT(m);
289 }
290 }
291
292 /**
293 * Load the current matrix with the values of the given {@link Matrix4f}.
294 * <p>
295 * Extension to {@link GLMatrixFunc}.
296 * </p>
297 */
298 public final void glLoadMatrixf(final Matrix4f m) {
299 if(matrixMode==GL_MODELVIEW) {
300 loadMv(m);
301 } else if(matrixMode==GL_PROJECTION) {
302 loadP(m);
303 } else if(matrixMode==GL.GL_TEXTURE) {
304 loadT(m);
305 }
306 }
307
308 /**
309 * Load the current matrix with the values of the given {@link Quaternion}'s rotation {@link Matrix4f#setToRotation(Quaternion) matrix representation}.
310 * <p>
311 * Extension to {@link GLMatrixFunc}.
312 * </p>
313 */
314 public final void glLoadMatrix(final Quaternion quat) {
315 if(matrixMode==GL_MODELVIEW) {
316 loadMv(quat);
317 } else if(matrixMode==GL_PROJECTION) {
318 loadP(quat);
319 } else if(matrixMode==GL.GL_TEXTURE) {
320 loadT(quat);
321 }
322 }
323
324 @Override
325 public final void glLoadIdentity() {
326 if(matrixMode==GL_MODELVIEW) {
328 } else if(matrixMode==GL_PROJECTION) {
330 } else if(matrixMode==GL.GL_TEXTURE) {
332 }
333 }
334
335 @Override
336 public final void glMultMatrixf(final FloatBuffer m) {
337 final int spos = m.position();
338 if(matrixMode==GL_MODELVIEW) {
339 mulMv( mat4Tmp1.load( m ) );
340 } else if(matrixMode==GL_PROJECTION) {
341 mulP( mat4Tmp1.load( m ) );
342 } else if(matrixMode==GL.GL_TEXTURE) {
343 mulT( mat4Tmp1.load( m ) );
344 }
345 m.position(spos);
346 }
347
348 @Override
349 public final void glMultMatrixf(final float[] m, final int m_offset) {
350 if(matrixMode==GL_MODELVIEW) {
351 mulMv( mat4Tmp1.load( m, m_offset ) );
352 } else if(matrixMode==GL_PROJECTION) {
353 mulP( mat4Tmp1.load( m, m_offset ) );
354 } else if(matrixMode==GL.GL_TEXTURE) {
355 mulT( mat4Tmp1.load( m, m_offset ) );
356 }
357 }
358
359 /**
360 * Multiply the current matrix: [c] = [c] x [m]
361 * <p>
362 * Extension to {@link GLMatrixFunc}.
363 * </p>
364 * @param m the right hand Matrix4f
365 * @return this instance of chaining
366 */
367 public final PMVMatrix glMultMatrixf(final Matrix4f m) {
368 if(matrixMode==GL_MODELVIEW) {
369 mulMv(m);
370 } else if(matrixMode==GL_PROJECTION) {
371 mulP(m);
372 } else if(matrixMode==GL.GL_TEXTURE) {
373 mulT(m);
374 }
375 return this;
376 }
377
378 @Override
379 public final void glTranslatef(final float x, final float y, final float z) {
381 }
382
383 /**
384 * Translate the current matrix.
385 * <p>
386 * Extension to {@link GLMatrixFunc}.
387 * </p>
388 * @param t translation vec3
389 * @return this instance of chaining
390 */
391 public final PMVMatrix glTranslatef(final Vec3f t) {
393 }
394
395 @Override
396 public final void glScalef(final float x, final float y, final float z) {
398 }
399
400 /**
401 * Scale the current matrix.
402 * <p>
403 * Extension to {@link GLMatrixFunc}.
404 * </p>
405 * @param s scale vec4f
406 * @return this instance of chaining
407 */
408 public final PMVMatrix glScalef(final Vec3f s) {
409 return glMultMatrixf( mat4Tmp1.setToScale(s) );
410 }
411
412 @Override
413 public final void glRotatef(final float ang_deg, final float x, final float y, final float z) {
415 }
416
417 /**
418 * Rotate the current matrix by the given axis and angle in radians.
419 * <p>
420 * Consider using {@link #glRotate(Quaternion)}
421 * </p>
422 * <p>
423 * Extension to {@link GLMatrixFunc}.
424 * </p>
425 * @param ang_rad angle in radians
426 * @param axis rotation axis
427 * @return this instance of chaining
428 * @see #glRotate(Quaternion)
429 */
430 public final PMVMatrix glRotatef(final float ang_rad, final Vec3f axis) {
431 return glMultMatrixf( mat4Tmp1.setToRotationAxis(ang_rad, axis) );
432 }
433
434 /**
435 * Rotate the current matrix with the given {@link Quaternion}'s rotation {@link Matrix4f#setToRotation(Quaternion) matrix representation}.
436 * <p>
437 * Extension to {@link GLMatrixFunc}.
438 * </p>
439 * @param quat the {@link Quaternion}
440 * @return this instance of chaining
441 */
442 public final PMVMatrix glRotate(final Quaternion quat) {
443 return glMultMatrixf( mat4Tmp1.setToRotation(quat) );
444 }
445
446 @Override
447 public final void glPopMatrix() {
448 if(matrixMode==GL_MODELVIEW) {
449 popMv();
450 } else if(matrixMode==GL_PROJECTION) {
451 popP();
452 } else if(matrixMode==GL.GL_TEXTURE) {
453 popT();
454 }
455 }
456
457 @Override
458 public final void glPushMatrix() {
459 if(matrixMode==GL_MODELVIEW) {
460 pushMv();
461 } else if(matrixMode==GL_PROJECTION) {
462 pushP();
463 } else if(matrixMode==GL.GL_TEXTURE) {
464 pushT();
465 }
466 }
467
468 @Override
469 public final void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
470 glMultMatrixf( mat4Tmp1.setToOrtho(left, right, bottom, top, zNear, zFar) );
471 }
472
473 /**
474 * {@inheritDoc}
475 *
476 * @throws IllegalArgumentException if {@code zNear <= 0} or {@code zFar <= zNear}
477 * or {@code left == right}, or {@code bottom == top}.
478 * @see Matrix4f#setToFrustum(float, float, float, float, float, float)
479 */
480 @Override
481 public final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws IllegalArgumentException {
482 glMultMatrixf( mat4Tmp1.setToFrustum(left, right, bottom, top, zNear, zFar) );
483 }
484
485 //
486 // Extra functionality
487 //
488
489 /**
490 * {@link #glMultMatrixf(FloatBuffer) Multiply} the {@link #glGetMatrixMode() current matrix} with the perspective/frustum matrix.
491 *
492 * @param fovy_rad fov angle in radians
493 * @param aspect aspect ratio width / height
494 * @param zNear
495 * @param zFar
496 * @throws IllegalArgumentException if {@code zNear <= 0} or {@code zFar <= zNear}
497 * @see Matrix4f#setToPerspective(float, float, float, float)
498 */
499 public final void gluPerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar) throws IllegalArgumentException {
500 glMultMatrixf( mat4Tmp1.setToPerspective(fovy_rad, aspect, zNear, zFar) );
501 }
502
503 /**
504 * {@link #glMultMatrixf(FloatBuffer) Multiply} the {@link #glGetMatrixMode() current matrix}
505 * with the eye, object and orientation, i.e. {@link Matrix4f#setToLookAt(Vec3f, Vec3f, Vec3f, Matrix4f)}.
506 */
507 public final void gluLookAt(final Vec3f eye, final Vec3f center, final Vec3f up) {
508 glMultMatrixf( mat4Tmp1.setToLookAt(eye, center, up, getTmp2Mat()) );
509 }
510
511 /**
512 * Make given matrix the <i>pick</i> matrix based on given parameters.
513 * <p>
514 * Traditional <code>gluPickMatrix</code> implementation.
515 * </p>
516 * <p>
517 * See {@link Matrix4f#setToPick(float, float, float, float, Recti, int, Matrix4f) for details.
518 * </p>
519 * @param x the center x-component of a picking region in window coordinates
520 * @param y the center y-component of a picking region in window coordinates
521 * @param deltaX the width of the picking region in window coordinates.
522 * @param deltaY the height of the picking region in window coordinates.
523 * @param viewport Rect4i viewport vector
524 */
525 public final void gluPickMatrix(final float x, final float y, final float deltaX, final float deltaY, final Recti viewport) {
526 if( null != mat4Tmp1.setToPick(x, y, deltaX, deltaY, viewport, getTmp2Mat()) ) {
528 }
529 }
530
531 //
532 // private
533 //
534
535 private int matrixMode = GL_MODELVIEW;
536}
Basic Float math utility functions.
Definition: FloatUtil.java:83
static float adegToRad(final float arc_degree)
Converts arc-degree to radians.
Basic 4x4 float matrix implementation using fields for intensive use-cases (host operations).
Definition: Matrix4f.java:89
Matrix4f load(final Matrix4f src)
Load the values of the given matrix src to this matrix.
Definition: Matrix4f.java:186
Matrix4f setToPerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar)
Set this matrix to perspective frustum projection.
Definition: Matrix4f.java:1303
final Matrix4f setToRotation(final Quaternion q)
Set this matrix to rotation using the given Quaternion.
Definition: Matrix4f.java:1124
float get(final int i)
Gets the ith component, 0 <= i < 16.
Definition: Matrix4f.java:279
final Matrix4f setToRotationAxis(final float ang_rad, float x, float y, float z)
Set this matrix to rotation from the given axis and angle in radians.
Definition: Matrix4f.java:973
Matrix4f setToOrtho(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
Set this matrix to orthogonal projection.
Definition: Matrix4f.java:1206
Matrix4f setToLookAt(final Vec3f eye, final Vec3f center, final Vec3f up, final Matrix4f tmp)
Set this matrix to the look-at matrix based on given parameters.
Definition: Matrix4f.java:1432
Matrix4f setToPick(final float x, final float y, final float deltaX, final float deltaY, final Recti viewport, final Matrix4f mat4Tmp)
Set this matrix to the pick matrix based on given parameters.
Definition: Matrix4f.java:1498
final Matrix4f setToScale(final float x, final float y, final float z)
Set this matrix to scale.
Definition: Matrix4f.java:929
Matrix4f setToFrustum(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
Set this matrix to frustum.
Definition: Matrix4f.java:1254
final Matrix4f setToTranslation(final float x, final float y, final float z)
Set this matrix to translation.
Definition: Matrix4f.java:887
Quaternion implementation supporting Gimbal-Lock free rotations.
Definition: Quaternion.java:45
Rectangle with x, y, width and height integer components.
Definition: Recti.java:34
3D Vector based upon three float components.
Definition: Vec3f.java:37
PMVMatrix4f implements the basic computer graphics Matrix4f pack using projection (P),...
final PMVMatrix4f mulMv(final Matrix4f m)
Multiply the modelview matrix: [c] = [c] x [m].
final PMVMatrix4f loadTIdentity()
Load the texture matrix with the values of the given Matrix4f.
final PMVMatrix4f loadMv(final float[] values, final int offset)
Load the modelview matrix with the provided values.
final PMVMatrix4f loadMvIdentity()
Load the modelview matrix with the values of the given Matrix4f.
final PMVMatrix4f pushP()
Push the projection matrix to its stack, while preserving its values.
final PMVMatrix4f loadP(final float[] values, final int offset)
Load the projection matrix with the provided values.
final PMVMatrix4f mulT(final Matrix4f m)
Multiply the texture matrix: [c] = [c] x [m].
final PMVMatrix4f mulP(final Matrix4f m)
Multiply the projection matrix: [c] = [c] x [m].
final PMVMatrix4f popP()
Pop the projection matrix from its stack.
final PMVMatrix4f popT()
Pop the texture matrix from its stack.
final PMVMatrix4f loadPIdentity()
Load the projection matrix with the values of the given Matrix4f.
final Matrix4f getTmp2Mat()
Return the second temporary Matrix4f exposed to be reused for efficiency.
final PMVMatrix4f popMv()
Pop the modelview matrix from its stack.
final PMVMatrix4f loadT(final float[] values, final int offset)
Load the texture matrix with the provided values.
final PMVMatrix4f pushMv()
Push the modelview matrix to its stack, while preserving its values.
final PMVMatrix4f pushT()
Push the texture matrix to its stack, while preserving its values.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
PMVMatrix implements a subset of the fixed function pipeline GLMatrixFunc using PMVMatrix4f.
Definition: PMVMatrix.java:62
final void glTranslatef(final float x, final float y, final float z)
Translate the current matrix.
Definition: PMVMatrix.java:379
final void glScalef(final float x, final float y, final float z)
Scale the current matrix.
Definition: PMVMatrix.java:396
void reset()
Issues Matrix4f#loadIdentity() on all matrices and resets all internal states.
Definition: PMVMatrix.java:173
final PMVMatrix glRotate(final Quaternion quat)
Rotate the current matrix with the given Quaternion's rotation matrix representation.
Definition: PMVMatrix.java:442
final void glMultMatrixf(final float[] m, final int m_offset)
Multiply the current matrix: [c] = [c] x [m].
Definition: PMVMatrix.java:349
final void glMultMatrixf(final FloatBuffer m)
Definition: PMVMatrix.java:336
final void glGetIntegerv(final int pname, final int[] params, final int params_offset)
Definition: PMVMatrix.java:262
final PMVMatrix glMultMatrixf(final Matrix4f m)
Multiply the current matrix: [c] = [c] x [m].
Definition: PMVMatrix.java:367
static final boolean isMatrixModeName(final int matrixModeName)
Definition: PMVMatrix.java:68
static final boolean isMatrixGetName(final int matrixGetName)
Definition: PMVMatrix.java:99
final void glMatrixMode(final int matrixName)
Sets the current matrix mode.
Definition: PMVMatrix.java:218
final Matrix4f getMat(final int matrixName)
Definition: PMVMatrix.java:201
final void glGetIntegerv(final int pname, final IntBuffer params)
glGetIntegerv
Definition: PMVMatrix.java:251
final PMVMatrix glRotatef(final float ang_rad, final Vec3f axis)
Rotate the current matrix by the given axis and angle in radians.
Definition: PMVMatrix.java:430
final PMVMatrix glScalef(final Vec3f s)
Scale the current matrix.
Definition: PMVMatrix.java:408
final void glLoadMatrixf(final java.nio.FloatBuffer m)
Load the current matrix w/ the provided one.
Definition: PMVMatrix.java:282
final void glGetFloatv(final int matrixGetName, final FloatBuffer params)
Definition: PMVMatrix.java:231
final void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
Multiply the current matrix with the orthogonal matrix.
Definition: PMVMatrix.java:469
static final int matrixGetName2MatrixModeName(final int matrixGetName)
Definition: PMVMatrix.java:114
static final int matrixModeName2MatrixGetName(final int matrixModeName)
Definition: PMVMatrix.java:82
final void glLoadMatrixf(final Matrix4f m)
Load the current matrix with the values of the given Matrix4f.
Definition: PMVMatrix.java:298
final void gluPerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar)
Multiply the current matrix with the perspective/frustum matrix.
Definition: PMVMatrix.java:499
final void glPushMatrix()
Push the current matrix to it's stack, while preserving it's values.
Definition: PMVMatrix.java:458
final PMVMatrix glTranslatef(final Vec3f t)
Translate the current matrix.
Definition: PMVMatrix.java:391
final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
Multiply the current matrix with the frustum matrix.
Definition: PMVMatrix.java:481
final void glLoadMatrix(final Quaternion quat)
Load the current matrix with the values of the given Quaternion's rotation matrix representation.
Definition: PMVMatrix.java:314
final void glRotatef(final float ang_deg, final float x, final float y, final float z)
Rotate the current matrix.
Definition: PMVMatrix.java:413
final void gluLookAt(final Vec3f eye, final Vec3f center, final Vec3f up)
Multiply the current matrix with the eye, object and orientation, i.e.
Definition: PMVMatrix.java:507
final void gluPickMatrix(final float x, final float y, final float deltaX, final float deltaY, final Recti viewport)
Make given matrix the pick matrix based on given parameters.
Definition: PMVMatrix.java:525
PMVMatrix()
Creates an instance of PMVMatrix.
Definition: PMVMatrix.java:139
final void glPopMatrix()
Pop the current matrix from it's stack.
Definition: PMVMatrix.java:447
final void glGetFloatv(final int matrixGetName, final float[] params, final int params_offset)
Copy the named matrix to the given storage at offset.
Definition: PMVMatrix.java:242
final int glGetMatrixMode()
Returns the current matrix-mode, one of GL_MODELVIEW, GL_PROJECTION or GL_TEXTURE.
Definition: PMVMatrix.java:183
final void glLoadIdentity()
Load the current matrix with the identity matrix.
Definition: PMVMatrix.java:325
PMVMatrix(final int derivedMatrices)
Creates an instance of PMVMatrix.
Definition: PMVMatrix.java:161
final void glLoadMatrixf(final float[] values, final int offset)
Load the current matrix w/ the provided one.
Definition: PMVMatrix.java:271
static final int GL_TEXTURE
GL_ES_VERSION_2_0, GL_VERSION_1_1, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE" with express...
Definition: GL.java:615
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
static final int GL_MODELVIEW_MATRIX
Matrix access name for modelview.
static final int GL_TEXTURE_MATRIX
Matrix access name for texture.
static final int GL_MODELVIEW
Matrix mode modelview.
static final int GL_PROJECTION_MATRIX
Matrix access name for projection.