aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp')
-rwxr-xr-xsrc/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java57
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java34
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java13
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphString.java5
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java122
7 files changed, 125 insertions, 118 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 4dcc4560e..0b47606e4 100755
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -62,13 +62,13 @@ public class RegionRendererImpl01 extends RegionRenderer {
sp.init(gl);
st.attachShaderProgram(gl, sp);
- st.glBindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
- st.glBindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
+ st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
+ st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
if(!sp.link(gl, System.err)) {
throw new GLException("RegionRenderer: Couldn't link program: "+sp);
}
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
if(DEBUG) {
System.err.println("RegionRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
index 4c4a325ae..eef64dab5 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
@@ -29,15 +29,13 @@ package jogamp.graph.curve.opengl;
import java.nio.FloatBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLProfile;
+import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
import jogamp.graph.curve.opengl.shader.UniformNames;
import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.VersionUtil;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.PMVMatrix;
@@ -45,22 +43,22 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class RenderStateImpl implements RenderState {
- public final ShaderState st;
- public final Vertex.Factory<? extends Vertex> pointFactory;
- public final PMVMatrix pmvMatrix;
- public final GLUniformData mgl_PMVMatrix;
+ private final ShaderState st;
+ private final Vertex.Factory<? extends Vertex> pointFactory;
+ private final PMVMatrix pmvMatrix;
+ private final GLUniformData gcu_PMVMatrix;
/**
* Sharpness is equivalent to the texture-coord component <i>t</i>
* on the off-curve vertex. Higher values of sharpness will
* result in higher curvature.
*/
- public final GLUniformData mgl_sharpness;
- public final GLUniformData mgl_alpha;
- public final GLUniformData mgl_colorStatic;
- public final GLUniformData mgl_strength;
+ private final GLUniformData gcu_Sharpness;
+ private final GLUniformData gcu_Alpha;
+ private final GLUniformData gcu_ColorStatic;
+ private final GLUniformData gcu_Strength;
- public static final RenderState getRenderState(GL gl) {
+ public static final RenderState getRenderState(GL2ES2 gl) {
return (RenderState) gl.getContext().getAttachedObject(RenderState.class.getName());
}
@@ -68,12 +66,17 @@ public class RenderStateImpl implements RenderState {
this.st = st;
this.pointFactory = pointFactory;
this.pmvMatrix = pmvMatrix;
- this.mgl_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMatrixf());
+ this.gcu_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMatrixf());
+ st.ownUniform(gcu_PMVMatrix);
- mgl_sharpness = new GLUniformData(UniformNames.gcu_P1Y, 0.5f);
- mgl_alpha = new GLUniformData(UniformNames.gcu_Alpha, 1.0f);
- mgl_colorStatic = new GLUniformData(UniformNames.gcu_ColorStatic, 3, FloatBuffer.allocate(3));
- mgl_strength = new GLUniformData(UniformNames.gcu_Strength, 3.0f);
+ gcu_Sharpness = new GLUniformData(UniformNames.gcu_P1Y, 0.5f);
+ st.ownUniform(gcu_PMVMatrix);
+ gcu_Alpha = new GLUniformData(UniformNames.gcu_Alpha, 1.0f);
+ st.ownUniform(gcu_Alpha);
+ gcu_ColorStatic = new GLUniformData(UniformNames.gcu_ColorStatic, 3, FloatBuffer.allocate(3));
+ st.ownUniform(gcu_ColorStatic);
+ gcu_Strength = new GLUniformData(UniformNames.gcu_Strength, 3.0f);
+ st.ownUniform(gcu_Strength);
}
public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) {
@@ -89,17 +92,21 @@ public class RenderStateImpl implements RenderState {
public final ShaderState getShaderState() { return st; }
public final Vertex.Factory<? extends Vertex> getPointFactory () { return pointFactory; }
- public final PMVMatrix getPMVMatrix() { return pmvMatrix; }
- public final GLUniformData getPMVMatrixUniform() { return mgl_PMVMatrix; }
- public final GLUniformData getSharpness() { return mgl_sharpness; }
- public final GLUniformData getAlpha() { return mgl_alpha; }
- public final GLUniformData getColorStatic() { return mgl_colorStatic; }
- public final GLUniformData getStrength() { return mgl_strength; }
+ public final PMVMatrix pmvMatrix() { return pmvMatrix; }
+ public final GLUniformData getPMVMatrix() { return gcu_PMVMatrix; }
+ public final GLUniformData getSharpness() { return gcu_Sharpness; }
+ public final GLUniformData getAlpha() { return gcu_Alpha; }
+ public final GLUniformData getColorStatic() { return gcu_ColorStatic; }
+ public final GLUniformData getStrength() { return gcu_Strength; }
- public final RenderState attachTo(GL gl) {
+ public void destroy(GL2ES2 gl) {
+ st.destroy(gl);
+ }
+
+ public final RenderState attachTo(GL2ES2 gl) {
return (RenderState) gl.getContext().attachObject(RenderState.class.getName(), this);
}
- public final boolean detachFrom(GL gl) {
+ public final boolean detachFrom(GL2ES2 gl) {
RenderState _rs = (RenderState) gl.getContext().getAttachedObject(RenderState.class.getName());
if(_rs == this) {
gl.getContext().detachObject(RenderState.class.getName());
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 3bddaed3b..2255251a7 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -64,13 +64,13 @@ public class TextRendererImpl01 extends TextRenderer {
sp.init(gl);
st.attachShaderProgram(gl, sp);
- st.glBindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
- st.glBindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
+ st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
+ st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
if(!sp.link(gl, System.err)) {
throw new GLException("TextRendererImpl01: Couldn't link program: "+sp);
}
- st.glUseProgram(gl, true);
+ st.useProgram(gl, true);
if(DEBUG) {
System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 181ce77b0..90b3d47cd 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -93,7 +93,7 @@ public class VBORegion2PES2 implements Region {
texCoordFboAttr = GLArrayDataServer.createGLSL(st, AttributeNames.TEXCOORD_ATTR_NAME, 2,
GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
- st.bindAttribute(texCoordFboAttr);
+ st.ownAttribute(texCoordFboAttr, true);
texCoordFboAttr.putf(5); texCoordFboAttr.putf(5);
texCoordFboAttr.putf(5); texCoordFboAttr.putf(6);
texCoordFboAttr.putf(6); texCoordFboAttr.putf(6);
@@ -102,7 +102,7 @@ public class VBORegion2PES2 implements Region {
verticeFboAttr = GLArrayDataServer.createGLSL(st, AttributeNames.VERTEX_ATTR_NAME, 3,
GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
- st.bindAttribute(verticeFboAttr);
+ st.ownAttribute(verticeFboAttr, true);
box = new AABBox();
@@ -111,11 +111,11 @@ public class VBORegion2PES2 implements Region {
verticeTxtAttr = GLArrayDataServer.createGLSL(st, AttributeNames.VERTEX_ATTR_NAME, 3,
GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
- st.bindAttribute(verticeTxtAttr);
+ st.ownAttribute(verticeTxtAttr, true);
texCoordTxtAttr = GLArrayDataServer.createGLSL(st, AttributeNames.TEXCOORD_ATTR_NAME, 2,
GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
- st.bindAttribute(texCoordTxtAttr);
+ st.ownAttribute(texCoordTxtAttr, true);
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Create: " + this);
@@ -232,7 +232,7 @@ public class VBORegion2PES2 implements Region {
gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, currentActiveTextureEngine, 0);
*/
gl.glActiveTexture(activeTexture);
- st.glUniform(gl, mgl_ActiveTexture);
+ st.uniform(gl, mgl_ActiveTexture);
fbo.use(gl);
verticeFboAttr.enableBuffer(gl, true);
@@ -275,14 +275,14 @@ public class VBORegion2PES2 implements Region {
//render texture
gl.glViewport(0, 0, tex_width_c, tex_height_c);
- st.glUniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix
+ st.uniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
renderRegion(gl);
fbo.unbind(gl);
- st.glUniform(gl, rs.getPMVMatrixUniform()); // switch back to real PMV matrix
+ st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix
}
private void renderRegion(GL2ES2 gl) {
@@ -316,28 +316,22 @@ public class VBORegion2PES2 implements Region {
return dirty;
}
- public void destroy(GL2ES2 gl) {
+ public void destroy(GL2ES2 gl, RenderState rs) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Destroy: " + this);
}
- destroyFbo(gl);
- destroyTxtAttr(gl);
- destroyFboAttr(gl);
- triangles.clear();
- vertices.clear();
- }
- final void destroyFbo(GL2ES2 gl) {
+ final ShaderState st = rs.getShaderState();
if(null != fbo) {
fbo.destroy(gl);
fbo = null;
}
- }
- final void destroyTxtAttr(GL2ES2 gl) {
if(null != verticeTxtAttr) {
+ st.ownAttribute(verticeTxtAttr, false);
verticeTxtAttr.destroy(gl);
verticeTxtAttr = null;
}
if(null != texCoordTxtAttr) {
+ st.ownAttribute(texCoordTxtAttr, false);
texCoordTxtAttr.destroy(gl);
texCoordTxtAttr = null;
}
@@ -345,13 +339,13 @@ public class VBORegion2PES2 implements Region {
indicesTxt.destroy(gl);
indicesTxt = null;
}
- }
- final void destroyFboAttr(GL2ES2 gl) {
if(null != verticeFboAttr) {
+ st.ownAttribute(verticeFboAttr, false);
verticeFboAttr.destroy(gl);
verticeFboAttr = null;
}
if(null != texCoordFboAttr) {
+ st.ownAttribute(texCoordFboAttr, false);
texCoordFboAttr.destroy(gl);
texCoordFboAttr = null;
}
@@ -359,6 +353,8 @@ public class VBORegion2PES2 implements Region {
indicesFbo.destroy(gl);
indicesFbo = null;
}
+ triangles.clear();
+ vertices.clear();
}
public boolean isFlipped() {
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 1b295de16..7956e5137 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -62,15 +62,15 @@ public class VBORegionSPES2 implements Region {
final int initialSize = 256;
final ShaderState st = rs.getShaderState();
- indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialSize, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+ indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialSize, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
verticeAttr = GLArrayDataServer.createGLSL(st, AttributeNames.VERTEX_ATTR_NAME, 3,
- GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
- st.bindAttribute(verticeAttr);
+ GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
+ st.ownAttribute(verticeAttr, true);
texCoordAttr = GLArrayDataServer.createGLSL(st, AttributeNames.TEXCOORD_ATTR_NAME, 2,
GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
- st.bindAttribute(texCoordAttr);
+ st.ownAttribute(texCoordAttr, true);
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Create: " + this);
@@ -187,15 +187,18 @@ public class VBORegionSPES2 implements Region {
return dirty;
}
- public final void destroy(GL2ES2 gl) {
+ public final void destroy(GL2ES2 gl, RenderState rs) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Destroy: " + this);
}
+ final ShaderState st = rs.getShaderState();
if(null != verticeAttr) {
+ st.ownAttribute(verticeAttr, false);
verticeAttr.destroy(gl);
verticeAttr = null;
}
if(null != texCoordAttr) {
+ st.ownAttribute(texCoordAttr, false);
texCoordAttr.destroy(gl);
texCoordAttr = null;
}
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
index 8f7dcf30a..1faee87ff 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
@@ -155,9 +155,10 @@ public class GlyphString {
}
/** Destroy the associated OGL objects
+ * @param rs TODO
*/
- public void destroy(GL2ES2 gl){
- region.destroy(gl);
+ public void destroy(GL2ES2 gl, RenderState rs){
+ region.destroy(gl, rs);
}
public AABBox getBounds(){
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 b77cf4617..fadce2b4d 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -83,9 +83,9 @@ public class FixedFuncPipeline {
}
public void glEnableClientState(GL2ES2 gl, int glArrayIndex) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
- shaderState.glEnableVertexAttribArray(gl, getArrayIndexName(glArrayIndex));
+ shaderState.enableVertexAttribArray(gl, getArrayIndexName(glArrayIndex));
// textureCoordsEnabled |= (1 << activeTextureUnit);
if ( textureCoordsEnabled.get(activeTextureUnit) != 1 ) {
textureCoordsEnabled.put(activeTextureUnit, 1);
@@ -94,9 +94,9 @@ public class FixedFuncPipeline {
}
public void glDisableClientState(GL2ES2 gl, int glArrayIndex) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
- shaderState.glDisableVertexAttribArray(gl, getArrayIndexName(glArrayIndex));
+ shaderState.disableVertexAttribArray(gl, getArrayIndexName(glArrayIndex));
// textureCoordsEnabled &= ~(1 << activeTextureUnit);
if ( textureCoordsEnabled.get(activeTextureUnit) != 0 ) {
textureCoordsEnabled.put(activeTextureUnit, 0);
@@ -105,37 +105,37 @@ public class FixedFuncPipeline {
}
public void glVertexPointer(GL2ES2 gl, GLArrayData data) {
- shaderState.glUseProgram(gl, true);
- shaderState.glVertexAttribPointer(gl, data);
+ shaderState.useProgram(gl, true);
+ shaderState.vertexAttribPointer(gl, data);
}
public void glColorPointer(GL2ES2 gl, GLArrayData data) {
- shaderState.glUseProgram(gl, true);
- shaderState.glVertexAttribPointer(gl, data);
+ shaderState.useProgram(gl, true);
+ shaderState.vertexAttribPointer(gl, data);
}
public void glColor4fv(GL2ES2 gl, FloatBuffer data ) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
GLUniformData ud = shaderState.getUniform(mgl_ColorStatic);
if(null!=ud) {
ud.setData(data);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
}
public void glNormalPointer(GL2ES2 gl, GLArrayData data) {
- shaderState.glUseProgram(gl, true);
- shaderState.glVertexAttribPointer(gl, data);
+ shaderState.useProgram(gl, true);
+ shaderState.vertexAttribPointer(gl, data);
}
public void glTexCoordPointer(GL2ES2 gl, GLArrayData data) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
data.setName( getArrayIndexName(data.getIndex()) );
- shaderState.glVertexAttribPointer(gl, data);
+ shaderState.vertexAttribPointer(gl, data);
}
public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
light -=GLLightingFunc.GL_LIGHT0;
if(0 <= light && light < MAX_LIGHTS) {
GLUniformData ud = null;
@@ -178,7 +178,7 @@ public class FixedFuncPipeline {
}
if(null!=ud) {
ud.setData(params);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
} else if(verbose) {
System.err.println("glLightfv light not within [0.."+MAX_LIGHTS+"]: "+light);
@@ -186,7 +186,7 @@ public class FixedFuncPipeline {
}
public void glMaterialfv(GL2ES2 gl, int face, int pname, java.nio.FloatBuffer params) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
switch (face) {
case GL.GL_FRONT:
@@ -228,33 +228,33 @@ public class FixedFuncPipeline {
}
if(null!=ud) {
ud.setData(params);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
}
public void glShadeModel(GL2ES2 gl, int mode) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
GLUniformData ud = shaderState.getUniform(mgl_ShadeModel);
if(null!=ud) {
ud.setData(mode);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
}
public void glActiveTexture(GL2ES2 gl, int textureUnit) {
textureUnit -= GL.GL_TEXTURE0;
if(0 <= textureUnit && textureUnit<MAX_TEXTURE_UNITS) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
GLUniformData ud;
ud = shaderState.getUniform(mgl_ActiveTexture);
if(null!=ud) {
ud.setData(textureUnit);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
ud = shaderState.getUniform(mgl_ActiveTextureIdx);
if(null!=ud) {
ud.setData(textureUnit);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
activeTextureUnit = textureUnit;
} else {
@@ -310,20 +310,20 @@ public class FixedFuncPipeline {
}
public void validate(GL2ES2 gl) {
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
GLUniformData ud;
if(pmvMatrix.update()) {
ud = shaderState.getUniform(mgl_PMVMatrix);
if(null!=ud) {
// same data object ..
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
} else {
- throw new GLException("Failed to update: mgl_PMVMatrix");
+ throw new GLException("Failed to update: gcu_PMVMatrix");
}
ud = shaderState.getUniform(mgl_NormalMatrix);
if(null!=ud) {
// same data object ..
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
}
ud = shaderState.getUniform(mgl_ColorEnabled);
@@ -331,14 +331,14 @@ public class FixedFuncPipeline {
int ca = (shaderState.isVertexAttribArrayEnabled(mgl_Color)==true)?1:0;
if(ca!=ud.intValue()) {
ud.setData(ca);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
}
ud = shaderState.getUniform(mgl_CullFace);
if(null!=ud) {
if(cullFace!=ud.intValue()) {
ud.setData(cullFace);
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
}
@@ -346,7 +346,7 @@ public class FixedFuncPipeline {
ud = shaderState.getUniform(mgl_LightsEnabled);
if(null!=ud) {
// same data object
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
lightsEnabledDirty=false;
}
@@ -355,7 +355,7 @@ public class FixedFuncPipeline {
ud = shaderState.getUniform(mgl_TexCoordEnabled);
if(null!=ud) {
// same data object
- shaderState.glUniform(gl, ud);
+ shaderState.uniform(gl, ud);
}
textureCoordsEnabledDirty=false;
}
@@ -447,43 +447,43 @@ public class FixedFuncPipeline {
}
shaderState.attachShaderProgram(gl, shaderProgramColor);
- shaderState.glUseProgram(gl, true);
+ shaderState.useProgram(gl, true);
// mandatory ..
- if(!shaderState.glUniform(gl, new GLUniformData(mgl_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMviMatrixf()))) {
+ if(!shaderState.uniform(gl, new GLUniformData(mgl_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMviMatrixf()))) {
throw new GLException("Error setting PMVMatrix in shader: "+this);
}
// optional parameter ..
- shaderState.glUniform(gl, new GLUniformData(mgl_NormalMatrix, 3, 3, pmvMatrix.glGetNormalMatrixf()));
-
- shaderState.glUniform(gl, new GLUniformData(mgl_ColorEnabled, 0));
- shaderState.glUniform(gl, new GLUniformData(mgl_ColorStatic, 4, zero4f));
- shaderState.glUniform(gl, new GLUniformData(mgl_TexCoordEnabled, 1, textureCoordsEnabled));
- shaderState.glUniform(gl, new GLUniformData(mgl_ActiveTexture, activeTextureUnit));
- shaderState.glUniform(gl, new GLUniformData(mgl_ActiveTextureIdx, activeTextureUnit));
- shaderState.glUniform(gl, new GLUniformData(mgl_ShadeModel, 0));
- shaderState.glUniform(gl, new GLUniformData(mgl_CullFace, cullFace));
+ shaderState.uniform(gl, new GLUniformData(mgl_NormalMatrix, 3, 3, pmvMatrix.glGetNormalMatrixf()));
+
+ shaderState.uniform(gl, new GLUniformData(mgl_ColorEnabled, 0));
+ shaderState.uniform(gl, new GLUniformData(mgl_ColorStatic, 4, zero4f));
+ shaderState.uniform(gl, new GLUniformData(mgl_TexCoordEnabled, 1, textureCoordsEnabled));
+ shaderState.uniform(gl, new GLUniformData(mgl_ActiveTexture, activeTextureUnit));
+ shaderState.uniform(gl, new GLUniformData(mgl_ActiveTextureIdx, activeTextureUnit));
+ shaderState.uniform(gl, new GLUniformData(mgl_ShadeModel, 0));
+ shaderState.uniform(gl, new GLUniformData(mgl_CullFace, cullFace));
for(int i=0; i<MAX_LIGHTS; i++) {
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].ambient", 4, defAmbient));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].diffuse", 4, defDiffuse));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].specular", 4, defSpecular));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].position", 4, defPosition));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].spotDirection", 3, defSpotDir));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].spotExponent", defSpotExponent));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].spotCutoff", defSpotCutoff));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].constantAttenuation", defConstantAtten));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].linearAttenuation", defLinearAtten));
- shaderState.glUniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].quadraticAttenuation", defQuadraticAtten));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].ambient", 4, defAmbient));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].diffuse", 4, defDiffuse));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].specular", 4, defSpecular));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].position", 4, defPosition));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].spotDirection", 3, defSpotDir));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].spotExponent", defSpotExponent));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].spotCutoff", defSpotCutoff));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].constantAttenuation", defConstantAtten));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].linearAttenuation", defLinearAtten));
+ shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].quadraticAttenuation", defQuadraticAtten));
}
- shaderState.glUniform(gl, new GLUniformData(mgl_LightsEnabled, 1, lightsEnabled));
- shaderState.glUniform(gl, new GLUniformData(mgl_FrontMaterial+".ambient", 4, defMatAmbient));
- shaderState.glUniform(gl, new GLUniformData(mgl_FrontMaterial+".diffuse", 4, defMatDiffuse));
- shaderState.glUniform(gl, new GLUniformData(mgl_FrontMaterial+".specular", 4, defMatSpecular));
- shaderState.glUniform(gl, new GLUniformData(mgl_FrontMaterial+".emission", 4, defMatEmission));
- shaderState.glUniform(gl, new GLUniformData(mgl_FrontMaterial+".shininess", defMatShininess));
-
- shaderState.glUseProgram(gl, false);
+ shaderState.uniform(gl, new GLUniformData(mgl_LightsEnabled, 1, lightsEnabled));
+ shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".ambient", 4, defMatAmbient));
+ shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".diffuse", 4, defMatDiffuse));
+ shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".specular", 4, defMatSpecular));
+ shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".emission", 4, defMatEmission));
+ shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".shininess", defMatShininess));
+
+ shaderState.useProgram(gl, false);
}
protected static final boolean DEBUG=false;
@@ -508,7 +508,7 @@ public class FixedFuncPipeline {
protected ShaderProgram shaderProgramColorTextureLight;
// uniforms ..
- protected static final String mgl_PMVMatrix = "mgl_PMVMatrix"; // m4fv[3]
+ protected static final String mgl_PMVMatrix = "gcu_PMVMatrix"; // m4fv[3]
protected static final String mgl_NormalMatrix = "mgl_NormalMatrix"; // m4fv
protected static final String mgl_ColorEnabled = "mgl_ColorEnabled"; // 1i
protected static final String mgl_ColorStatic = "mgl_ColorStatic"; // 4fv