aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java35
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java36
-rw-r--r--src/jogl/classes/jogamp/opengl/ProjectFloat.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java16
6 files changed, 45 insertions, 48 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index c7a5a4bda..e70657b76 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -46,9 +46,11 @@ import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.FBObject.Attachment;
-import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.opengl.math.Matrix4f;
+import com.jogamp.opengl.math.Recti;
import com.jogamp.opengl.math.geom.AABBox;
import com.jogamp.opengl.util.GLArrayDataServer;
+import com.jogamp.opengl.util.SyncMatrices4f16;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureCoords;
@@ -77,7 +79,9 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
private GLArrayDataServer gca_FboTexCoordsAttr;
private GLArrayDataServer indicesFbo;
private final GLUniformData gcu_FboTexUnit;
- private final float[] pmvMatrix02 = new float[2*16]; // P + Mv
+ private final Matrix4f matP = new Matrix4f();
+ private final Matrix4f matMv = new Matrix4f();
+ private final SyncMatrices4f16 pmvMatrix02 = new SyncMatrices4f16( new Matrix4f[] { matP, matMv } );
private final GLUniformData gcu_PMVMatrix02;
private ShaderProgram spPass2 = null;
@@ -110,10 +114,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
colorTexBBox = null;
gcu_ColorTexBBox = null;
}
-
- FloatUtil.makeIdentity(pmvMatrix02, 0);
- FloatUtil.makeIdentity(pmvMatrix02, 16);
- gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix02, 4, 4, FloatBuffer.wrap(pmvMatrix02));
+ gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix02, 4, 4, pmvMatrix02);
// Pass 2:
gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, pass2TexUnit);
@@ -382,11 +383,8 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
}
private final AABBox drawWinBox = new AABBox();
- private final int[] drawView = new int[] { 0, 0, 0, 0 };
- private final float[] drawVec4Tmp0 = new float[4];
- private final float[] drawVec4Tmp1 = new float[4];
- private final float[] drawVec4Tmp2 = new float[4];
- private final float[] drawMat4PMv = new float[16];
+ private final Recti drawView = new Recti();
+ private final Matrix4f drawMat4PMv = new Matrix4f();
private static final int border = 2; // surrounding border, i.e. width += 2*border, height +=2*border
@@ -426,12 +424,11 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
// Calculate perspective pixel width/height for FBO,
// considering the sampleCount.
- drawView[2] = vpWidth;
- drawView[3] = vpHeight;
+ drawView.setWidth(vpWidth);
+ drawView.setHeight(vpHeight);
- renderer.getMatrix().multPMvMatrixf(drawMat4PMv, 0);
- box.mapToWindow(drawWinBox, drawMat4PMv, drawView, true /* useCenterZ */,
- drawVec4Tmp0, drawVec4Tmp1, drawVec4Tmp2);
+ renderer.getMatrix().mulPMvMat(drawMat4PMv);
+ box.mapToWindow(drawWinBox, drawMat4PMv, drawView, true /* useCenterZ */);
winWidth = drawWinBox.getWidth();
winHeight = drawWinBox.getHeight();
@@ -459,8 +456,8 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
System.err.printf("XXX.MinMax obj d[%.3f, %.3f], r[%f, %f], b[%f, %f]%n",
diffObjWidth, diffObjHeight, ratioObjWinWidth, ratioObjWinWidth, diffObjBorderWidth, diffObjBorderHeight);
System.err.printf("XXX.MinMax win %s%n", drawWinBox.toString());
- System.err.printf("XXX.MinMax view[%d, %d] -> win[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f]: FBO i[%d x %d], samples %d%n",
- drawView[2], drawView[3],
+ System.err.printf("XXX.MinMax view[%s] -> win[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f]: FBO i[%d x %d], samples %d%n",
+ drawView, drawView,
winWidth, winHeight, targetWinWidth, targetWinHeight, diffWinWidth,
diffWinHeight, ratioWinWidth, ratioWinHeight,
targetFboWidth, targetFboHeight,
@@ -496,7 +493,7 @@ public final class VBORegion2PMSAAES2 extends GLRegion {
fb.position(12);
}
gca_FboVerticesAttr.seal(true);
- FloatUtil.makeOrtho(pmvMatrix02, 0, true, minX, maxX, minY, maxY, -1, 1);
+ matP.setToOrtho(minX, maxX, minY, maxY, -1, 1);
useShaderProgram(gl, renderer, curRenderModes, true, getQuality(), sampleCount[0]);
renderRegion2FBO(gl, rs, curRenderModes, targetFboWidth, targetFboHeight, vpWidth, vpHeight, sampleCount);
} else if( isStateDirty() ) {
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 55f31a161..844ba5e38 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -50,9 +50,11 @@ import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.FBObject.Attachment;
import com.jogamp.opengl.FBObject.TextureAttachment;
import com.jogamp.opengl.math.FloatUtil;
+import com.jogamp.opengl.math.Matrix4f;
+import com.jogamp.opengl.math.Recti;
import com.jogamp.opengl.math.geom.AABBox;
-import com.jogamp.opengl.util.GLArrayDataClient;
import com.jogamp.opengl.util.GLArrayDataServer;
+import com.jogamp.opengl.util.SyncMatrices4f16;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureCoords;
@@ -112,7 +114,9 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
private GLArrayDataServer indicesFbo;
private final GLUniformData gcu_FboTexUnit;
private final GLUniformData gcu_FboTexSize;
- private final float[] pmvMatrix02 = new float[2*16]; // P + Mv
+ private final Matrix4f matP = new Matrix4f();
+ private final Matrix4f matMv = new Matrix4f();
+ private final SyncMatrices4f16 pmvMatrix02 = new SyncMatrices4f16( new Matrix4f[] { matP, matMv } );
private final GLUniformData gcu_PMVMatrix02;
private ShaderProgram spPass2 = null;
@@ -203,10 +207,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
colorTexBBox = null;
gcu_ColorTexBBox = null;
}
-
- FloatUtil.makeIdentity(pmvMatrix02, 0);
- FloatUtil.makeIdentity(pmvMatrix02, 16);
- gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix02, 4, 4, FloatBuffer.wrap(pmvMatrix02));
+ gcu_PMVMatrix02 = new GLUniformData(UniformNames.gcu_PMVMatrix02, 4, 4, pmvMatrix02);
// Pass 2:
gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, pass2TexUnit);
@@ -444,11 +445,9 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
}
private final AABBox drawWinBox = new AABBox();
- private final int[] drawView = new int[] { 0, 0, 0, 0 };
- private final float[] drawVec4Tmp0 = new float[4];
- private final float[] drawVec4Tmp1 = new float[4];
- private final float[] drawVec4Tmp2 = new float[4];
- private final float[] drawMat4PMv = new float[16];
+ private final Recti drawView = new Recti();
+ private final Matrix4f drawMat4PMv = new Matrix4f();
+
private static final int border = 2; // surrounding border, i.e. width += 2*border, height +=2*border
@Override
@@ -487,12 +486,11 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
// Calculate perspective pixel width/height for FBO,
// considering the sampleCount.
- drawView[2] = vpWidth;
- drawView[3] = vpHeight;
+ drawView.setWidth(vpWidth);
+ drawView.setHeight(vpHeight);
- renderer.getMatrix().multPMvMatrixf(drawMat4PMv, 0);
- box.mapToWindow(drawWinBox, drawMat4PMv, drawView, true /* useCenterZ */,
- drawVec4Tmp0, drawVec4Tmp1, drawVec4Tmp2);
+ renderer.getMatrix().mulPMvMat(drawMat4PMv);
+ box.mapToWindow(drawWinBox, drawMat4PMv, drawView, true /* useCenterZ */);
winWidth = drawWinBox.getWidth();
winHeight = drawWinBox.getHeight();
@@ -529,8 +527,8 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
System.err.printf("XXX.MinMax obj d[%.3f, %.3f], r[%f, %f], b[%f, %f]%n",
diffObjWidth, diffObjHeight, ratioObjWinWidth, ratioObjWinWidth, diffObjBorderWidth, diffObjBorderHeight);
System.err.printf("XXX.MinMax win %s%n", drawWinBox.toString());
- System.err.printf("XXX.MinMax view[%d, %d] -> win[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f]: FBO f[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f], samples %d%n",
- drawView[2], drawView[3],
+ System.err.printf("XXX.MinMax view[%s] -> win[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f]: FBO f[%.3f, %.3f], i[%d x %d], d[%.3f, %.3f], r[%f, %f], samples %d%n",
+ drawView,
winWidth, winHeight, targetWinWidth, targetWinHeight, diffWinWidth,
diffWinHeight, ratioWinWidth, ratioWinHeight,
renderFboWidth, renderFboHeight, targetFboWidth, targetFboHeight,
@@ -632,7 +630,7 @@ public final class VBORegion2PVBAAES2 extends GLRegion {
fb.position(12);
}
gca_FboVerticesAttr.seal(true);
- FloatUtil.makeOrtho(pmvMatrix02, 0, true, minX, maxX, minY, maxY, -1, 1);
+ matP.setToOrtho(minX, maxX, minY, maxY, -1, 1);
useShaderProgram(gl, renderer, curRenderModes, true, getQuality(), sampleCount[0]);
renderRegion2FBO(gl, rs, curRenderModes, targetFboWidth, targetFboHeight, newFboWidth, newFboHeight, vpWidth, vpHeight, sampleCount[0]);
} else if( isStateDirty() ) {
diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
index 3fcc75f3d..cc4640534 100644
--- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java
+++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
@@ -618,7 +618,7 @@ public class ProjectFloat {
final float x, final float y,
final float deltaX, final float deltaY,
final int[] viewport, final int viewport_offset) {
- if( null != FloatUtil.makePick(mat4Tmp1, 0, x, y, deltaX, deltaY, viewport, viewport_offset, mat4Tmp2) ) {
+ if( null != FloatUtil.makePick(mat4Tmp1, x, y, deltaX, deltaY, viewport, viewport_offset, mat4Tmp2) ) {
gl.glMultMatrixf(mat4Tmp1, 0);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index c671a743b..20a433aa9 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -204,7 +204,7 @@ public class MacOSXCGLContext extends GLContextImpl
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
- final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
+ final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.getSyncPMvMat()); // P, Mv
pmvMatrixUniform.setLocation(gl, sp.program());
gl.glUniform(pmvMatrixUniform);
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
index 66c5c855b..72c7c257f 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
@@ -87,7 +87,7 @@ public class GLSLTextureRaster {
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
- pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
+ pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.getSyncPMvMat()); // P, Mv
if( pmvMatrixUniform.setLocation(gl, sp.program()) < 0 ) {
throw new GLException("Couldn't locate "+pmvMatrixUniform+" in shader: "+sp);
}
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
index 5ac1dc7bf..6b7317dd6 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -38,6 +38,7 @@ import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GL2ES1;
import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
import com.jogamp.opengl.GL2GL3;
import com.jogamp.opengl.GLArrayData;
import com.jogamp.opengl.GLES2;
@@ -54,6 +55,7 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IntIntHashMap;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.opengl.util.SyncBuffer;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
@@ -714,7 +716,7 @@ public class FixedFuncPipeline {
return;
}
validate(gl, true);
- if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) {
+ if ( GL2ES3.GL_QUADS == mode && !gl.isGL2() ) {
for (int j = first; j < count - 3; j += 4) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, j, 4);
}
@@ -724,7 +726,7 @@ public class FixedFuncPipeline {
}
public void glDrawElements(final GL2ES2 gl, final int mode, final int count, final int type, final java.nio.Buffer indices) {
validate(gl, true);
- if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) {
+ if ( GL2ES3.GL_QUADS == mode && !gl.isGL2() ) {
final int idx0 = indices.position();
if( GL.GL_UNSIGNED_BYTE == type ) {
@@ -758,7 +760,7 @@ public class FixedFuncPipeline {
}
public void glDrawElements(final GL2ES2 gl, final int mode, final int count, final int type, final long indices_buffer_offset) {
validate(gl, true);
- if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) {
+ if ( GL2ES3.GL_QUADS == mode && !gl.isGL2() ) {
throw new GLException("Cannot handle indexed QUADS on !GL2 w/ VBO due to lack of CPU index access");
} else /* if( GL.GL_POINTS != mode ) */ {
gl.glDrawElements(mode, count, type, indices_buffer_offset);
@@ -814,12 +816,12 @@ public class FixedFuncPipeline {
if( pmvMatrix.update() ) {
ud = shaderState.getUniform(mgl_PMVMatrix);
if(null!=ud) {
- final FloatBuffer m;
+ final SyncBuffer m;
if(ShaderSelectionMode.COLOR_TEXTURE8_LIGHT_PER_VERTEX == currentShaderSelectionMode ||
ShaderSelectionMode.COLOR_LIGHT_PER_VERTEX== currentShaderSelectionMode ) {
- m = pmvMatrix.glGetPMvMvitMatrixf();
+ m = pmvMatrix.getSyncPMvMvitMat();
} else {
- m = pmvMatrix.glGetPMvMatrixf();
+ m = pmvMatrix.getSyncPMvMat();
}
if(m != ud.getBuffer()) {
ud.setData(m);
@@ -1111,7 +1113,7 @@ public class FixedFuncPipeline {
shaderState.attachShaderProgram(gl, selectShaderProgram(gl, requestedShaderSelectionMode), true);
// mandatory ..
- if(!shaderState.uniform(gl, new GLUniformData(mgl_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMvitMatrixf()))) {
+ if(!shaderState.uniform(gl, new GLUniformData(mgl_PMVMatrix, 4, 4, pmvMatrix.getSyncPMvMvitMat()))) {
throw new GLException("Error setting PMVMatrix in shader: "+this);
}