aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/javax/media/opengl/GLUniformData.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-12-16 02:55:07 +0100
committerSven Gothel <[email protected]>2012-12-16 02:55:07 +0100
commitb8a8fc24a3afb0cb06a31504bdea1a98b8f00ef4 (patch)
tree37bd8b49f7e4fd547ff58656dff09b5a88e65c47 /src/jogl/classes/javax/media/opengl/GLUniformData.java
parente7064ece049705e013d80985eae698ce0ee3c4e3 (diff)
GLArrayData/ImmModeSink: Remove implicit dependency on ShaderState - allow operating w/o it; ShaderState: Remove notion of GL context attachment, use pass-through or object association; GLArrayData/GLUniformData: Add basic GLSL location methods
- GLArrayData/GLUniformData: Add basic GLSL location methods - GLArrayData - add: setLocation(..) for attribute location/index retrieval (post link) and binding (pre link) - GLUniformData - add: setLocation(..) for attribute location/index retrieval (post link) - GLArrayData/ImmModeSink: Remove implicit dependency on ShaderState - allow operating w/o it - GLArrayData - add: 'public void associate(Object obj, boolean enable)', allows setting ShaderState usage - ShaderState: Remove notion of GL context attachment, use pass-through or object association - ownsAttribute(..) associates the attribute w/ ShaderState - removed GL context ShaderState attachment Tested: - ImmModeSink w/ GLSL/ES2 w/ and w/o ShaderState - GLArrayData* w/ and w/o ShaderState
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLUniformData.java')
-rw-r--r--src/jogl/classes/javax/media/opengl/GLUniformData.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java
index 18a422670..60d0c58bf 100644
--- a/src/jogl/classes/javax/media/opengl/GLUniformData.java
+++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java
@@ -147,10 +147,26 @@ public class GLUniformData {
public int getLocation() { return location; }
/**
- * Sets the determined location of the shader uniform.
+ * Sets the given location of the shader uniform.
+ * @return the given location
*/
- public GLUniformData setLocation(int location) { this.location=location; return this; }
+ public int setLocation(int location) { this.location=location; return location; }
+ /**
+ * Retrieves the location of the shader uniform from the linked shader program.
+ * <p>
+ * No validation is performed within the implementation.
+ * </p>
+ * @param gl
+ * @param program
+ * @return &ge;0 denotes a valid uniform location as found and used in the given shader program.
+ * &lt;0 denotes an invalid location, i.e. not found or used in the given shader program.
+ */
+ public int setLocation(GL2ES2 gl, int program) {
+ location = gl.glGetUniformLocation(program, name);
+ return location;
+ }
+
public Object getObject() {
return data;
}