aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/glu
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/jogamp/opengl/glu
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/jogamp/opengl/glu')
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
index 62ff3aa09..7cd7da53e 100644
--- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
@@ -120,6 +120,7 @@ import javax.media.opengl.glu.GLU;
import javax.media.opengl.glu.GLUquadric;
import com.jogamp.opengl.util.ImmModeSink;
+import com.jogamp.opengl.util.glsl.ShaderState;
/**
* GLUquadricImpl.java
@@ -140,22 +141,26 @@ public class GLUquadricImpl implements GLUquadric {
private boolean immModeSinkImmediate;
public int normalType;
public GL gl;
+ public ShaderState shaderState;
+ public int shaderProgram;
public static final boolean USE_NORM = true;
public static final boolean USE_TEXT = false;
private ImmModeSink immModeSink=null;
- public GLUquadricImpl(GL gl, boolean useGLSL) {
+ public GLUquadricImpl(GL gl, boolean useGLSL, ShaderState st, int shaderProgram) {
this.gl=gl;
this.useGLSL = useGLSL;
- drawStyle = GLU.GLU_FILL;
- orientation = GLU.GLU_OUTSIDE;
- textureFlag = false;
- normals = GLU.GLU_SMOOTH;
- normalType = gl.isGLES1()?GL.GL_BYTE:GL.GL_FLOAT;
- immModeSinkImmediate=true;
- immModeSinkEnabled=!gl.isGL2();
+ this.drawStyle = GLU.GLU_FILL;
+ this.orientation = GLU.GLU_OUTSIDE;
+ this.textureFlag = false;
+ this.normals = GLU.GLU_SMOOTH;
+ this.normalType = gl.isGLES1()?GL.GL_BYTE:GL.GL_FLOAT;
+ this.immModeSinkImmediate=true;
+ this.immModeSinkEnabled=!gl.isGL2();
+ this.shaderState = st;
+ this.shaderProgram = shaderProgram;
replaceImmModeSink();
}
@@ -191,12 +196,21 @@ public class GLUquadricImpl implements GLUquadric {
ImmModeSink res = immModeSink;
if(useGLSL) {
- immModeSink = ImmModeSink.createGLSL (32,
- 3, GL.GL_FLOAT, // vertex
- 0, GL.GL_FLOAT, // color
- USE_NORM?3:0, normalType, // normal
- USE_TEXT?2:0, GL.GL_FLOAT, // texCoords
- GL.GL_STATIC_DRAW);
+ if(null != shaderState) {
+ immModeSink = ImmModeSink.createGLSL (32,
+ 3, GL.GL_FLOAT, // vertex
+ 0, GL.GL_FLOAT, // color
+ USE_NORM?3:0, normalType, // normal
+ USE_TEXT?2:0, GL.GL_FLOAT, // texCoords
+ GL.GL_STATIC_DRAW, shaderState);
+ } else {
+ immModeSink = ImmModeSink.createGLSL (32,
+ 3, GL.GL_FLOAT, // vertex
+ 0, GL.GL_FLOAT, // color
+ USE_NORM?3:0, normalType, // normal
+ USE_TEXT?2:0, GL.GL_FLOAT, // texCoords
+ GL.GL_STATIC_DRAW, shaderProgram);
+ }
} else {
immModeSink = ImmModeSink.createFixed(32,
3, GL.GL_FLOAT, // vertex