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.java167
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java133
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java172
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java609
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java326
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java18
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java10
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl13
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl10
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp172
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp24
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl14
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl21
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl13
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java80
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java160
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/HEdge.java190
-rw-r--r--src/jogl/classes/jogamp/graph/curve/tess/Loop.java668
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java230
-rw-r--r--src/jogl/classes/jogamp/graph/curve/text/GlyphString.java228
-rw-r--r--src/jogl/classes/jogamp/graph/font/JavaFontLoader.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java12
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java142
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java38
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java30
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java148
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java4
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java6
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java48
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java38
-rw-r--r--src/jogl/classes/jogamp/graph/geom/plane/Path2D.java6
-rw-r--r--src/jogl/classes/jogamp/graph/math/plane/Crossing.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/FPSCounterImpl.java137
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java178
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextLock.java157
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java266
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java58
-rw-r--r--src/jogl/classes/jogamp/opengl/GLPbufferImpl.java15
-rw-r--r--src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java79
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt110
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java52
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java50
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java30
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java20
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java28
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java122
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java29
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java30
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java46
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java33
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java2
85 files changed, 2976 insertions, 2480 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 9208afc24..0b47606e4 100755
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -27,53 +27,29 @@
*/
package jogamp.graph.curve.opengl;
-import java.nio.FloatBuffer;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLException;
-import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+
+import jogamp.graph.curve.opengl.shader.AttributeNames;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.RegionRenderer;
-import com.jogamp.graph.geom.Vertex;
+import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
-
public class RegionRendererImpl01 extends RegionRenderer {
- /**Sharpness is equivalent to the value of t value of texture coord
- * on the off-curve vertex. The high value of sharpness will
- * result in high curvature.
- */
- private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
- GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
- private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
- private GLUniformData mgl_strength = new GLUniformData("a_strength", 3.0f);
-
- public RegionRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) {
- super(factory, type);
+ public RegionRendererImpl01(RenderState rs, int type) {
+ super(rs, type);
+ // rs.getSharpness().setData(0.5f);
+ // rs.getAlpha().setData(1.0f);
+ // rs.getStrength().setData(3.0f);
}
- protected boolean initImpl(GL2ES2 gl) {
- boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") &&
- gl.isFunctionAvailable("glBindBuffer") &&
- gl.isFunctionAvailable("glBufferData") &&
- gl.isFunctionAvailable("glDrawElements") &&
- gl.isFunctionAvailable("glVertexAttribPointer") &&
- gl.isFunctionAvailable("glDeleteBuffers");
-
- if(DEBUG) {
- System.err.println("RegionRenderer: VBO Supported = " + VBOsupported);
- }
-
- if(!VBOsupported){
- return false;
- }
-
- gl.glEnable(GL2ES2.GL_BLEND);
- gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
+ protected boolean initShaderProgram(GL2ES2 gl) {
+ final ShaderState st = rs.getShaderState();
ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, RegionRendererImpl01.class,
"shader", "shader/bin", "curverenderer01");
@@ -85,60 +61,15 @@ public class RegionRendererImpl01 extends RegionRenderer {
sp.add(rsFp);
sp.init(gl);
- gl.glBindAttribLocation(sp.program(), Region.VERTEX_ATTR_IDX, "v_position");
- gl.glBindAttribLocation(sp.program(), Region.TEXCOORD_ATTR_IDX, "texCoord");
+ st.attachShaderProgram(gl, sp);
+ 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 = new ShaderState();
- st.attachShaderProgram(gl, sp);
-
- st.glUseProgram(gl, true);
-
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
-
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- resetModelview(null);
+ }
+ st.useProgram(gl, true);
- mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
- if(!st.glUniform(gl, mgl_PMVMatrix)) {
- if(DEBUG){
- System.err.println("Error setting PMVMatrix in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_sharpness)) {
- if(DEBUG){
- System.err.println("Error setting sharpness in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_alpha)) {
- if(DEBUG){
- System.err.println("Error setting global alpha in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_color)) {
- if(DEBUG){
- System.err.println("Error setting global color in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_strength)) {
- System.err.println("Error setting antialias strength in shader: "+st);
- }
-
if(DEBUG) {
System.err.println("RegionRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
}
@@ -150,59 +81,35 @@ public class RegionRendererImpl01 extends RegionRenderer {
super.disposeImpl(gl);
}
- @Override
- public float getAlpha() {
- return mgl_alpha.floatValue();
- }
-
- @Override
- public void setAlpha(GL2ES2 gl, float alpha_t) {
- mgl_alpha.setData(alpha_t);
- if(null != gl && st.inUse()) {
- st.glUniform(gl, mgl_alpha);
- }
- }
@Override
- public void setColor(GL2ES2 gl, float r, float g, float b){
- FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer();
- fb.put(0, r);
- fb.put(1, r);
- fb.put(2, r);
- if(null != gl && st.inUse()) {
- st.glUniform(gl, mgl_color);
+ public void renderOutlineShape(GL2ES2 gl, OutlineShape outlineShape, float[] position, int texSize) {
+ if(!isInitialized()){
+ throw new GLException("RegionRendererImpl01: not initialized!");
}
+ int hashCode = getHashCode(outlineShape);
+ Region region = regions.get(hashCode);
+
+ if(null == region) {
+ region = createRegion(gl, outlineShape);
+ regions.put(hashCode, region);
+ }
+ region.render(gl, rs, vp_width, vp_height, texSize);
}
-
- @Override
- public void renderOutlineShape(GL2ES2 gl, OutlineShape outlineShape, float[] position, int texSize) {
- if(!isInitialized()){
- throw new GLException("RegionRendererImpl01: not initialized!");
- }
- int hashCode = getHashCode(outlineShape);
- Region region = regions.get(hashCode);
-
- if(null == region) {
- region = createRegion(gl, outlineShape, mgl_sharpness.floatValue());
- regions.put(hashCode, region);
- }
- region.render(pmvMatrix, vp_width, vp_height, texSize);
- }
-
- @Override
+ @Override
public void renderOutlineShapes(GL2ES2 gl, OutlineShape[] outlineShapes, float[] position, int texSize) {
if(!isInitialized()){
throw new GLException("RegionRendererImpl01: not initialized!");
}
-
- int hashCode = getHashCode(outlineShapes);
- Region region = regions.get(hashCode);
-
- if(null == region) {
- region = createRegion(gl, outlineShapes, mgl_sharpness.floatValue());
- regions.put(hashCode, region);
- }
- region.render(pmvMatrix, vp_width, vp_height, texSize);
- }
+
+ int hashCode = getHashCode(outlineShapes);
+ Region region = regions.get(hashCode);
+
+ if(null == region) {
+ region = createRegion(gl, outlineShapes);
+ regions.put(hashCode, region);
+ }
+ region.render(gl, rs, vp_width, vp_height, texSize);
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
new file mode 100644
index 000000000..eef64dab5
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
@@ -0,0 +1,133 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.graph.curve.opengl;
+
+import java.nio.FloatBuffer;
+
+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.graph.curve.opengl.RenderState;
+import com.jogamp.graph.geom.Vertex;
+import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.opengl.util.glsl.ShaderState;
+
+public class RenderStateImpl implements RenderState {
+
+ 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.
+ */
+ 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(GL2ES2 gl) {
+ return (RenderState) gl.getContext().getAttachedObject(RenderState.class.getName());
+ }
+
+ public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) {
+ this.st = st;
+ this.pointFactory = pointFactory;
+ this.pmvMatrix = pmvMatrix;
+ this.gcu_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMatrixf());
+ st.ownUniform(gcu_PMVMatrix);
+
+ 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) {
+ this(st, pointFactory, new PMVMatrix());
+
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ }
+
+ public final ShaderState getShaderState() { return st; }
+ public final Vertex.Factory<? extends Vertex> getPointFactory () { return pointFactory; }
+ 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 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(GL2ES2 gl) {
+ RenderState _rs = (RenderState) gl.getContext().getAttachedObject(RenderState.class.getName());
+ if(_rs == this) {
+ gl.getContext().detachObject(RenderState.class.getName());
+ return true;
+ }
+ return false;
+ }
+
+ public StringBuilder toString(StringBuilder sb) {
+ if(null==sb) {
+ sb = new StringBuilder();
+ }
+
+ sb.append("RenderState[");
+ st.toString(sb).append(Platform.getNewline());
+ sb.append("]");
+
+ return sb;
+ }
+
+ public String toString() {
+ return toString(null).toString();
+ }
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 01572de58..2255251a7 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -27,166 +27,74 @@
*/
package jogamp.graph.curve.opengl;
-import java.nio.FloatBuffer;
-
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLException;
-import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.text.GlyphString;
-import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.curve.opengl.TextRenderer;
import com.jogamp.graph.font.Font;
-import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
+import com.jogamp.opengl.util.glsl.ShaderState;
public class TextRendererImpl01 extends TextRenderer {
- /**Sharpness is equivalent to the value of t value of texture coord
- * on the off-curve vertex. The high value of sharpness will
- * result in high curvature.
- */
- private GLUniformData mgl_sharpness = new GLUniformData("p1y", 0.5f);
- GLUniformData mgl_alpha = new GLUniformData("g_alpha", 1.0f);
- private GLUniformData mgl_color = new GLUniformData("g_color", 3, FloatBuffer.allocate(3));
- private GLUniformData mgl_strength = new GLUniformData("a_strength", 1.8f);
-
- public TextRendererImpl01(Vertex.Factory<? extends Vertex> factory, int type) {
- super(factory, type);
- }
-
- @Override
- protected boolean initImpl(GL2ES2 gl){
- boolean VBOsupported = gl.isFunctionAvailable("glGenBuffers") &&
- gl.isFunctionAvailable("glBindBuffer") &&
- gl.isFunctionAvailable("glBufferData") &&
- gl.isFunctionAvailable("glDrawElements") &&
- gl.isFunctionAvailable("glVertexAttribPointer") &&
- gl.isFunctionAvailable("glDeleteBuffers");
-
- if(DEBUG) {
- System.err.println("TextRendererImpl01: VBO Supported = " + VBOsupported);
- }
-
- if(!VBOsupported){
- return false;
- }
-
- gl.glEnable(GL2ES2.GL_BLEND);
- gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA);
-
+ public TextRendererImpl01(RenderState rs, int type) {
+ super(rs, type);
+ // rs.getSharpness().setData(0.5f);
+ // rs.getAlpha().setData(1.0f);
+ // rs.getStrength().setData(3.0f);
+ rs.getStrength().setData(1.9f);
+ }
+
+ @Override
+ protected boolean initShaderProgram(GL2ES2 gl){
+ final ShaderState st = rs.getShaderState();
+
ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, TextRendererImpl01.class,
"shader", "shader/bin", "curverenderer01");
ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, TextRendererImpl01.class,
"shader", "shader/bin", "curverenderer01");
-
+
ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
sp.add(rsFp);
sp.init(gl);
- gl.glBindAttribLocation(sp.program(), Region.VERTEX_ATTR_IDX, "v_position");
- gl.glBindAttribLocation(sp.program(), Region.TEXCOORD_ATTR_IDX, "texCoord");
+ st.attachShaderProgram(gl, sp);
+ 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.useProgram(gl, true);
- st.attachShaderProgram(gl, sp);
-
- st.glUseProgram(gl, true);
-
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
-
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- resetModelview(null);
-
- mgl_PMVMatrix = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
- if(!st.glUniform(gl, mgl_PMVMatrix)) {
- if(DEBUG){
- System.err.println("Error setting PMVMatrix in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_sharpness)) {
- if(DEBUG){
- System.err.println("Error setting sharpness in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_alpha)) {
- if(DEBUG){
- System.err.println("Error setting global alpha in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_color)) {
- if(DEBUG){
- System.err.println("Error setting global color in shader: "+st);
- }
- return false;
- }
-
- if(!st.glUniform(gl, mgl_strength)) {
- System.err.println("Error setting antialias strength in shader: "+st);
- }
-
- if(DEBUG) {
- System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
- }
- return true;
- }
-
- @Override
- protected void disposeImpl(GL2ES2 gl) {
- super.disposeImpl(gl);
- }
-
+ if(DEBUG) {
+ System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
+ }
+ return true;
+ }
+
@Override
- public float getAlpha() {
- return mgl_alpha.floatValue();
+ protected void disposeImpl(GL2ES2 gl) {
+ super.disposeImpl(gl);
}
-
+
@Override
- public void setAlpha(GL2ES2 gl, float alpha_t) {
- mgl_alpha.setData(alpha_t);
- if(null != gl && st.inUse()) {
- st.glUniform(gl, mgl_alpha);
+ public void renderString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int texSize) {
+ if(!isInitialized()){
+ throw new GLException("TextRendererImpl01: not initialized!");
+ }
+ GlyphString glyphString = getCachedGlyphString(font, str, fontSize);
+ if(null == glyphString) {
+ glyphString = createString(gl, font, fontSize, str);
+ addCachedGlyphString(gl, font, str, fontSize, glyphString);
}
+
+ glyphString.renderString3D(gl, rs, vp_width, vp_height, texSize);
}
-
- @Override
- public void setColor(GL2ES2 gl, float r, float g, float b){
- FloatBuffer fb = (FloatBuffer) mgl_color.getBuffer();
- fb.put(0, r);
- fb.put(1, r);
- fb.put(2, r);
- if(null != gl && st.inUse()) {
- st.glUniform(gl, mgl_color);
- }
- }
-
- @Override
- public void renderString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int texSize) {
- if(!isInitialized()){
- throw new GLException("TextRendererImpl01: not initialized!");
- }
- GlyphString glyphString = getCachedGlyphString(font, str, fontSize);
- if(null == glyphString) {
- glyphString = createString(gl, font, fontSize, str, mgl_sharpness.floatValue());
- addCachedGlyphString(font, str, fontSize, glyphString);
- }
-
- glyphString.renderString3D(pmvMatrix, vp_width, vp_height, texSize);
- }
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 075a65ec9..90b3d47cd 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -27,324 +27,345 @@
*/
package jogamp.graph.curve.opengl;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
import java.util.ArrayList;
import javax.media.opengl.GL2ES2;
// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER !
import javax.media.opengl.GL;
-import javax.media.opengl.GLContext;
import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
-import com.jogamp.common.nio.Buffers;
+import jogamp.graph.curve.opengl.shader.AttributeNames;
+import jogamp.graph.curve.opengl.shader.UniformNames;
import com.jogamp.graph.geom.AABBox;
import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.opengl.util.FBObject;
+import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
-public class VBORegion2PES2 implements Region{
- private int numVertices = 0;
- private IntBuffer vboIds;
-
- private IntBuffer t_vboIds;
-
- private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
- private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- private GLContext context;
-
- private int numBuffers = 3;
-
- private boolean flipped = false;
-
- private boolean dirty = false;
-
- private AABBox box = null;
- private FBObject fbo = null;
+public class VBORegion2PES2 implements Region {
+ private int numVertices = 0;
+
+ private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+ private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+ private GLArrayDataServer verticeTxtAttr;
+ private GLArrayDataServer texCoordTxtAttr;
+ private GLArrayDataServer indicesTxt;
+ private GLArrayDataServer verticeFboAttr;
+ private GLArrayDataServer texCoordFboAttr;
+ private GLArrayDataServer indicesFbo;
+
+ private boolean flipped = false;
+
+ private boolean dirty = true;
+
+ private AABBox box;
+ private FBObject fbo;
- private int tex_width_c = 0;
- private int tex_height_c = 0;
-
- private ShaderState st;
-
- public VBORegion2PES2(GLContext context, ShaderState st){
- this.context =context;
- this.st = st;
- }
-
- public void update(){
- box = new AABBox();
-
- GL2ES2 gl = context.getGL().getGL2ES2();
- ShortBuffer indicies = Buffers.newDirectShortBuffer(triangles.size() * 3);
-
- for(Triangle t:triangles){
- if(t.getVertices()[0].getId() == Integer.MAX_VALUE){
- t.getVertices()[0].setId(numVertices++);
- t.getVertices()[1].setId(numVertices++);
- t.getVertices()[2].setId(numVertices++);
-
- vertices.add(t.getVertices()[0]);
- vertices.add(t.getVertices()[1]);
- vertices.add(t.getVertices()[2]);
-
- indicies.put((short) t.getVertices()[0].getId());
- indicies.put((short) t.getVertices()[1].getId());
- indicies.put((short) t.getVertices()[2].getId());
- }
- else{
- Vertex v1 = t.getVertices()[0];
- Vertex v2 = t.getVertices()[1];
- Vertex v3 = t.getVertices()[2];
-
- indicies.put((short) v1.getId());
- indicies.put((short) v2.getId());
- indicies.put((short) v3.getId());
- }
- }
- indicies.rewind();
-
- FloatBuffer verticesBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 3);
- for(Vertex v:vertices){
- verticesBuffer.put(v.getX());
- if(flipped){
- verticesBuffer.put(-1*v.getY());
- }
- else{
- verticesBuffer.put(v.getY());
- }
- verticesBuffer.put(v.getZ());
- if(flipped){
- box.resize(v.getX(), -1*v.getY(), v.getZ());
- }
- else{
- box.resize(v.getX(), v.getY(), v.getZ());
- }
- }
- verticesBuffer.rewind();
-
- FloatBuffer texCoordBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 2);
- for(Vertex v:vertices){
- float[] tex = v.getTexCoord();
- texCoordBuffer.put(tex[0]);
- texCoordBuffer.put(tex[1]);
- }
- texCoordBuffer.rewind();
-
- vboIds = IntBuffer.allocate(numBuffers);
- gl.glGenBuffers(numBuffers, vboIds);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(0)); // vertices
- gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, numVertices * 3 * Buffers.SIZEOF_FLOAT, verticesBuffer, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(1)); //texture
- gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, numVertices * 2 * Buffers.SIZEOF_FLOAT, texCoordBuffer, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, vboIds.get(2)); //triangles
- gl.glBufferData(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, triangles.size()* 3 * Buffers.SIZEOF_SHORT, indicies, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, 0);
-
- dirty = false;
- }
-
- public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
- if(null == matrix || vp_width <=0 || vp_height <= 0 || width <= 0){
- renderRegion();
- }
- else {
- if(width != tex_width_c){
- initFBOTexture(matrix, width);
- }
-// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
- renderTexture(matrix, vp_width, vp_height);
- }
- }
-
- private void renderTexture(PMVMatrix matrix, int width, int hight){
- GL2ES2 gl = context.getGL().getGL2ES2();
- gl.glViewport(0, 0, width, hight);
- if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, matrix.glGetPMvMatrixf()))){
- System.out.println("Cnt set tex based mat");
- }
- gl.glEnable(GL2ES2.GL_TEXTURE_2D);
- gl.glActiveTexture(GL2ES2.GL_TEXTURE0);
- fbo.use(gl);
-
- st.glUniform(gl, new GLUniformData("texture", fbo.getTextureName()));
- int loc = gl.glGetUniformLocation(st.shaderProgram().program(), "texture");
- gl.glUniform1i(loc, 0);
-
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, t_vboIds.get(0));
- gl.glEnableVertexAttribArray(VERTEX_ATTR_IDX);
- gl.glVertexAttribPointer(VERTEX_ATTR_IDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, t_vboIds.get(1));
- gl.glEnableVertexAttribArray(TEXCOORD_ATTR_IDX);
- gl.glVertexAttribPointer(TEXCOORD_ATTR_IDX, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, t_vboIds.get(2));
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, 2 * 3, GL2ES2.GL_UNSIGNED_SHORT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
- }
-
- private void setupBoundingBuffers(){
- GL2ES2 gl = context.getGL().getGL2ES2();
-
- ShortBuffer indicies = Buffers.newDirectShortBuffer(6);
- indicies.put((short) 0); indicies.put((short) 1); indicies.put((short) 3);
- indicies.put((short) 1); indicies.put((short) 2); indicies.put((short) 3);
- indicies.rewind();
-
- FloatBuffer verticesBuffer = Buffers.newDirectFloatBuffer(4 * 3);
- FloatBuffer texCoordBuffer = Buffers.newDirectFloatBuffer(4 * 2);
-
- verticesBuffer.put(box.getLow()[0]);
- verticesBuffer.put(box.getLow()[1]);
- verticesBuffer.put(box.getLow()[2]);
- texCoordBuffer.put(5);
- texCoordBuffer.put(5);
-
- verticesBuffer.put(box.getLow()[0]);
- verticesBuffer.put(box.getHigh()[1]);
- verticesBuffer.put(box.getLow()[2]);
-
- texCoordBuffer.put(5);
- texCoordBuffer.put(6);
-
- verticesBuffer.put(box.getHigh()[0]);
- verticesBuffer.put(box.getHigh()[1]);
- verticesBuffer.put(box.getLow()[2]);
-
- texCoordBuffer.put(6);
- texCoordBuffer.put(6);
-
- verticesBuffer.put(box.getHigh()[0]);
- verticesBuffer.put(box.getLow()[1]);
- verticesBuffer.put(box.getLow()[2]);
-
- texCoordBuffer.put(6);
- texCoordBuffer.put(5);
-
- verticesBuffer.rewind();
- texCoordBuffer.rewind();
+ private PMVMatrix fboPMVMatrix;
+ GLUniformData mgl_fboPMVMatrix;
+
+ private int tex_width_c = 0;
+ private int tex_height_c = 0;
+ GLUniformData mgl_ActiveTexture;
+ int activeTexture; // texture engine 0 == GL.GL_TEXTURE0
+
+ public VBORegion2PES2(RenderState rs, int textureEngine) {
+ fboPMVMatrix = new PMVMatrix();
+ mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
+
+ activeTexture = GL.GL_TEXTURE0 + textureEngine;
+ mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine);
+
+ final int initialSize = 256;
+ final ShaderState st = rs.getShaderState();
+
+ indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialSize, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+ indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
+ indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3);
+ indicesFbo.seal(true);
+
+ texCoordFboAttr = GLArrayDataServer.createGLSL(st, AttributeNames.TEXCOORD_ATTR_NAME, 2,
+ GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
+ st.ownAttribute(texCoordFboAttr, true);
+ texCoordFboAttr.putf(5); texCoordFboAttr.putf(5);
+ texCoordFboAttr.putf(5); texCoordFboAttr.putf(6);
+ texCoordFboAttr.putf(6); texCoordFboAttr.putf(6);
+ texCoordFboAttr.putf(6); texCoordFboAttr.putf(5);
+ texCoordFboAttr.seal(true);
+
+ verticeFboAttr = GLArrayDataServer.createGLSL(st, AttributeNames.VERTEX_ATTR_NAME, 3,
+ GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
+ st.ownAttribute(verticeFboAttr, true);
+
+
+ box = new AABBox();
+
+ indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialSize, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+
+ verticeTxtAttr = GLArrayDataServer.createGLSL(st, AttributeNames.VERTEX_ATTR_NAME, 3,
+ GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
+ st.ownAttribute(verticeTxtAttr, true);
+
+ texCoordTxtAttr = GLArrayDataServer.createGLSL(st, AttributeNames.TEXCOORD_ATTR_NAME, 2,
+ GL2ES2.GL_FLOAT, false, initialSize, GL.GL_STATIC_DRAW);
+ st.ownAttribute(texCoordTxtAttr, true);
+
+ if(DEBUG_INSTANCE) {
+ System.err.println("VBORegion2PES2 Create: " + this);
+ }
+ }
+
+ public void update(GL2ES2 gl){
+ if(!dirty) {
+ return;
+ }
+
+ // process triangles
+ indicesTxt.seal(gl, false);
+ indicesTxt.rewind();
+ for(Triangle t:triangles){
+ if(t.getVertices()[0].getId() == Integer.MAX_VALUE){
+ t.getVertices()[0].setId(numVertices++);
+ t.getVertices()[1].setId(numVertices++);
+ t.getVertices()[2].setId(numVertices++);
+
+ vertices.add(t.getVertices()[0]);
+ vertices.add(t.getVertices()[1]);
+ vertices.add(t.getVertices()[2]);
+
+ indicesTxt.puts((short) t.getVertices()[0].getId());
+ indicesTxt.puts((short) t.getVertices()[1].getId());
+ indicesTxt.puts((short) t.getVertices()[2].getId());
+ }
+ else{
+ Vertex v1 = t.getVertices()[0];
+ Vertex v2 = t.getVertices()[1];
+ Vertex v3 = t.getVertices()[2];
+
+ indicesTxt.puts((short) v1.getId());
+ indicesTxt.puts((short) v2.getId());
+ indicesTxt.puts((short) v3.getId());
+ }
+ }
+ indicesTxt.seal(gl, true);
+ indicesTxt.enableBuffer(gl, false);
- t_vboIds = IntBuffer.allocate(3);
- gl.glGenBuffers(numBuffers, t_vboIds);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, t_vboIds.get(0)); // vertices
- gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, 4 * 3 * Buffers.SIZEOF_FLOAT, verticesBuffer, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, t_vboIds.get(1)); //texture
- gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, 4 * 2 * Buffers.SIZEOF_FLOAT, texCoordBuffer, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, t_vboIds.get(2)); //triangles
- gl.glBufferData(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, 4 * 3 * Buffers.SIZEOF_SHORT, indicies, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, 0);
- }
-
- private void initFBOTexture(PMVMatrix m, int tex_width){
- tex_width_c = tex_width;
- tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth());
-
- System.out.println("FBO Size: "+tex_height_c+"x"+tex_width_c);
- System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5));
+ // process vertices and update bbox
+ box.reset();
+ verticeTxtAttr.seal(gl, false);
+ verticeTxtAttr.rewind();
+ texCoordTxtAttr.seal(gl, false);
+ texCoordTxtAttr.rewind();
+ for(Vertex v:vertices){
+ verticeTxtAttr.putf(v.getX());
+ if(flipped){
+ verticeTxtAttr.putf(-1*v.getY());
+ } else {
+ verticeTxtAttr.putf(v.getY());
+ }
+ verticeTxtAttr.putf(v.getZ());
+ if(flipped){
+ box.resize(v.getX(), -1*v.getY(), v.getZ());
+ } else {
+ box.resize(v.getX(), v.getY(), v.getZ());
+ }
+
+ final float[] tex = v.getTexCoord();
+ texCoordTxtAttr.putf(tex[0]);
+ texCoordTxtAttr.putf(tex[1]);
+ }
+ texCoordTxtAttr.seal(gl, true);
+ texCoordTxtAttr.enableBuffer(gl, false);
+ verticeTxtAttr.seal(gl, true);
+ verticeTxtAttr.enableBuffer(gl, false);
+
+ // update all bbox related data
+ verticeFboAttr.seal(gl, false);
+ verticeFboAttr.rewind();
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.seal(gl, true);
+ verticeFboAttr.enableBuffer(gl, false);
+
+ fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ fboPMVMatrix.glLoadIdentity();
+ fboPMVMatrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
+
+ // push data 2 GPU ..
+ indicesFbo.seal(gl, true);
+ indicesFbo.enableBuffer(gl, false);
+
+ dirty = false;
+
+ // the buffers were disabled, since due to real/fbo switching and other vbo usage
+ }
+
+ public void render(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int width) {
+ if(vp_width <=0 || vp_height <= 0 || width <= 0){
+ renderRegion(gl);
+ } else {
+ if(width != tex_width_c){
+ renderRegion2FBO(gl, rs, width);
+ }
+ // System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
+ renderFBO(gl, rs, vp_width, vp_height);
+ }
+ }
+
+ private void renderFBO(GL2ES2 gl, RenderState rs, int width, int hight) {
+ final ShaderState st = rs.getShaderState();
+
+ gl.glViewport(0, 0, width, hight);
+
+ gl.glEnable(GL2ES2.GL_TEXTURE_2D);
+ /* setback:
+ int[] currentActiveTextureEngine = new int[1];
+ gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, currentActiveTextureEngine, 0);
+ */
+ gl.glActiveTexture(activeTexture);
+ st.uniform(gl, mgl_ActiveTexture);
+
+ fbo.use(gl);
+ verticeFboAttr.enableBuffer(gl, true);
+ texCoordFboAttr.enableBuffer(gl, true);
+ indicesFbo.enableBuffer(gl, true);
+
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementNumber() * indicesFbo.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+
+ verticeFboAttr.enableBuffer(gl, false);
+ texCoordFboAttr.enableBuffer(gl, false);
+ indicesFbo.enableBuffer(gl, false);
+ fbo.unuse(gl);
+
+ // setback: gl.glActiveTexture(currentActiveTextureEngine[0]);
+ }
+
+ private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int tex_width) {
+ final ShaderState st = rs.getShaderState();
+
+ tex_width_c = tex_width;
+ tex_height_c = (int)(tex_width_c*box.getHeight()/box.getWidth());
+
+ // System.out.println("FBO Size: "+tex_width+" -> "+tex_height_c+"x"+tex_width_c);
+ // System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5));
- GL2ES2 gl = context.getGL().getGL2ES2();
- if(null != fbo) {
+ if(null != fbo && fbo.getWidth() != tex_width_c && fbo.getHeight() != tex_height_c ) {
fbo.destroy(gl);
fbo = null;
}
- fbo = new FBObject(tex_width_c, tex_height_c);
- // FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth
- fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
- // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
- fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ?
-
-
- //render texture
- PMVMatrix tex_matrix = new PMVMatrix();
- gl.glViewport(0, 0, tex_width_c, tex_height_c);
- tex_matrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- tex_matrix.glLoadIdentity();
- tex_matrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
-
- if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, tex_matrix.glGetPMvMatrixf()))){
- System.out.println("Cnt set tex based mat");
- }
-
- gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
- renderRegion();
-
- fbo.unbind(gl);
-
- setupBoundingBuffers();
- }
-
- private void renderRegion(){
- GL2ES2 gl = context.getGL().getGL2ES2();
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(0));
- gl.glEnableVertexAttribArray(VERTEX_ATTR_IDX);
- gl.glVertexAttribPointer(VERTEX_ATTR_IDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(1));
- gl.glEnableVertexAttribArray(TEXCOORD_ATTR_IDX);
- gl.glVertexAttribPointer(TEXCOORD_ATTR_IDX, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, vboIds.get(2));
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, triangles.size() * 3, GL2ES2.GL_UNSIGNED_SHORT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
- }
-
- public void addTriangles(ArrayList<Triangle> tris) {
- triangles.addAll(tris);
- dirty = true;
- }
-
- public int getNumVertices(){
- return numVertices;
- }
-
- public void addVertices(ArrayList<Vertex> verts){
- vertices.addAll(verts);
- numVertices = vertices.size();
- dirty = true;
- }
-
- public boolean isDirty(){
- return dirty;
- }
-
- public void destroy() {
- GL2ES2 gl = context.getGL().getGL2ES2();
- gl.glDeleteBuffers(numBuffers, vboIds);
- if(null != fbo) {
- fbo.destroy(gl);
- fbo = null;
- }
- }
-
- public boolean isFlipped() {
- return flipped;
- }
+ if(null == fbo) {
+ fbo = new FBObject(tex_width_c, tex_height_c);
+ // FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth
+ fbo.init(gl, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
+ // fbo.init(gl, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
+ fbo.attachDepthBuffer(gl, GL.GL_DEPTH_COMPONENT16); // FIXME: or shall we use 24 or 32 bit depth ?
+ } else {
+ fbo.bind(gl);
+ }
+
+ //render texture
+ gl.glViewport(0, 0, tex_width_c, tex_height_c);
+ 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.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix
+ }
+
+ private void renderRegion(GL2ES2 gl) {
+ verticeTxtAttr.enableBuffer(gl, true);
+ texCoordTxtAttr.enableBuffer(gl, true);
+ indicesTxt.enableBuffer(gl, true);
+
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementNumber() * indicesTxt.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+
+ verticeTxtAttr.enableBuffer(gl, false);
+ texCoordTxtAttr.enableBuffer(gl, false);
+ indicesTxt.enableBuffer(gl, false);
+ }
+
+ public void addTriangles(ArrayList<Triangle> tris) {
+ triangles.addAll(tris);
+ dirty = true;
+ }
+
+ public int getNumVertices(){
+ return numVertices;
+ }
+
+ public void addVertices(ArrayList<Vertex> verts){
+ vertices.addAll(verts);
+ numVertices = vertices.size();
+ dirty = true;
+ }
+
+ public boolean isDirty(){
+ return dirty;
+ }
+
+ public void destroy(GL2ES2 gl, RenderState rs) {
+ if(DEBUG_INSTANCE) {
+ System.err.println("VBORegion2PES2 Destroy: " + this);
+ }
+ final ShaderState st = rs.getShaderState();
+ if(null != fbo) {
+ fbo.destroy(gl);
+ fbo = null;
+ }
+ if(null != verticeTxtAttr) {
+ st.ownAttribute(verticeTxtAttr, false);
+ verticeTxtAttr.destroy(gl);
+ verticeTxtAttr = null;
+ }
+ if(null != texCoordTxtAttr) {
+ st.ownAttribute(texCoordTxtAttr, false);
+ texCoordTxtAttr.destroy(gl);
+ texCoordTxtAttr = null;
+ }
+ if(null != indicesTxt) {
+ indicesTxt.destroy(gl);
+ indicesTxt = null;
+ }
+ if(null != verticeFboAttr) {
+ st.ownAttribute(verticeFboAttr, false);
+ verticeFboAttr.destroy(gl);
+ verticeFboAttr = null;
+ }
+ if(null != texCoordFboAttr) {
+ st.ownAttribute(texCoordFboAttr, false);
+ texCoordFboAttr.destroy(gl);
+ texCoordFboAttr = null;
+ }
+ if(null != indicesFbo) {
+ indicesFbo.destroy(gl);
+ indicesFbo = null;
+ }
+ triangles.clear();
+ vertices.clear();
+ }
+
+ public boolean isFlipped() {
+ return flipped;
+ }
- public void setFlipped(boolean flipped) {
- this.flipped = flipped;
- }
+ public void setFlipped(boolean flipped) {
+ this.flipped = flipped;
+ }
+
+ public AABBox getBounds(){
+ return box;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 701549d46..7956e5137 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -27,159 +27,195 @@
*/
package jogamp.graph.curve.opengl;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
import java.util.ArrayList;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLContext;
-import com.jogamp.common.nio.Buffers;
+import jogamp.graph.curve.opengl.shader.AttributeNames;
+
import com.jogamp.graph.curve.Region;
+import com.jogamp.graph.curve.opengl.RenderState;
+import com.jogamp.graph.geom.AABBox;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Triangle;
-import com.jogamp.opengl.util.PMVMatrix;
-
-public class VBORegionSPES2 implements Region{
- private int numVertices = 0;
- private IntBuffer vboIds;
-
- private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
- private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
-
- private GLContext context;
-
- private int numBuffers = 3;
-
- private boolean flipped = false;
- private boolean dirty = false;
-
- public VBORegionSPES2(GLContext context){
- this.context =context;
- }
-
- public void update(){
- GL2ES2 gl = context.getGL().getGL2ES2();
- ShortBuffer indicies = Buffers.newDirectShortBuffer(triangles.size() * 3);
-
- for(Triangle t:triangles){
- final Vertex[] t_vertices = t.getVertices();
-
- if(t_vertices[0].getId() == Integer.MAX_VALUE){
- t_vertices[0].setId(numVertices++);
- t_vertices[1].setId(numVertices++);
- t_vertices[2].setId(numVertices++);
-
- vertices.add(t.getVertices()[0]);
- vertices.add(t.getVertices()[1]);
- vertices.add(t.getVertices()[2]);
+import com.jogamp.opengl.util.GLArrayDataServer;
+import com.jogamp.opengl.util.glsl.ShaderState;
- indicies.put((short) t.getVertices()[0].getId());
- indicies.put((short) t.getVertices()[1].getId());
- indicies.put((short) t.getVertices()[2].getId());
- }
- else{
- Vertex v1 = t_vertices[0];
- Vertex v2 = t_vertices[1];
- Vertex v3 = t_vertices[2];
-
- indicies.put((short) v1.getId());
- indicies.put((short) v2.getId());
- indicies.put((short) v3.getId());
- }
- }
- indicies.rewind();
-
- FloatBuffer verticesBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 3);
- for(Vertex v:vertices){
- verticesBuffer.put(v.getX());
- if(flipped){
- verticesBuffer.put(-1*v.getY());
- }
- else{
- verticesBuffer.put(v.getY());
- }
- verticesBuffer.put(v.getZ());
- }
- verticesBuffer.rewind();
-
- FloatBuffer texCoordBuffer = Buffers.newDirectFloatBuffer(vertices.size() * 2);
- for(Vertex v:vertices){
- float[] tex = v.getTexCoord();
- texCoordBuffer.put(tex[0]);
- texCoordBuffer.put(tex[1]);
- }
- texCoordBuffer.rewind();
+public class VBORegionSPES2 implements Region {
+ private int numVertices = 0;
+
+ private ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+ private ArrayList<Vertex> vertices = new ArrayList<Vertex>();
+ private GLArrayDataServer verticeAttr = null;
+ private GLArrayDataServer texCoordAttr = null;
+ private GLArrayDataServer indices = null;
+
+ private boolean flipped = false;
+ private boolean dirty = true;
+
+ private AABBox box = null;
+
+ public VBORegionSPES2(RenderState rs){
+ box = new AABBox();
+
+ 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);
+
+ verticeAttr = GLArrayDataServer.createGLSL(st, AttributeNames.VERTEX_ATTR_NAME, 3,
+ 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.ownAttribute(texCoordAttr, true);
+
+ if(DEBUG_INSTANCE) {
+ System.err.println("VBORegionSPES2 Create: " + this);
+ }
+ }
+
+ public void update(GL2ES2 gl){
+ if(!dirty) {
+ return;
+ }
+
+ // process triangles
+ indices.seal(gl, false);
+ indices.rewind();
+ for(Triangle t:triangles){
+ final Vertex[] t_vertices = t.getVertices();
+
+ if(t_vertices[0].getId() == Integer.MAX_VALUE){
+ t_vertices[0].setId(numVertices++);
+ t_vertices[1].setId(numVertices++);
+ t_vertices[2].setId(numVertices++);
+
+ vertices.add(t.getVertices()[0]);
+ vertices.add(t.getVertices()[1]);
+ vertices.add(t.getVertices()[2]);
- vboIds = IntBuffer.allocate(numBuffers);
- gl.glGenBuffers(numBuffers, vboIds);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(0)); // vertices
- gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, numVertices * 3 * Buffers.SIZEOF_FLOAT, verticesBuffer, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(1)); //texture
- gl.glBufferData(GL2ES2.GL_ARRAY_BUFFER, numVertices * 2 * Buffers.SIZEOF_FLOAT, texCoordBuffer, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, vboIds.get(2)); //triangles
- gl.glBufferData(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, triangles.size()* 3 * Buffers.SIZEOF_SHORT, indicies, GL2ES2.GL_STATIC_DRAW);
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, 0);
-
- dirty = false;
- }
-
- private void render() {
- GL2ES2 gl = context.getGL().getGL2ES2();
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(0));
- gl.glEnableVertexAttribArray(VERTEX_ATTR_IDX);
- gl.glVertexAttribPointer(VERTEX_ATTR_IDX, 3, GL2ES2.GL_FLOAT, false, 3 * Buffers.SIZEOF_FLOAT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, vboIds.get(1));
- gl.glEnableVertexAttribArray(TEXCOORD_ATTR_IDX);
- gl.glVertexAttribPointer(TEXCOORD_ATTR_IDX, 2, GL2ES2.GL_FLOAT, false, 2 * Buffers.SIZEOF_FLOAT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ELEMENT_ARRAY_BUFFER, vboIds.get(2));
- gl.glDrawElements(GL2ES2.GL_TRIANGLES, triangles.size() * 3, GL2ES2.GL_UNSIGNED_SHORT, 0);
-
- gl.glBindBuffer(GL2ES2.GL_ARRAY_BUFFER, 0);
- }
-
- public void render(PMVMatrix matrix, int vp_width, int vp_height, int width){
- render();
- }
-
- public void addTriangles(ArrayList<Triangle> tris) {
- triangles.addAll(tris);
- dirty = true;
- }
-
- public int getNumVertices(){
- return numVertices;
- }
-
- public void addVertices(ArrayList<Vertex> verts){
- vertices.addAll(verts);
- numVertices = vertices.size();
- dirty = true;
- }
-
- public boolean isDirty(){
- return dirty;
- }
-
- public void destroy() {
- GL2ES2 gl = context.getGL().getGL2ES2();
- gl.glDeleteBuffers(numBuffers, vboIds);
- }
-
- public boolean isFlipped() {
- return flipped;
- }
+ indices.puts((short) t.getVertices()[0].getId());
+ indices.puts((short) t.getVertices()[1].getId());
+ indices.puts((short) t.getVertices()[2].getId());
+ }
+ else{
+ Vertex v1 = t_vertices[0];
+ Vertex v2 = t_vertices[1];
+ Vertex v3 = t_vertices[2];
+
+ indices.puts((short) v1.getId());
+ indices.puts((short) v2.getId());
+ indices.puts((short) v3.getId());
+ }
+ }
+ indices.seal(gl, true);
+ indices.enableBuffer(gl, false);
+
+ // process vertices and update bbox
+ box.reset();
+ verticeAttr.seal(gl, false);
+ verticeAttr.rewind();
+ texCoordAttr.seal(gl, false);
+ texCoordAttr.rewind();
+ for(Vertex v:vertices){
+ if(flipped){
+ verticeAttr.putf(v.getX());
+ verticeAttr.putf(-1*v.getY());
+ verticeAttr.putf(v.getZ());
+
+ box.resize(v.getX(),-1*v.getY(),v.getZ());
+ }
+ else{
+ verticeAttr.putf(v.getX());
+ verticeAttr.putf(v.getY());
+ verticeAttr.putf(v.getZ());
+
+ box.resize(v.getX(),v.getY(),v.getZ());
+ }
+
+ final float[] tex = v.getTexCoord();
+ texCoordAttr.putf(tex[0]);
+ texCoordAttr.putf(tex[1]);
+ }
+ verticeAttr.seal(gl, true);
+ verticeAttr.enableBuffer(gl, false);
+ texCoordAttr.seal(gl, true);
+ texCoordAttr.enableBuffer(gl, false);
+
+ // update all bbox related data: nope
+
+ dirty = false;
+
+ // the buffers were disabled, since due to real/fbo switching and other vbo usage
+ }
+
+ private void render(GL2ES2 gl) {
+ verticeAttr.enableBuffer(gl, true);
+ texCoordAttr.enableBuffer(gl, true);
+ indices.enableBuffer(gl, true);
+
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementNumber() * indices.getComponentNumber(), GL2ES2.GL_UNSIGNED_SHORT, 0);
+
+ verticeAttr.enableBuffer(gl, false);
+ texCoordAttr.enableBuffer(gl, false);
+ indices.enableBuffer(gl, false);
+ }
+
+ public void render(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int width) {
+ render(gl);
+ }
+
+ public void addTriangles(ArrayList<Triangle> tris) {
+ triangles.addAll(tris);
+ dirty = true;
+ }
+
+ public int getNumVertices(){
+ return numVertices;
+ }
+
+ public void addVertices(ArrayList<Vertex> verts){
+ vertices.addAll(verts);
+ numVertices = vertices.size();
+ dirty = true;
+ }
+
+ public boolean isDirty(){
+ return dirty;
+ }
+
+ 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;
+ }
+ if(null != indices) {
+ indices.destroy(gl);
+ indices = null;
+ }
+ }
+
+ public boolean isFlipped() {
+ return flipped;
+ }
- public void setFlipped(boolean flipped) {
- this.flipped = flipped;
- }
+ public void setFlipped(boolean flipped) {
+ this.flipped = flipped;
+ }
+ public AABBox getBounds(){
+ return box;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
new file mode 100644
index 000000000..59dacf8af
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
@@ -0,0 +1,18 @@
+package jogamp.graph.curve.opengl.shader;
+
+public class AttributeNames {
+ /** The vertices index in an OGL object
+ */
+ public static final int VERTEX_ATTR_IDX = 0; // FIXME: AMD needs this to be location 0 ? hu ?
+ public static final String VERTEX_ATTR_NAME = "gca_Vertices";
+
+ /** The Texture Coord index in an OGL object
+ */
+ public static final int TEXCOORD_ATTR_IDX = 1;
+ public static final String TEXCOORD_ATTR_NAME = "gca_TexCoords";
+
+ /** The color index in an OGL object
+ */
+ public static final int COLOR_ATTR_IDX = 2;
+ public static final String COLOR_ATTR_NAME = "gca_Colors";
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
new file mode 100644
index 000000000..2e04278ca
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
@@ -0,0 +1,10 @@
+package jogamp.graph.curve.opengl.shader;
+
+public class UniformNames {
+ public static final String gcu_PMVMatrix = "gcu_PMVMatrix"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
+ public static final String gcu_ColorStatic = "gcu_ColorStatic";
+ public static final String gcu_Alpha = "gcu_Alpha";
+ public static final String gcu_P1Y = "gcu_P1Y";
+ public static final String gcu_Strength = "gcu_Strength";
+ public static final String gcu_TextureUnit = "gcu_TextureUnit";
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
new file mode 100644
index 000000000..c9a242573
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/attributes.glsl
@@ -0,0 +1,13 @@
+
+#ifndef attributes_glsl
+#define attributes_glsl
+
+#include precision.glsl
+
+// attribute HIGHP vec3 gca_Vertices;
+attribute HIGHP vec4 gca_Vertices;
+attribute HIGHP vec2 gca_TexCoords;
+//attribute HIGHP vec4 gca_Colors;
+//attribute HIGHP vec3 gca_Normals;
+
+#endif // attributes_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl
new file mode 100644
index 000000000..4cb41c903
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/consts.glsl
@@ -0,0 +1,10 @@
+
+#ifndef consts_glsl
+#define consts_glsl
+
+#include precision.glsl
+
+const LOWP int MAX_TEXTURE_UNITS = 8; // <= gl_MaxTextureImageUnits
+// const LOWP int MAX_LIGHTS = 8;
+
+#endif // consts_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
index 3a1ef5157..975c2dc5b 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.fp
@@ -1,95 +1,97 @@
//Copyright 2010 JogAmp Community. All rights reserved.
-//#version 100
-uniform float p1y;
-uniform float g_alpha;
-uniform vec3 g_color;
-uniform float a_strength;
+/**
+ * AMD complains: #version must occur before any other statement in the program
+#ifdef GL_ES
+ #version 100
+#else
+ #version 110
+#endif
+ */
+
+#include uniforms.glsl
+#include varyings.glsl
-varying vec2 v_texCoord;
-
-vec3 b_color = vec3(0.0, 0.0, 0.0);
-
-uniform sampler2D texture;
-vec4 weights = vec4(0.075, 0.06, 0.045, 0.025);
+const vec3 b_color = vec3(0.0, 0.0, 0.0);
+const vec4 weights = vec4(0.075, 0.06, 0.045, 0.025);
void main (void)
{
- vec2 rtex = vec2(abs(v_texCoord.x),abs(v_texCoord.y));
- vec3 c = g_color;
-
- float alpha = 0.0;
-
- if((v_texCoord.x == 0.0) && (v_texCoord.y == 0.0)){
- alpha = g_alpha;
- }
- else if((v_texCoord.x >= 5.0)){
- vec2 dfx = dFdx(v_texCoord);
- vec2 dfy = dFdy(v_texCoord);
-
- vec2 size = 1.0/textureSize(texture,0); //version 130
- rtex -= 5.0;
- vec4 t = texture2D(texture, rtex)* 0.18;
+ vec2 rtex = vec2(abs(gcv_TexCoord.x),abs(gcv_TexCoord.y));
+ vec3 c = gcu_ColorStatic.rgb;
+
+ float alpha = 0.0;
+
+ if((gcv_TexCoord.x == 0.0) && (gcv_TexCoord.y == 0.0)){
+ alpha = gcu_Alpha;
+ }
+ else if((gcv_TexCoord.x >= 5.0)){
+ vec2 dfx = dFdx(gcv_TexCoord);
+ vec2 dfy = dFdy(gcv_TexCoord);
+
+ vec2 size = 1.0/textureSize(gcu_TextureUnit,0); //version 130 - FIXME: replace with uniform value
+ rtex -= 5.0;
+ vec4 t = texture2D(gcu_TextureUnit, rtex)* 0.18;
- t += texture2D(texture, rtex + size*(vec2(1, 0)))*weights.x;
- t += texture2D(texture, rtex - size*(vec2(1, 0)))*weights.x;
- t += texture2D(texture, rtex + size*(vec2(0, 1)))*weights.x;
- t += texture2D(texture, rtex - size*(vec2(0, 1)))*weights.x;
-
- t += texture2D(texture, rtex + 2.0*size*(vec2(1, 0))) *weights.y;
- t += texture2D(texture, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
- t += texture2D(texture, rtex + 2.0*size*(vec2(0, 1)))*weights.y;
- t += texture2D(texture, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
-
- t += texture2D(texture, rtex + 3.0*size*(vec2(1, 0))) *weights.z;
- t += texture2D(texture, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
- t += texture2D(texture, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
- t += texture2D(texture, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
-
- t += texture2D(texture, rtex + 4.0*size*(vec2(1, 0))) *weights.w;
- t += texture2D(texture, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
- t += texture2D(texture, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
- t += texture2D(texture, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
-
- if(t.w == 0.0){
- discard;
- }
-
- c = t.xyz;
- alpha = g_alpha* t.w;
- }
- ///////////////////////////////////////////////////////////
- else if ((v_texCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){
- vec2 dtx = dFdx(rtex);
- vec2 dty = dFdy(rtex);
-
- rtex.y -= 0.1;
-
- if(rtex.y < 0.0) {
- if(v_texCoord.y < 0.0)
- discard;
- else{
- rtex.y = 0.0;
- }
- }
-
- vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x));
- float position = rtex.y - (rtex.x * (1.0 - rtex.x));
- float d = position/(length(f));
+ t += texture2D(gcu_TextureUnit, rtex + size*(vec2(1, 0)))*weights.x;
+ t += texture2D(gcu_TextureUnit, rtex - size*(vec2(1, 0)))*weights.x;
+ t += texture2D(gcu_TextureUnit, rtex + size*(vec2(0, 1)))*weights.x;
+ t += texture2D(gcu_TextureUnit, rtex - size*(vec2(0, 1)))*weights.x;
+
+ t += texture2D(gcu_TextureUnit, rtex + 2.0*size*(vec2(1, 0)))*weights.y;
+ t += texture2D(gcu_TextureUnit, rtex - 2.0*size*(vec2(1, 0)))*weights.y;
+ t += texture2D(gcu_TextureUnit, rtex + 2.0*size*(vec2(0, 1)))*weights.y;
+ t += texture2D(gcu_TextureUnit, rtex - 2.0*size*(vec2(0, 1)))*weights.y;
+
+ t += texture2D(gcu_TextureUnit, rtex + 3.0*size*(vec2(1, 0)))*weights.z;
+ t += texture2D(gcu_TextureUnit, rtex - 3.0*size*(vec2(1, 0)))*weights.z;
+ t += texture2D(gcu_TextureUnit, rtex + 3.0*size*(vec2(0, 1)))*weights.z;
+ t += texture2D(gcu_TextureUnit, rtex - 3.0*size*(vec2(0, 1)))*weights.z;
+
+ t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(1, 0)))*weights.w;
+ t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(1, 0)))*weights.w;
+ t += texture2D(gcu_TextureUnit, rtex + 4.0*size*(vec2(0, 1)))*weights.w;
+ t += texture2D(gcu_TextureUnit, rtex - 4.0*size*(vec2(0, 1)))*weights.w;
+
+ if(t.w == 0.0){
+ discard;
+ }
+
+ c = t.xyz;
+ alpha = gcu_Alpha * t.w;
+ }
+ ///////////////////////////////////////////////////////////
+ else if ((gcv_TexCoord.x > 0.0) && (rtex.y > 0.0 || rtex.x == 1.0)){
+ vec2 dtx = dFdx(rtex);
+ vec2 dty = dFdy(rtex);
+
+ rtex.y -= 0.1;
+
+ if(rtex.y < 0.0) {
+ if(gcv_TexCoord.y < 0.0)
+ discard;
+ else{
+ rtex.y = 0.0;
+ }
+ }
+
+ vec2 f = vec2((dtx.y - dtx.x + 2.0*rtex.x*dtx.x), (dty.y - dty.x + 2.0*rtex.x*dty.x));
+ float position = rtex.y - (rtex.x * (1.0 - rtex.x));
+ float d = position/(length(f));
- float a = (0.5 - d * sign(v_texCoord.y));
-
- if (a >= 1.0) {
- alpha = g_alpha;
- }
- else if (a <= 0.0) {
- alpha = 0.0;//discard;
- }
- else {
- alpha = g_alpha*a;
- mix(b_color,g_color, a);
- }
- }
-
+ float a = (0.5 - d * sign(gcv_TexCoord.y));
+
+ if (a >= 1.0) {
+ alpha = gcu_Alpha;
+ }
+ else if (a <= 0.0) {
+ alpha = 0.0;//discard;
+ }
+ else {
+ alpha = gcu_Alpha * a;
+ mix(b_color,gcu_ColorStatic.rgb, a);
+ }
+ }
+
gl_FragColor = vec4(c, alpha);
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
index bc9ecb41e..fe74caffb 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01.vp
@@ -1,13 +1,21 @@
-//#version 100
+//Copyright 2010 JogAmp Community. All rights reserved.
-uniform mat4 mgl_PMVMatrix[2];
-attribute vec4 v_position;
-attribute vec2 texCoord;
+/**
+ * AMD complains: #version must occur before any other statement in the program
+#ifdef GL_ES
+ #version 100
+#else
+ #version 110
+#endif
+ */
-varying vec2 v_texCoord;
+#include uniforms.glsl
+#include attributes.glsl
+#include varyings.glsl
void main(void)
{
- gl_Position = mgl_PMVMatrix[0] * mgl_PMVMatrix[1] * v_position;
- v_texCoord = texCoord.st;
-} \ No newline at end of file
+ // gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * vec4(gca_Vertices, 1);
+ gl_Position = gcu_PMVMatrix[0] * gcu_PMVMatrix[1] * gca_Vertices;
+ gcv_TexCoord = gca_TexCoords;
+}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl
new file mode 100644
index 000000000..1ac4ed8e9
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/precision.glsl
@@ -0,0 +1,14 @@
+#ifndef precision_glsl
+#define precision_glsl
+
+#ifdef GL_ES
+ #define MEDIUMP mediump
+ #define HIGHP highp
+ #define LOWP lowp
+#else
+ #define MEDIUMP
+ #define HIGHP
+ #define LOWP
+#endif
+
+#endif // precision_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
new file mode 100644
index 000000000..677c7324f
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/uniforms.glsl
@@ -0,0 +1,21 @@
+
+#ifndef uniforms_glsl
+#define uniforms_glsl
+
+#include precision.glsl
+
+// #include consts.glsl
+
+uniform HIGHP mat4 gcu_PMVMatrix[3]; // P, Mv, and Mvi
+uniform HIGHP vec3 gcu_ColorStatic;
+uniform HIGHP float gcu_Alpha;
+uniform HIGHP float gcu_P1Y;
+uniform HIGHP float gcu_Strength;
+uniform sampler2D gcu_TextureUnit;
+
+// uniform HIGHP mat3 gcu_NormalMatrix; // transpose(inverse(ModelView)).3x3
+// uniform LOWP int gcu_ColorEnabled;
+// uniform LOWP int gcu_TexCoordEnabled[MAX_TEXTURE_UNITS];
+// uniform LOWP int gcu_CullFace;
+
+#endif // uniforms_glsl
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
new file mode 100644
index 000000000..e70c25266
--- /dev/null
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/varyings.glsl
@@ -0,0 +1,13 @@
+
+#ifndef varyings_glsl
+#define varyings_glsl
+
+#include precision.glsl
+
+#include consts.glsl
+
+varying vec4 gcv_FrontColor;
+varying vec2 gcv_TexCoord;
+
+#endif // varyings_glsl
+
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
index 5dae296e5..a0d1923a9 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
@@ -33,49 +33,49 @@ import com.jogamp.graph.geom.Outline;
import com.jogamp.graph.geom.Vertex;
public class GraphOutline {
- final private Outline outline;
- final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
-
- public GraphOutline(){
- this.outline = new Outline();
- }
-
- /**Create a control polyline of control vertices
- * the curve pieces can be identified by onCurve flag
- * of each cp the control polyline is open by default
- */
- public GraphOutline(Outline ol){
- this.outline = ol;
- ArrayList<Vertex> vertices = this.outline.getVertices();
- for(Vertex v:vertices){
- this.controlpoints.add(new GraphVertex(v));
- }
- }
+ final private Outline outline;
+ final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
+
+ public GraphOutline(){
+ this.outline = new Outline();
+ }
+
+ /**Create a control polyline of control vertices
+ * the curve pieces can be identified by onCurve flag
+ * of each cp the control polyline is open by default
+ */
+ public GraphOutline(Outline ol){
+ this.outline = ol;
+ ArrayList<Vertex> vertices = this.outline.getVertices();
+ for(Vertex v:vertices){
+ this.controlpoints.add(new GraphVertex(v));
+ }
+ }
- public Outline getOutline() {
- return outline;
- }
+ public Outline getOutline() {
+ return outline;
+ }
- /*public void setOutline(Outline<T> outline) {
- this.outline = outline;
- }*/
-
+ /*public void setOutline(Outline<T> outline) {
+ this.outline = outline;
+ }*/
+
- public ArrayList<GraphVertex> getGraphPoint() {
- return controlpoints;
- }
-
- public ArrayList<Vertex> getPoints() {
- return outline.getVertices();
- }
+ public ArrayList<GraphVertex> getGraphPoint() {
+ return controlpoints;
+ }
+
+ public ArrayList<Vertex> getPoints() {
+ return outline.getVertices();
+ }
- /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) {
- this.controlpoints = controlpoints;
- }*/
+ /*public void setControlpoints(ArrayList<GraphPoint<T>> controlpoints) {
+ this.controlpoints = controlpoints;
+ }*/
- public void addVertex(GraphVertex v) {
- controlpoints.add(v);
- outline.addVertex(v.getPoint());
- }
-
+ public void addVertex(GraphVertex v) {
+ controlpoints.add(v);
+ outline.addVertex(v.getPoint());
+ }
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
index b9f95a0e7..5efe57c28 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
@@ -32,89 +32,89 @@ import java.util.ArrayList;
import com.jogamp.graph.geom.Vertex;
public class GraphVertex {
- private Vertex point;
- private ArrayList<HEdge> edges = null;
- private boolean boundaryContained = false;
-
- public GraphVertex(Vertex point) {
- this.point = point;
- }
+ private Vertex point;
+ private ArrayList<HEdge> edges = null;
+ private boolean boundaryContained = false;
+
+ public GraphVertex(Vertex point) {
+ this.point = point;
+ }
- public Vertex getPoint() {
- return point;
- }
-
- public float getX(){
- return point.getX();
- }
-
- public float getY(){
- return point.getY();
- }
-
- public float getZ(){
- return point.getZ();
- }
- public float[] getCoord() {
- return point.getCoord();
- }
+ public Vertex getPoint() {
+ return point;
+ }
+
+ public float getX(){
+ return point.getX();
+ }
+
+ public float getY(){
+ return point.getY();
+ }
+
+ public float getZ(){
+ return point.getZ();
+ }
+ public float[] getCoord() {
+ return point.getCoord();
+ }
- public void setPoint(Vertex point) {
- this.point = point;
- }
+ public void setPoint(Vertex point) {
+ this.point = point;
+ }
- public ArrayList<HEdge> getEdges() {
- return edges;
- }
+ public ArrayList<HEdge> getEdges() {
+ return edges;
+ }
- public void setEdges(ArrayList<HEdge> edges) {
- this.edges = edges;
- }
-
- public void addEdge(HEdge edge){
- if(edges == null){
- edges = new ArrayList<HEdge>();
- }
- edges.add(edge);
- }
- public void removeEdge(HEdge edge){
- if(edges == null)
- return;
- edges.remove(edge);
- if(edges.size() == 0){
- edges = null;
- }
- }
- public HEdge findNextEdge(GraphVertex nextVert){
- for(HEdge e:edges){
- if(e.getNext().getGraphPoint() == nextVert){
- return e;
- }
- }
- return null;
- }
- public HEdge findBoundEdge(){
- for(HEdge e:edges){
- if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
- return e;
- }
- }
- return null;
- }
- public HEdge findPrevEdge(GraphVertex prevVert){
- for(HEdge e:edges){
- if(e.getPrev().getGraphPoint() == prevVert){
- return e;
- }
- }
- return null;
- }
-
- public boolean isBoundaryContained() {
- return boundaryContained;
- }
+ public void setEdges(ArrayList<HEdge> edges) {
+ this.edges = edges;
+ }
+
+ public void addEdge(HEdge edge){
+ if(edges == null){
+ edges = new ArrayList<HEdge>();
+ }
+ edges.add(edge);
+ }
+ public void removeEdge(HEdge edge){
+ if(edges == null)
+ return;
+ edges.remove(edge);
+ if(edges.size() == 0){
+ edges = null;
+ }
+ }
+ public HEdge findNextEdge(GraphVertex nextVert){
+ for(HEdge e:edges){
+ if(e.getNext().getGraphPoint() == nextVert){
+ return e;
+ }
+ }
+ return null;
+ }
+ public HEdge findBoundEdge(){
+ for(HEdge e:edges){
+ if((e.getType() == HEdge.BOUNDARY) || (e.getType() == HEdge.HOLE)){
+ return e;
+ }
+ }
+ return null;
+ }
+ public HEdge findPrevEdge(GraphVertex prevVert){
+ for(HEdge e:edges){
+ if(e.getPrev().getGraphPoint() == prevVert){
+ return e;
+ }
+ }
+ return null;
+ }
+
+ public boolean isBoundaryContained() {
+ return boundaryContained;
+ }
- public void setBoundaryContained(boolean boundaryContained) {
- this.boundaryContained = boundaryContained;
- }
+ public void setBoundaryContained(boolean boundaryContained) {
+ this.boundaryContained = boundaryContained;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
index d1bcc6e17..4d29a81f3 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
@@ -32,99 +32,99 @@ import com.jogamp.graph.geom.Triangle;
public class HEdge {
- public static int BOUNDARY = 3;
- public static int INNER = 1;
- public static int HOLE = 2;
-
- private GraphVertex vert;
- private HEdge prev = null;
- private HEdge next = null;
- private HEdge sibling = null;
- private int type = BOUNDARY;
- private Triangle triangle = null;
-
- public HEdge(GraphVertex vert, int type) {
- this.vert = vert;
- this.type = type;
- }
-
- public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) {
- this.vert = vert;
- this.prev = prev;
- this.next = next;
- this.sibling = sibling;
- this.type = type;
- }
-
- public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) {
- this.vert = vert;
- this.prev = prev;
- this.next = next;
- this.sibling = sibling;
- this.type = type;
- this.triangle = triangle;
- }
-
- public GraphVertex getGraphPoint() {
- return vert;
- }
-
- public void setVert(GraphVertex vert) {
- this.vert = vert;
- }
-
- public HEdge getPrev() {
- return prev;
- }
-
- public void setPrev(HEdge prev) {
- this.prev = prev;
- }
-
- public HEdge getNext() {
- return next;
- }
-
- public void setNext(HEdge next) {
- this.next = next;
- }
-
- public HEdge getSibling() {
- return sibling;
- }
-
- public void setSibling(HEdge sibling) {
- this.sibling = sibling;
- }
-
- public int getType() {
- return type;
- }
-
- public void setType(int type) {
- this.type = type;
- }
-
- public Triangle getTriangle() {
- return triangle;
- }
-
- public void setTriangle(Triangle triangle) {
- this.triangle = triangle;
- }
-
- public static <T extends Vertex> void connect(HEdge first, HEdge next){
- first.setNext(next);
- next.setPrev(first);
- }
-
- public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){
- first.setSibling(second);
- second.setSibling(first);
- }
-
- public boolean vertexOnCurveVertex(){
- return vert.getPoint().isOnCurve();
- }
-
+ public static int BOUNDARY = 3;
+ public static int INNER = 1;
+ public static int HOLE = 2;
+
+ private GraphVertex vert;
+ private HEdge prev = null;
+ private HEdge next = null;
+ private HEdge sibling = null;
+ private int type = BOUNDARY;
+ private Triangle triangle = null;
+
+ public HEdge(GraphVertex vert, int type) {
+ this.vert = vert;
+ this.type = type;
+ }
+
+ public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type) {
+ this.vert = vert;
+ this.prev = prev;
+ this.next = next;
+ this.sibling = sibling;
+ this.type = type;
+ }
+
+ public HEdge(GraphVertex vert, HEdge prev, HEdge next, HEdge sibling, int type, Triangle triangle) {
+ this.vert = vert;
+ this.prev = prev;
+ this.next = next;
+ this.sibling = sibling;
+ this.type = type;
+ this.triangle = triangle;
+ }
+
+ public GraphVertex getGraphPoint() {
+ return vert;
+ }
+
+ public void setVert(GraphVertex vert) {
+ this.vert = vert;
+ }
+
+ public HEdge getPrev() {
+ return prev;
+ }
+
+ public void setPrev(HEdge prev) {
+ this.prev = prev;
+ }
+
+ public HEdge getNext() {
+ return next;
+ }
+
+ public void setNext(HEdge next) {
+ this.next = next;
+ }
+
+ public HEdge getSibling() {
+ return sibling;
+ }
+
+ public void setSibling(HEdge sibling) {
+ this.sibling = sibling;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public Triangle getTriangle() {
+ return triangle;
+ }
+
+ public void setTriangle(Triangle triangle) {
+ this.triangle = triangle;
+ }
+
+ public static <T extends Vertex> void connect(HEdge first, HEdge next){
+ first.setNext(next);
+ next.setPrev(first);
+ }
+
+ public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){
+ first.setSibling(second);
+ second.setSibling(first);
+ }
+
+ public boolean vertexOnCurveVertex(){
+ return vert.getPoint().isOnCurve();
+ }
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index fd7736a20..9e29d3973 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -36,338 +36,338 @@ import com.jogamp.graph.geom.Triangle;
import com.jogamp.graph.math.VectorUtil;
public class Loop {
- private HEdge root = null;
- private AABBox box = new AABBox();
- private GraphOutline initialOutline = null;
-
- public Loop(GraphOutline polyline, int direction){
- initialOutline = polyline;
- this.root = initFromPolyline(initialOutline, direction);
- }
-
- public HEdge getHEdge(){
- return root;
- }
-
- public Triangle cut(boolean delaunay){
- if(isSimplex()){
- Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
- root.getNext().getNext().getGraphPoint().getPoint());
- t.setVerticesBoundary(checkVerticesBoundary(root));
- return t;
- }
- HEdge prev = root.getPrev();
- HEdge next1 = root.getNext();
-
- HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay);
- if(next2 == null){
- root = root.getNext();
- return null;
- }
-
- GraphVertex v1 = root.getGraphPoint();
- GraphVertex v2 = next1.getGraphPoint();
- GraphVertex v3 = next2.getGraphPoint();
-
- HEdge v3Edge = new HEdge(v3, HEdge.INNER);
-
- HEdge.connect(v3Edge, root);
- HEdge.connect(next1, v3Edge);
-
- HEdge v3EdgeSib = v3Edge.getSibling();
- if(v3EdgeSib == null){
- v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER);
- HEdge.makeSiblings(v3Edge, v3EdgeSib);
- }
-
- HEdge.connect(prev, v3EdgeSib);
- HEdge.connect(v3EdgeSib, next2);
-
- Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
- this.root = next2;
- return t;
- }
-
- public boolean isSimplex(){
- return (root.getNext().getNext().getNext() == root);
- }
-
- /**Create a connected list of half edges (loop)
- * from the boundary profile
- * @param direction requested winding of edges (CCW or CW)
- */
- private HEdge initFromPolyline(GraphOutline outline, int direction){
- ArrayList<GraphVertex> vertices = outline.getGraphPoint();
-
- if(vertices.size()<3) {
- throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size());
- }
- boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(),
- vertices.get(2).getPoint());
- boolean invert = isCCW && (direction == VectorUtil.CW);
-
- HEdge firstEdge = null;
- HEdge lastEdge = null;
- int index =0;
- int max = vertices.size();
-
- int edgeType = HEdge.BOUNDARY;
- if(invert){
- index = vertices.size() -1;
- max = -1;
- edgeType = HEdge.HOLE;
- }
-
- while(index != max){
- GraphVertex v1 = vertices.get(index);
- box.resize(v1.getX(), v1.getY(), v1.getZ());
-
- HEdge edge = new HEdge(v1, edgeType);
-
- v1.addEdge(edge);
- if(lastEdge != null){
- lastEdge.setNext(edge);
- edge.setPrev(lastEdge);
- }
- else{
- firstEdge = edge;
- }
-
- if(!invert){
- if(index == vertices.size()-1){
- edge.setNext(firstEdge);
- firstEdge.setPrev(edge);
- }
- }
- else if (index == 0){
- edge.setNext(firstEdge);
- firstEdge.setPrev(edge);
- }
-
- lastEdge = edge;
-
- if(!invert){
- index++;
- }
- else{
- index--;
- }
- }
- return firstEdge;
- }
-
- public void addConstraintCurve(GraphOutline polyline) {
- // GraphOutline outline = new GraphOutline(polyline);
- /**needed to generate vertex references.*/
- initFromPolyline(polyline, VectorUtil.CW);
-
- GraphVertex v3 = locateClosestVertex(polyline);
- HEdge v3Edge = v3.findBoundEdge();
- HEdge v3EdgeP = v3Edge.getPrev();
- HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER);
-
- HEdge.connect(root.getPrev(), crossEdge);
- HEdge.connect(crossEdge, v3Edge);
-
- HEdge crossEdgeSib = crossEdge.getSibling();
- if(crossEdgeSib == null) {
- crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER);
- HEdge.makeSiblings(crossEdge, crossEdgeSib);
- }
-
- HEdge.connect(v3EdgeP, crossEdgeSib);
- HEdge.connect(crossEdgeSib, root);
- }
-
- /** Locates the vertex and update the loops root
- * to have (root + vertex) as closest pair
- * @param polyline the control polyline
- * to search for closestvertices
- * @return the vertex that is closest to the newly set root Hedge.
- */
- private GraphVertex locateClosestVertex(GraphOutline polyline) {
- HEdge closestE = null;
- GraphVertex closestV = null;
-
- float minDistance = Float.MAX_VALUE;
- boolean inValid = false;
- ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint();
- ArrayList<GraphVertex> vertices = polyline.getGraphPoint();
-
- for(int i=0; i< initVertices.size()-1; i++){
- GraphVertex v = initVertices.get(i);
- GraphVertex nextV = initVertices.get(i+1);
- for(GraphVertex cand:vertices){
- float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord());
- if(distance < minDistance){
- for (GraphVertex vert:vertices){
- if(vert == v || vert == nextV || vert == cand)
- continue;
- inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(),
- cand.getPoint(), vert.getPoint());
- if(inValid){
- break;
- }
- }
- if(!inValid){
- closestV = cand;
- minDistance = distance;
- closestE = v.findBoundEdge();
- }
- }
-
- }
- }
-
- if(closestE != null){
- root = closestE;
- }
-
- return closestV;
- }
-
- private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) {
- HEdge next = root.getNext();
-
- if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
- edge.getGraphPoint().getPoint())){
- return null;
- }
-
- HEdge candEdge = edge;
- boolean inValid = false;
-
- if(delaunay){
- Vertex cand = candEdge.getGraphPoint().getPoint();
- HEdge e = candEdge.getNext();
- while (e != candEdge){
- if(e.getGraphPoint() == root.getGraphPoint()
- || e.getGraphPoint() == next.getGraphPoint()
- || e.getGraphPoint().getPoint() == cand){
- e = e.getNext();
- continue;
- }
- inValid = VectorUtil.inCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
- cand, e.getGraphPoint().getPoint());
- if(inValid){
- break;
- }
- e = e.getNext();
- }
- }
- if(!inValid){
- return candEdge;
- }
- return null;
- }
-
- /** Create a triangle from the param vertices only if
- * the triangle is valid. IE not outside region.
- * @param v1 vertex 1
- * @param v2 vertex 2
- * @param v3 vertex 3
- * @param root and edge of this triangle
- * @return the triangle iff it satisfies, null otherwise
- */
- private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){
- Triangle t = new Triangle(v1, v2, v3);
- t.setVerticesBoundary(checkVerticesBoundary(rootT));
- return t;
- }
-
- private boolean[] checkVerticesBoundary(HEdge rootT) {
- boolean[] boundary = new boolean[3];
- HEdge e1 = rootT;
- HEdge e2 = rootT.getNext();
- HEdge e3 = rootT.getNext().getNext();
-
- if(e1.getGraphPoint().isBoundaryContained()){
- boundary[0] = true;
- }
- if(e2.getGraphPoint().isBoundaryContained()){
- boundary[1] = true;
- }
- if(e3.getGraphPoint().isBoundaryContained()){
- boundary[2] = true;
- }
- return boundary;
- }
-
-
- /** Check if vertex inside the Loop
- * @param vertex the Vertex
- * @return true if the vertex is inside, false otherwise
- */
- public boolean checkInside(Vertex vertex) {
- if(!box.contains(vertex.getX(), vertex.getY(), vertex.getZ())){
- return false;
- }
-
- float[] center = box.getCenter();
-
- int hits = 0;
- HEdge current = root;
- HEdge next = root.getNext();
- while(next!= root){
- if(current.getType() == HEdge.INNER || next.getType() == HEdge.INNER){
- current = next;
- next = current.getNext();
- continue;
- }
- Vertex vert1 = current.getGraphPoint().getPoint();
- Vertex vert2 = next.getGraphPoint().getPoint();
-
- /** The ray is P0+s*D0, where P0 is the ray origin, D0 is a direction vector and s >= 0.
- * The segment is P1+t*D1, where P1 and P1+D1 are the endpoints, and 0 <= t <= 1.
- * perp(x,y) = (y,-x).
- * if Dot(perp(D1),D0) is not zero,
- * s = Dot(perp(D1),P1-P0)/Dot(perp(D1),D0)
- * t = Dot(perp(D0),P1-P0)/Dot(perp(D1),D0)
- */
-
- float[] d0 = new float[]{center[0] - vertex.getX(), center[1]-vertex.getY(),
- center[2]-vertex.getZ()};
- float[] d1 = {vert2.getX() - vert1.getX(), vert2.getY() - vert1.getY(),
- vert2.getZ() - vert1.getZ()};
-
- float[] prep_d1 = {d1[1],-1*d1[0], d1[2]};
- float[] prep_d0 = {d0[1],-1*d0[0], d0[2]};
-
- float[] p0p1 = new float[]{vert1.getX() - vertex.getX(), vert1.getY() - vertex.getY(),
- vert1.getZ() - vertex.getZ()};
-
- float dotD1D0 = VectorUtil.dot(prep_d1, d0);
- if(dotD1D0 == 0){
- /** ray parallel to segment */
- current = next;
- next = current.getNext();
- continue;
- }
-
- float s = VectorUtil.dot(prep_d1,p0p1)/dotD1D0;
- float t = VectorUtil.dot(prep_d0,p0p1)/dotD1D0;
-
- if(s >= 0 && t >= 0 && t<= 1){
- hits++;
- }
- current = next;
- next = current.getNext();
- }
-
- if(hits % 2 != 0){
- /** check if hit count is even */
- return true;
- }
- return false;
- }
-
- public int computeLoopSize(){
- int size = 0;
- HEdge e = root;
- do{
- size++;
- e = e.getNext();
- }while(e != root);
- return size;
- }
+ private HEdge root = null;
+ private AABBox box = new AABBox();
+ private GraphOutline initialOutline = null;
+
+ public Loop(GraphOutline polyline, int direction){
+ initialOutline = polyline;
+ this.root = initFromPolyline(initialOutline, direction);
+ }
+
+ public HEdge getHEdge(){
+ return root;
+ }
+
+ public Triangle cut(boolean delaunay){
+ if(isSimplex()){
+ Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
+ root.getNext().getNext().getGraphPoint().getPoint());
+ t.setVerticesBoundary(checkVerticesBoundary(root));
+ return t;
+ }
+ HEdge prev = root.getPrev();
+ HEdge next1 = root.getNext();
+
+ HEdge next2 = findClosestValidNeighbor(next1.getNext(), delaunay);
+ if(next2 == null){
+ root = root.getNext();
+ return null;
+ }
+
+ GraphVertex v1 = root.getGraphPoint();
+ GraphVertex v2 = next1.getGraphPoint();
+ GraphVertex v3 = next2.getGraphPoint();
+
+ HEdge v3Edge = new HEdge(v3, HEdge.INNER);
+
+ HEdge.connect(v3Edge, root);
+ HEdge.connect(next1, v3Edge);
+
+ HEdge v3EdgeSib = v3Edge.getSibling();
+ if(v3EdgeSib == null){
+ v3EdgeSib = new HEdge(v3Edge.getNext().getGraphPoint(), HEdge.INNER);
+ HEdge.makeSiblings(v3Edge, v3EdgeSib);
+ }
+
+ HEdge.connect(prev, v3EdgeSib);
+ HEdge.connect(v3EdgeSib, next2);
+
+ Triangle t = createTriangle(v1.getPoint(), v2.getPoint(), v3.getPoint(), root);
+ this.root = next2;
+ return t;
+ }
+
+ public boolean isSimplex(){
+ return (root.getNext().getNext().getNext() == root);
+ }
+
+ /**Create a connected list of half edges (loop)
+ * from the boundary profile
+ * @param direction requested winding of edges (CCW or CW)
+ */
+ private HEdge initFromPolyline(GraphOutline outline, int direction){
+ ArrayList<GraphVertex> vertices = outline.getGraphPoint();
+
+ if(vertices.size()<3) {
+ throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size());
+ }
+ boolean isCCW = VectorUtil.ccw(vertices.get(0).getPoint(), vertices.get(1).getPoint(),
+ vertices.get(2).getPoint());
+ boolean invert = isCCW && (direction == VectorUtil.CW);
+
+ HEdge firstEdge = null;
+ HEdge lastEdge = null;
+ int index =0;
+ int max = vertices.size();
+
+ int edgeType = HEdge.BOUNDARY;
+ if(invert){
+ index = vertices.size() -1;
+ max = -1;
+ edgeType = HEdge.HOLE;
+ }
+
+ while(index != max){
+ GraphVertex v1 = vertices.get(index);
+ box.resize(v1.getX(), v1.getY(), v1.getZ());
+
+ HEdge edge = new HEdge(v1, edgeType);
+
+ v1.addEdge(edge);
+ if(lastEdge != null){
+ lastEdge.setNext(edge);
+ edge.setPrev(lastEdge);
+ }
+ else{
+ firstEdge = edge;
+ }
+
+ if(!invert){
+ if(index == vertices.size()-1){
+ edge.setNext(firstEdge);
+ firstEdge.setPrev(edge);
+ }
+ }
+ else if (index == 0){
+ edge.setNext(firstEdge);
+ firstEdge.setPrev(edge);
+ }
+
+ lastEdge = edge;
+
+ if(!invert){
+ index++;
+ }
+ else{
+ index--;
+ }
+ }
+ return firstEdge;
+ }
+
+ public void addConstraintCurve(GraphOutline polyline) {
+ // GraphOutline outline = new GraphOutline(polyline);
+ /**needed to generate vertex references.*/
+ initFromPolyline(polyline, VectorUtil.CW);
+
+ GraphVertex v3 = locateClosestVertex(polyline);
+ HEdge v3Edge = v3.findBoundEdge();
+ HEdge v3EdgeP = v3Edge.getPrev();
+ HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER);
+
+ HEdge.connect(root.getPrev(), crossEdge);
+ HEdge.connect(crossEdge, v3Edge);
+
+ HEdge crossEdgeSib = crossEdge.getSibling();
+ if(crossEdgeSib == null) {
+ crossEdgeSib = new HEdge(crossEdge.getNext().getGraphPoint(), HEdge.INNER);
+ HEdge.makeSiblings(crossEdge, crossEdgeSib);
+ }
+
+ HEdge.connect(v3EdgeP, crossEdgeSib);
+ HEdge.connect(crossEdgeSib, root);
+ }
+
+ /** Locates the vertex and update the loops root
+ * to have (root + vertex) as closest pair
+ * @param polyline the control polyline
+ * to search for closestvertices
+ * @return the vertex that is closest to the newly set root Hedge.
+ */
+ private GraphVertex locateClosestVertex(GraphOutline polyline) {
+ HEdge closestE = null;
+ GraphVertex closestV = null;
+
+ float minDistance = Float.MAX_VALUE;
+ boolean inValid = false;
+ ArrayList<GraphVertex> initVertices = initialOutline.getGraphPoint();
+ ArrayList<GraphVertex> vertices = polyline.getGraphPoint();
+
+ for(int i=0; i< initVertices.size()-1; i++){
+ GraphVertex v = initVertices.get(i);
+ GraphVertex nextV = initVertices.get(i+1);
+ for(GraphVertex cand:vertices){
+ float distance = VectorUtil.computeLength(v.getCoord(), cand.getCoord());
+ if(distance < minDistance){
+ for (GraphVertex vert:vertices){
+ if(vert == v || vert == nextV || vert == cand)
+ continue;
+ inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(),
+ cand.getPoint(), vert.getPoint());
+ if(inValid){
+ break;
+ }
+ }
+ if(!inValid){
+ closestV = cand;
+ minDistance = distance;
+ closestE = v.findBoundEdge();
+ }
+ }
+
+ }
+ }
+
+ if(closestE != null){
+ root = closestE;
+ }
+
+ return closestV;
+ }
+
+ private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) {
+ HEdge next = root.getNext();
+
+ if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
+ edge.getGraphPoint().getPoint())){
+ return null;
+ }
+
+ HEdge candEdge = edge;
+ boolean inValid = false;
+
+ if(delaunay){
+ Vertex cand = candEdge.getGraphPoint().getPoint();
+ HEdge e = candEdge.getNext();
+ while (e != candEdge){
+ if(e.getGraphPoint() == root.getGraphPoint()
+ || e.getGraphPoint() == next.getGraphPoint()
+ || e.getGraphPoint().getPoint() == cand){
+ e = e.getNext();
+ continue;
+ }
+ inValid = VectorUtil.inCircle(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(),
+ cand, e.getGraphPoint().getPoint());
+ if(inValid){
+ break;
+ }
+ e = e.getNext();
+ }
+ }
+ if(!inValid){
+ return candEdge;
+ }
+ return null;
+ }
+
+ /** Create a triangle from the param vertices only if
+ * the triangle is valid. IE not outside region.
+ * @param v1 vertex 1
+ * @param v2 vertex 2
+ * @param v3 vertex 3
+ * @param root and edge of this triangle
+ * @return the triangle iff it satisfies, null otherwise
+ */
+ private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){
+ Triangle t = new Triangle(v1, v2, v3);
+ t.setVerticesBoundary(checkVerticesBoundary(rootT));
+ return t;
+ }
+
+ private boolean[] checkVerticesBoundary(HEdge rootT) {
+ boolean[] boundary = new boolean[3];
+ HEdge e1 = rootT;
+ HEdge e2 = rootT.getNext();
+ HEdge e3 = rootT.getNext().getNext();
+
+ if(e1.getGraphPoint().isBoundaryContained()){
+ boundary[0] = true;
+ }
+ if(e2.getGraphPoint().isBoundaryContained()){
+ boundary[1] = true;
+ }
+ if(e3.getGraphPoint().isBoundaryContained()){
+ boundary[2] = true;
+ }
+ return boundary;
+ }
+
+
+ /** Check if vertex inside the Loop
+ * @param vertex the Vertex
+ * @return true if the vertex is inside, false otherwise
+ */
+ public boolean checkInside(Vertex vertex) {
+ if(!box.contains(vertex.getX(), vertex.getY(), vertex.getZ())){
+ return false;
+ }
+
+ float[] center = box.getCenter();
+
+ int hits = 0;
+ HEdge current = root;
+ HEdge next = root.getNext();
+ while(next!= root){
+ if(current.getType() == HEdge.INNER || next.getType() == HEdge.INNER){
+ current = next;
+ next = current.getNext();
+ continue;
+ }
+ Vertex vert1 = current.getGraphPoint().getPoint();
+ Vertex vert2 = next.getGraphPoint().getPoint();
+
+ /** The ray is P0+s*D0, where P0 is the ray origin, D0 is a direction vector and s >= 0.
+ * The segment is P1+t*D1, where P1 and P1+D1 are the endpoints, and 0 <= t <= 1.
+ * perp(x,y) = (y,-x).
+ * if Dot(perp(D1),D0) is not zero,
+ * s = Dot(perp(D1),P1-P0)/Dot(perp(D1),D0)
+ * t = Dot(perp(D0),P1-P0)/Dot(perp(D1),D0)
+ */
+
+ float[] d0 = new float[]{center[0] - vertex.getX(), center[1]-vertex.getY(),
+ center[2]-vertex.getZ()};
+ float[] d1 = {vert2.getX() - vert1.getX(), vert2.getY() - vert1.getY(),
+ vert2.getZ() - vert1.getZ()};
+
+ float[] prep_d1 = {d1[1],-1*d1[0], d1[2]};
+ float[] prep_d0 = {d0[1],-1*d0[0], d0[2]};
+
+ float[] p0p1 = new float[]{vert1.getX() - vertex.getX(), vert1.getY() - vertex.getY(),
+ vert1.getZ() - vertex.getZ()};
+
+ float dotD1D0 = VectorUtil.dot(prep_d1, d0);
+ if(dotD1D0 == 0){
+ /** ray parallel to segment */
+ current = next;
+ next = current.getNext();
+ continue;
+ }
+
+ float s = VectorUtil.dot(prep_d1,p0p1)/dotD1D0;
+ float t = VectorUtil.dot(prep_d0,p0p1)/dotD1D0;
+
+ if(s >= 0 && t >= 0 && t<= 1){
+ hits++;
+ }
+ current = next;
+ next = current.getNext();
+ }
+
+ if(hits % 2 != 0){
+ /** check if hit count is even */
+ return true;
+ }
+ return false;
+ }
+
+ public int computeLoopSize(){
+ int size = 0;
+ HEdge e = root;
+ do{
+ size++;
+ e = e.getNext();
+ }while(e != root);
+ return size;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
index 36ba57244..4d1880064 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
@@ -38,124 +38,124 @@ import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.math.Quaternion;
public class GlyphShape {
-
- private Quaternion quat= null;
- private int numVertices = 0;
- private OutlineShape shape = null;
-
- /** Create a new Glyph shape
- * based on Parametric curve control polyline
- */
- public GlyphShape(Vertex.Factory<? extends Vertex> factory){
- shape = new OutlineShape(factory);
- }
-
- /** Create a GlyphShape from a font Path Iterator
- * @param pathIterator the path iterator
- *
- * @see PathIterator
- */
- public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){
- this(factory);
-
- if(null != pathIterator){
- while(!pathIterator.isDone()){
- float[] coords = new float[6];
- int segmentType = pathIterator.currentSegment(coords);
- addOutlineVerticesFromGlyphVector(coords, segmentType);
+
+ private Quaternion quat= null;
+ private int numVertices = 0;
+ private OutlineShape shape = null;
+
+ /** Create a new Glyph shape
+ * based on Parametric curve control polyline
+ */
+ public GlyphShape(Vertex.Factory<? extends Vertex> factory){
+ shape = new OutlineShape(factory);
+ }
+
+ /** Create a GlyphShape from a font Path Iterator
+ * @param pathIterator the path iterator
+ *
+ * @see PathIterator
+ */
+ public GlyphShape(Vertex.Factory<? extends Vertex> factory, PathIterator pathIterator){
+ this(factory);
+
+ if(null != pathIterator){
+ while(!pathIterator.isDone()){
+ float[] coords = new float[6];
+ int segmentType = pathIterator.currentSegment(coords);
+ addOutlineVerticesFromGlyphVector(coords, segmentType);
- pathIterator.next();
- }
- }
- shape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
- }
-
- public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); }
-
- private void addVertexToLastOutline(Vertex vertex){
- shape.addVertex(vertex);
- }
-
- private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){
- if(segmentType == PathIterator.SEG_MOVETO){
- if(!shape.getLastOutline().isEmpty()){
- shape.addEmptyOutline();
- }
- Vertex vert = vertexFactory().create(coords[0],coords[1]);
- vert.setOnCurve(true);
- addVertexToLastOutline(vert);
-
- numVertices++;
- }
- else if(segmentType == PathIterator.SEG_LINETO){
- Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
- vert1.setOnCurve(true);
- addVertexToLastOutline(vert1);
-
- numVertices++;
- }
- else if(segmentType == PathIterator.SEG_QUADTO){
- Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
- vert1.setOnCurve(false);
- addVertexToLastOutline(vert1);
+ pathIterator.next();
+ }
+ }
+ shape.transformOutlines(OutlineShape.QUADRATIC_NURBS);
+ }
+
+ public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); }
+
+ private void addVertexToLastOutline(Vertex vertex){
+ shape.addVertex(vertex);
+ }
+
+ private void addOutlineVerticesFromGlyphVector(float[] coords, int segmentType){
+ if(segmentType == PathIterator.SEG_MOVETO){
+ if(!shape.getLastOutline().isEmpty()){
+ shape.addEmptyOutline();
+ }
+ Vertex vert = vertexFactory().create(coords[0],coords[1]);
+ vert.setOnCurve(true);
+ addVertexToLastOutline(vert);
+
+ numVertices++;
+ }
+ else if(segmentType == PathIterator.SEG_LINETO){
+ Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
+ vert1.setOnCurve(true);
+ addVertexToLastOutline(vert1);
+
+ numVertices++;
+ }
+ else if(segmentType == PathIterator.SEG_QUADTO){
+ Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
+ vert1.setOnCurve(false);
+ addVertexToLastOutline(vert1);
- Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
- vert2.setOnCurve(true);
- addVertexToLastOutline(vert2);
-
- numVertices+=2;
- }
- else if(segmentType == PathIterator.SEG_CUBICTO){
- Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
- vert1.setOnCurve(false);
- addVertexToLastOutline(vert1);
+ Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
+ vert2.setOnCurve(true);
+ addVertexToLastOutline(vert2);
+
+ numVertices+=2;
+ }
+ else if(segmentType == PathIterator.SEG_CUBICTO){
+ Vertex vert1 = vertexFactory().create(coords[0],coords[1]);
+ vert1.setOnCurve(false);
+ addVertexToLastOutline(vert1);
- Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
- vert2.setOnCurve(false);
- addVertexToLastOutline(vert2);
+ Vertex vert2 = vertexFactory().create(coords[2],coords[3]);
+ vert2.setOnCurve(false);
+ addVertexToLastOutline(vert2);
- Vertex vert3 = vertexFactory().create(coords[4],coords[5]);
- vert3.setOnCurve(true);
- addVertexToLastOutline(vert3);
-
- numVertices+=3;
- }
- else if(segmentType == PathIterator.SEG_CLOSE){
- shape.closeLastOutline();
- }
- }
-
- public int getNumVertices() {
- return numVertices;
- }
-
- /** Get the rotational Quaternion attached to this Shape
- * @return the Quaternion Object
- */
- public Quaternion getQuat() {
- return quat;
- }
-
- /** Set the Quaternion that shall defien the rotation
- * of this shape.
- * @param quat
- */
- public void setQuat(Quaternion quat) {
- this.quat = quat;
- }
-
- /** Triangluate the glyph shape
- * @param sharpness sharpness of the curved regions default = 0.5
- * @return ArrayList of triangles which define this shape
- */
- public ArrayList<Triangle> triangulate(float sharpness){
- return shape.triangulate(sharpness);
- }
+ Vertex vert3 = vertexFactory().create(coords[4],coords[5]);
+ vert3.setOnCurve(true);
+ addVertexToLastOutline(vert3);
+
+ numVertices+=3;
+ }
+ else if(segmentType == PathIterator.SEG_CLOSE){
+ shape.closeLastOutline();
+ }
+ }
+
+ public int getNumVertices() {
+ return numVertices;
+ }
+
+ /** Get the rotational Quaternion attached to this Shape
+ * @return the Quaternion Object
+ */
+ public Quaternion getQuat() {
+ return quat;
+ }
+
+ /** Set the Quaternion that shall defien the rotation
+ * of this shape.
+ * @param quat
+ */
+ public void setQuat(Quaternion quat) {
+ this.quat = quat;
+ }
+
+ /** Triangluate the glyph shape
+ * @param sharpness sharpness of the curved regions default = 0.5
+ * @return ArrayList of triangles which define this shape
+ */
+ public ArrayList<Triangle> triangulate(float sharpness){
+ return shape.triangulate(sharpness);
+ }
- /** Get the list of Vertices of this Object
- * @return arrayList of Vertices
- */
- public ArrayList<Vertex> getVertices(){
- return shape.getVertices();
- }
+ /** Get the list of Vertices of this Object
+ * @return arrayList of Vertices
+ */
+ public ArrayList<Vertex> getVertices(){
+ return shape.getVertices();
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
index 808e3a415..1faee87ff 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
@@ -29,11 +29,13 @@ package jogamp.graph.curve.text;
import java.util.ArrayList;
+import com.jogamp.graph.geom.AABBox;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Triangle;
+import com.jogamp.graph.geom.Vertex.Factory;
import com.jogamp.graph.geom.opengl.SVertex;
-import javax.media.opengl.GLContext;
+import javax.media.opengl.GL2ES2;
import jogamp.graph.geom.plane.AffineTransform;
import jogamp.graph.geom.plane.Path2D;
@@ -42,122 +44,124 @@ import jogamp.graph.geom.plane.PathIterator;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.RegionFactory;
-import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.opengl.util.glsl.ShaderState;
public class GlyphString {
- private final Vertex.Factory<? extends Vertex> pointFactory;
- private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>();
- private String str = "";
- private String fontname = "";
- private Region region;
-
- private SVertex origin = new SVertex();
+ private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>();
+ private String str = "";
+ private String fontname = "";
+ private Region region;
+
+ private SVertex origin = new SVertex();
- /** Create a new GlyphString object
- * @param fontname the name of the font that this String is
- * associated with
- * @param str the string object
- */
- public GlyphString(Vertex.Factory<? extends Vertex> factory, String fontname, String str){
- pointFactory = factory;
- this.fontname = fontname;
- this.str = str;
- }
-
- public final Vertex.Factory<? extends Vertex> pointFactory() { return pointFactory; }
-
- public void addGlyphShape(GlyphShape glyph){
- glyphs.add(glyph);
- }
- public String getString(){
- return str;
- }
+ /** Create a new GlyphString object
+ * @param fontname the name of the font that this String is
+ * associated with
+ * @param str the string object
+ */
+ public GlyphString(String fontname, String str){
+ this.fontname = fontname;
+ this.str = str;
+ }
+
+ public void addGlyphShape(GlyphShape glyph){
+ glyphs.add(glyph);
+ }
+ public String getString(){
+ return str;
+ }
- /** Creates the Curve based Glyphs from a Font
- * @param paths a list of FontPath2D objects that define the outline
- * @param affineTransform a global affine transformation applied to the paths.
- */
- public void createfromFontPath(Path2D[] paths, AffineTransform affineTransform){
- final int numGlyps = paths.length;
- for (int index=0;index<numGlyps;index++){
- if(paths[index] == null){
- continue;
- }
- PathIterator iterator = paths[index].iterator(affineTransform);
- GlyphShape glyphShape = new GlyphShape(pointFactory, iterator);
-
- if(glyphShape.getNumVertices() < 3) {
- continue;
- }
- addGlyphShape(glyphShape);
- }
- }
-
- private ArrayList<Triangle> initializeTriangles(float sharpness){
- ArrayList<Triangle> triangles = new ArrayList<Triangle>();
- for(GlyphShape glyph:glyphs){
- ArrayList<Triangle> tris = glyph.triangulate(sharpness);
- triangles.addAll(tris);
- }
- return triangles;
- }
-
- /** Generate a OGL Region to represent this Object.
- * @param context the GLContext which the region is defined by.
- * @param shaprness the curvature sharpness of the object.
- * @param st shader state
- */
- public void generateRegion(GLContext context, float shaprness, ShaderState st, int type){
- region = RegionFactory.create(context, st, type);
- region.setFlipped(true);
-
- ArrayList<Triangle> tris = initializeTriangles(shaprness);
- region.addTriangles(tris);
-
- int numVertices = region.getNumVertices();
- for(GlyphShape glyph:glyphs){
- ArrayList<Vertex> gVertices = glyph.getVertices();
- for(Vertex vert:gVertices){
- vert.setId(numVertices++);
- }
- region.addVertices(gVertices);
- }
-
- /** initialize the region */
- region.update();
- }
-
- /** Generate a Hashcode for this object
- * @return a string defining the hashcode
- */
- public String getTextHashCode(){
- return "" + fontname.hashCode() + str.hashCode();
- }
+ /** Creates the Curve based Glyphs from a Font
+ * @param pointFactory TODO
+ * @param paths a list of FontPath2D objects that define the outline
+ * @param affineTransform a global affine transformation applied to the paths.
+ */
+ public void createfromFontPath(Factory<? extends Vertex> pointFactory, Path2D[] paths, AffineTransform affineTransform) {
+ final int numGlyps = paths.length;
+ for (int index=0;index<numGlyps;index++){
+ if(paths[index] == null){
+ continue;
+ }
+ PathIterator iterator = paths[index].iterator(affineTransform);
+ GlyphShape glyphShape = new GlyphShape(pointFactory, iterator);
+
+ if(glyphShape.getNumVertices() < 3) {
+ continue;
+ }
+ addGlyphShape(glyphShape);
+ }
+ }
+
+ private ArrayList<Triangle> initializeTriangles(float sharpness){
+ ArrayList<Triangle> triangles = new ArrayList<Triangle>();
+ for(GlyphShape glyph:glyphs){
+ ArrayList<Triangle> tris = glyph.triangulate(sharpness);
+ triangles.addAll(tris);
+ }
+ return triangles;
+ }
+
+ /** Generate a OGL Region to represent this Object.
+ * @param context the GLContext which the region is defined by.
+ * @param shaprness the curvature sharpness of the object.
+ * @param st shader state
+ */
+ public void generateRegion(GL2ES2 gl, RenderState rs, int type){
+ region = RegionFactory.create(rs, type);
+ region.setFlipped(true);
+
+ ArrayList<Triangle> tris = initializeTriangles(rs.getSharpness().floatValue());
+ region.addTriangles(tris);
+
+ int numVertices = region.getNumVertices();
+ for(GlyphShape glyph:glyphs){
+ ArrayList<Vertex> gVertices = glyph.getVertices();
+ for(Vertex vert:gVertices){
+ vert.setId(numVertices++);
+ }
+ region.addVertices(gVertices);
+ }
+
+ /** initialize the region */
+ region.update(gl);
+ }
+
+ /** Generate a Hashcode for this object
+ * @return a string defining the hashcode
+ */
+ public String getTextHashCode(){
+ return "" + fontname.hashCode() + str.hashCode();
+ }
- /** Render the Object based using the associated Region
- * previously generated.
- */
- public void renderString3D() {
- region.render(null, 0, 0, 0);
- }
- /** Render the Object based using the associated Region
- * previously generated.
- */
- public void renderString3D(PMVMatrix matrix, int vp_width, int vp_height, int size) {
- region.render(matrix, vp_width, vp_height, size);
- }
-
- /** Get the Origion of this GlyphString
- * @return
- */
- public Vertex getOrigin() {
- return origin;
- }
+ /** Render the Object based using the associated Region
+ * previously generated.
+ */
+ public void renderString3D(GL2ES2 gl) {
+ region.render(gl, null, 0, 0, 0);
+ }
+ /** Render the Object based using the associated Region
+ * previously generated.
+ */
+ public void renderString3D(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int size) {
+ region.render(gl, rs, vp_width, vp_height, size);
+ }
+
+ /** Get the Origin of this GlyphString
+ * @return
+ */
+ public Vertex getOrigin() {
+ return origin;
+ }
- /** Destroy the associated OGL objects
- */
- public void destroy(){
- region.destroy();
- }
+ /** Destroy the associated OGL objects
+ * @param rs TODO
+ */
+ public void destroy(GL2ES2 gl, RenderState rs){
+ region.destroy(gl, rs);
+ }
+
+ public AABBox getBounds(){
+ return region.getBounds();
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
index a9ab902a9..bead9a5d2 100644
--- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
@@ -74,7 +74,7 @@ public class JavaFontLoader implements FontSet {
return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
}
- public Font get(int family, int style) {
+ public Font get(int family, int style) {
Font font = (Font)fontMap.get( ( family << 8 ) | style );
if (font != null) {
return font;
@@ -121,7 +121,7 @@ public class JavaFontLoader implements FontSet {
return font;
}
-
+
Font abspath(String fname, int family, int style) {
final String err = "Problem loading font "+fname+", file "+javaFontPath+fname ;
diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
index 3614add5c..31990af37 100644
--- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
@@ -58,9 +58,7 @@ public class UbuntuFontLoader implements FontSet {
};
- final static String relPath = "fonts/ubuntu/" ;
- // debug final static String relPath = "/usr/local/projects/JOGL/jogl/src/jogl/classes/jogamp/graph/font/fonts/ubuntu/" ;
-
+ final static String relPath = "fonts/ubuntu/" ;
private UbuntuFontLoader() {
}
@@ -76,8 +74,8 @@ public class UbuntuFontLoader implements FontSet {
return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
}
- public Font get(int family, int style)
- {
+ public Font get(int family, int style)
+ {
Font font = (Font)fontMap.get( ( family << 8 ) | style );
if (font != null) {
return font;
@@ -119,7 +117,7 @@ public class UbuntuFontLoader implements FontSet {
return font;
}
-
+
Font abspath(String fname, int family, int style) {
final String err = "Problem loading font "+fname+", stream "+relPath+fname;
try {
@@ -136,5 +134,5 @@ public class UbuntuFontLoader implements FontSet {
} catch(IOException ioe) {
throw new GLException(err, ioe);
}
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index f702b981f..6292c8826 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -43,97 +43,97 @@ import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.geom.AABBox;
class TypecastFont implements FontInt {
- static final boolean DEBUG = false;
-
- final OTFontCollection fontset;
- final OTFont font;
+ static final boolean DEBUG = false;
+
+ final OTFontCollection fontset;
+ final OTFont font;
TypecastHMetrics metrics;
final CmapFormat cmapFormat;
- int cmapentries;
-
- // FIXME: Add cache size to limit memory usage ??
+ int cmapentries;
+
+ // FIXME: Add cache size to limit memory usage ??
IntObjectHashMap char2Glyph;
public TypecastFont(OTFontCollection fontset) {
- this.fontset = fontset;
+ this.fontset = fontset;
this.font = fontset.getFont(0);
// FIXME: Generic attempt to find the best CmapTable,
// which is assumed to be the one with the most entries (stupid 'eh?)
- CmapTable cmapTable = font.getCmapTable();
+ CmapTable cmapTable = font.getCmapTable();
CmapFormat[] _cmapFormatP = { null, null, null, null };
int platform = -1;
int platformLength = -1;
int encoding = -1;
- for(int i=0; i<cmapTable.getNumTables(); i++) {
- CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i);
- int pidx = cmapIdxEntry.getPlatformId();
- CmapFormat cf = cmapIdxEntry.getFormat();
+ for(int i=0; i<cmapTable.getNumTables(); i++) {
+ CmapIndexEntry cmapIdxEntry = cmapTable.getCmapIndexEntry(i);
+ int pidx = cmapIdxEntry.getPlatformId();
+ CmapFormat cf = cmapIdxEntry.getFormat();
if(DEBUG) {
System.err.println("CmapFormat["+i+"]: platform " + pidx +
", encoding "+cmapIdxEntry.getEncodingId() + ": "+cf);
}
- if( _cmapFormatP[pidx] == null ||
- _cmapFormatP[pidx].getLength() < cf.getLength() ) {
- _cmapFormatP[pidx] = cf;
- if( cf.getLength() > platformLength ) {
- platformLength = cf.getLength() ;
- platform = pidx;
- encoding = cmapIdxEntry.getEncodingId();
- }
- }
- }
+ if( _cmapFormatP[pidx] == null ||
+ _cmapFormatP[pidx].getLength() < cf.getLength() ) {
+ _cmapFormatP[pidx] = cf;
+ if( cf.getLength() > platformLength ) {
+ platformLength = cf.getLength() ;
+ platform = pidx;
+ encoding = cmapIdxEntry.getEncodingId();
+ }
+ }
+ }
if(0 <= platform) {
cmapFormat = _cmapFormatP[platform];
if(DEBUG) {
System.err.println("Selected CmapFormat: platform " + platform +
", encoding "+encoding + ": "+cmapFormat);
}
- } else {
- CmapFormat _cmapFormat = null;
- /*if(null == _cmapFormat) {
+ } else {
+ CmapFormat _cmapFormat = null;
+ /*if(null == _cmapFormat) {
platform = ID.platformMacintosh;
encoding = ID.encodingASCII;
- _cmapFormat = cmapTable.getCmapFormat(platform, encoding);
- } */
- if(null == _cmapFormat) {
- // default unicode
- platform = ID.platformMicrosoft;
- encoding = ID.encodingUnicode;
- _cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding);
- }
- if(null == _cmapFormat) {
- // maybe a symbol font ?
+ _cmapFormat = cmapTable.getCmapFormat(platform, encoding);
+ } */
+ if(null == _cmapFormat) {
+ // default unicode
+ platform = ID.platformMicrosoft;
+ encoding = ID.encodingUnicode;
+ _cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding);
+ }
+ if(null == _cmapFormat) {
+ // maybe a symbol font ?
platform = ID.platformMicrosoft;
encoding = ID.encodingSymbol;
_cmapFormat = cmapTable.getCmapFormat((short)platform, (short)encoding);
- }
- if(null == _cmapFormat) {
- throw new RuntimeException("Cannot find a suitable cmap table for font "+font);
- }
+ }
+ if(null == _cmapFormat) {
+ throw new RuntimeException("Cannot find a suitable cmap table for font "+font);
+ }
cmapFormat = _cmapFormat;
if(DEBUG) {
System.err.println("Selected CmapFormat (2): platform " + platform + ", encoding "+encoding + ": "+cmapFormat);
}
}
- cmapentries = 0;
+ cmapentries = 0;
for (int i = 0; i < cmapFormat.getRangeCount(); ++i) {
CmapFormat.Range range = cmapFormat.getRange(i);
cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included
- }
+ }
if(DEBUG) {
- System.err.println("num glyphs: "+font.getNumGlyphs());
- System.err.println("num cmap entries: "+cmapentries);
- System.err.println("num cmap ranges: "+cmapFormat.getRangeCount());
+ System.err.println("num glyphs: "+font.getNumGlyphs());
+ System.err.println("num cmap entries: "+cmapentries);
+ System.err.println("num cmap ranges: "+cmapFormat.getRangeCount());
for (int i = 0; i < cmapFormat.getRangeCount(); ++i) {
CmapFormat.Range range = cmapFormat.getRange(i);
for (int j = range.getStartCode(); j <= range.getEndCode(); ++j) {
- final int code = cmapFormat.mapCharCode(j);
- if(code < 15) {
- System.err.println(" char: " + (int)j + " ( " + (char)j +" ) -> " + code);
- }
+ final int code = cmapFormat.mapCharCode(j);
+ if(code < 15) {
+ System.err.println(" char: " + (int)j + " ( " + (char)j +" ) -> " + code);
+ }
}
}
}
@@ -155,9 +155,9 @@ class TypecastFont implements FontInt {
}
public Glyph getGlyph(char symbol) {
- TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol);
+ TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol);
if (null == result) {
- // final short code = (short) char2Code.get(symbol);
+ // final short code = (short) char2Code.get(symbol);
short code = (short) cmapFormat.mapCharCode(symbol);
if(0 == code && 0 != symbol) {
// reserved special glyph IDs by convention
@@ -168,19 +168,19 @@ class TypecastFont implements FontInt {
}
}
- jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code);
- if(null == glyph) {
- glyph = font.getGlyph(Glyph.ID_UNKNOWN);
- }
- if(null == glyph) {
- throw new RuntimeException("Could not retrieve glyph for symbol: <"+symbol+"> "+(int)symbol+" -> glyph id "+code);
- }
- Path2D path = TypecastRenderer.buildPath(glyph);
- result = new TypecastGlyph(this, symbol, code, glyph.getBBox(), glyph.getAdvanceWidth(), path);
- if(DEBUG) {
- System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path);
- }
- final HdmxTable hdmx = font.getHdmxTable();
+ jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code);
+ if(null == glyph) {
+ glyph = font.getGlyph(Glyph.ID_UNKNOWN);
+ }
+ if(null == glyph) {
+ throw new RuntimeException("Could not retrieve glyph for symbol: <"+symbol+"> "+(int)symbol+" -> glyph id "+code);
+ }
+ Path2D path = TypecastRenderer.buildPath(glyph);
+ result = new TypecastGlyph(this, symbol, code, glyph.getBBox(), glyph.getAdvanceWidth(), path);
+ if(DEBUG) {
+ System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path);
+ }
+ final HdmxTable hdmx = font.getHdmxTable();
if (null!= result && null != hdmx) {
/*if(DEBUG) {
System.err.println("hdmx "+hdmx);
@@ -193,14 +193,14 @@ class TypecastFont implements FontInt {
System.err.println("hdmx advance : pixelsize = "+dr.getWidth(code)+" : "+ dr.getPixelSize());
}
}
- }
- char2Glyph.put(symbol, result);
+ }
+ char2Glyph.put(symbol, result);
}
return result;
}
public void getOutline(String string, float pixelSize, AffineTransform transform, Path2D[] result) {
- TypecastRenderer.getOutline(this, string, pixelSize, transform, result);
+ TypecastRenderer.getOutline(this, string, pixelSize, transform, result);
}
public float getStringWidth(String string, float pixelSize) {
@@ -217,7 +217,7 @@ class TypecastFont implements FontInt {
}
}
- return (int)(width + 0.5f);
+ return (int)(width + 0.5f);
}
public float getStringHeight(String string, float pixelSize) {
@@ -233,7 +233,7 @@ class TypecastFont implements FontInt {
height = (int)Math.ceil(Math.max(bbox.getHeight(), height));
}
}
- return height;
+ return height;
}
public AABBox getStringBounds(CharSequence string, float pixelSize) {
@@ -263,11 +263,11 @@ class TypecastFont implements FontInt {
totalHeight -= advanceY;
totalWidth = Math.max(curLineWidth, totalWidth);
}
- return new AABBox(0, 0, 0, totalWidth, totalHeight,0);
+ return new AABBox(0, 0, 0, totalWidth, totalHeight,0);
}
final public int getNumGlyphs() {
- return font.getNumGlyphs();
+ return font.getNumGlyphs();
}
public boolean isPrintableChar( char c ) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
index 88d865f9c..f20b7d1e7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
@@ -42,7 +42,7 @@ public class TypecastGlyph implements FontInt.Glyph {
final Font font;
final float advance;
HashMap<Float, Float> size2advance = new HashMap<Float, Float>();
-
+
public Advance(Font font, float advance)
{
this.font = font;
@@ -86,12 +86,12 @@ public class TypecastGlyph implements FontInt.Glyph {
"\n advances: \n"+size2advance;
}
}
-
+
public class Metrics
{
- AABBox bbox;
+ AABBox bbox;
Advance advance;
-
+
public Metrics(Font font, AABBox bbox, float advance)
{
this.bbox = bbox;
@@ -128,13 +128,13 @@ public class TypecastGlyph implements FontInt.Glyph {
"\n bbox: "+this.bbox+
this.advance;
}
- }
+ }
public static final short INVALID_ID = (short)((1 << 16) - 1);
public static final short MAX_ID = (short)((1 << 16) - 2);
private final Font font;
-
+
char symbol;
short id;
int advance;
@@ -143,15 +143,15 @@ public class TypecastGlyph implements FontInt.Glyph {
protected Path2D path; // in EM units
protected Path2D pathSized;
protected float numberSized;
-
+
protected TypecastGlyph(Font font, char symbol) {
- this.font = font;
+ this.font = font;
this.symbol = symbol;
}
protected TypecastGlyph(Font font,
- char symbol, short id, AABBox bbox, int advance, Path2D path) {
- this.font = font;
+ char symbol, short id, AABBox bbox, int advance, Path2D path) {
+ this.font = font;
this.symbol = symbol;
this.advance = advance;
@@ -161,7 +161,7 @@ public class TypecastGlyph implements FontInt.Glyph {
this.pathSized = null;
this.numberSized = 0.0f;
}
-
+
void init(short id, AABBox bbox, int advance) {
this.id = id;
this.advance = advance;
@@ -176,11 +176,11 @@ public class TypecastGlyph implements FontInt.Glyph {
public Font getFont() {
return this.font;
}
-
+
public char getSymbol() {
return this.symbol;
}
-
+
AABBox getBBoxUnsized() {
return this.metrics.getBBox();
}
@@ -192,22 +192,22 @@ public class TypecastGlyph implements FontInt.Glyph {
public Metrics getMetrics() {
return this.metrics;
}
-
+
public short getID() {
return this.id;
}
-
+
public float getScale(float pixelSize) {
return this.metrics.getScale(pixelSize);
}
-
+
public AABBox getBBox(float pixelSize) {
final float size = getScale(pixelSize);
AABBox newBox = getBBox().clone();
newBox.scale(size);
return newBox;
}
-
+
protected void addAdvance(float advance, float size) {
this.metrics.addAdvance(advance, size);
}
@@ -217,9 +217,9 @@ public class TypecastGlyph implements FontInt.Glyph {
}
public Path2D getPath() {
- return this.path;
+ return this.path;
}
-
+
public Path2D getPath(float pixelSize) {
final float size = getScale(pixelSize);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
index a69948006..0dd7a6178 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
@@ -34,22 +34,22 @@ import com.jogamp.graph.font.Font.Metrics;
import com.jogamp.graph.geom.AABBox;
class TypecastHMetrics implements Metrics {
- private final TypecastFont fontImpl;
-
- // HeadTable
+ private final TypecastFont fontImpl;
+
+ // HeadTable
private final HeadTable headTable;
- private final float unitsPerEM_Inv;
- private final AABBox bbox;
- // HheaTable
- private final HheaTable hheaTable;
+ private final float unitsPerEM_Inv;
+ private final AABBox bbox;
+ // HheaTable
+ private final HheaTable hheaTable;
// VheaTable (for horizontal fonts)
// private final VheaTable vheaTable;
-
- public TypecastHMetrics(TypecastFont fontImpl) {
- this.fontImpl = fontImpl;
- headTable = this.fontImpl.font.getHeadTable();
- hheaTable = this.fontImpl.font.getHheaTable();
- // vheaTable = this.fontImpl.font.getVheaTable();
+
+ public TypecastHMetrics(TypecastFont fontImpl) {
+ this.fontImpl = fontImpl;
+ headTable = this.fontImpl.font.getHeadTable();
+ hheaTable = this.fontImpl.font.getHheaTable();
+ // vheaTable = this.fontImpl.font.getVheaTable();
unitsPerEM_Inv = 1.0f / ( (float) headTable.getUnitsPerEm() );
int maxWidth = headTable.getXMax() - headTable.getXMin();
@@ -59,8 +59,8 @@ class TypecastHMetrics implements Metrics {
float highx = lowx + maxWidth;
float highy = lowy + maxHeight;
bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert
- }
-
+ }
+
public final float getAscent(float pixelSize) {
return getScale(pixelSize) * -hheaTable.getAscender(); // invert
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
index 9a81d78d3..ab5e673db 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
@@ -40,48 +40,48 @@ import com.jogamp.graph.font.Font;
*/
public class TypecastRenderer {
- public static void getOutline(TypecastFont font,
- String string, float pixelSize, AffineTransform transform, Path2D[] p)
- {
- if (string == null) {
- return;
- }
- Font.Metrics metrics = font.getMetrics();
- float advanceTotal = 0;
- float lineGap = metrics.getLineGap(pixelSize) ;
- float ascent = metrics.getAscent(pixelSize) ;
- float descent = metrics.getDescent(pixelSize) ;
- if (transform == null) {
- transform = new AffineTransform();
- }
- AffineTransform t = new AffineTransform();
+ public static void getOutline(TypecastFont font,
+ String string, float pixelSize, AffineTransform transform, Path2D[] p)
+ {
+ if (string == null) {
+ return;
+ }
+ Font.Metrics metrics = font.getMetrics();
+ float advanceTotal = 0;
+ float lineGap = metrics.getLineGap(pixelSize) ;
+ float ascent = metrics.getAscent(pixelSize) ;
+ float descent = metrics.getDescent(pixelSize) ;
+ if (transform == null) {
+ transform = new AffineTransform();
+ }
+ AffineTransform t = new AffineTransform();
- float advanceY = lineGap - descent + ascent;
- float y = 0;
- for (int i=0; i<string.length(); i++)
- {
- p[i] = new Path2D();
- p[i].reset();
- t.setTransform(transform);
- char character = string.charAt(i);
- if (character == '\n') {
- y -= advanceY;
- advanceTotal = 0;
- continue;
- } else if (character == ' ') {
- advanceTotal += font.font.getHmtxTable().getAdvanceWidth(TypecastGlyph.ID_SPACE) * metrics.getScale(pixelSize);
+ float advanceY = lineGap - descent + ascent;
+ float y = 0;
+ for (int i=0; i<string.length(); i++)
+ {
+ p[i] = new Path2D();
+ p[i].reset();
+ t.setTransform(transform);
+ char character = string.charAt(i);
+ if (character == '\n') {
+ y -= advanceY;
+ advanceTotal = 0;
+ continue;
+ } else if (character == ' ') {
+ advanceTotal += font.font.getHmtxTable().getAdvanceWidth(TypecastGlyph.ID_SPACE) * metrics.getScale(pixelSize);
continue;
}
- TypecastGlyph glyph = (TypecastGlyph) font.getGlyph(character);
- Path2D gp = glyph.getPath();
- float scale = metrics.getScale(pixelSize);
- t.translate(advanceTotal, y);
- t.scale(scale, scale);
- p[i].append(gp.iterator(t), false);
- advanceTotal += glyph.getAdvance(pixelSize, true);
- }
- }
-
+ TypecastGlyph glyph = (TypecastGlyph) font.getGlyph(character);
+ Path2D gp = glyph.getPath();
+ float scale = metrics.getScale(pixelSize);
+ t.translate(advanceTotal, y);
+ t.scale(scale, scale);
+ p[i].append(gp.iterator(t), false);
+ advanceTotal += glyph.getAdvance(pixelSize, true);
+ }
+ }
+
/**
* Build a {@link com.jogamp.graph.geom.Path2D Path2D} from a
* {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}. This glyph path can then
@@ -116,44 +116,44 @@ public class TypecastRenderer {
Point point = glyph.getPoint(startIndex + offset%count);
Point point_plus1 = glyph.getPoint(startIndex + (offset+1)%count);
Point point_plus2 = glyph.getPoint(startIndex + (offset+2)%count);
- if(offset == 0)
+ if(offset == 0)
{
gp.moveTo(point.x, -point.y);
}
-
- if (point.onCurve) {
- if (point_plus1.onCurve) {
- // s = new Line2D.Float(point.x, -point.y, point_plus1.x, -point_plus1.y);
- gp.lineTo( point_plus1.x, -point_plus1.y );
- offset++;
- } else {
- if (point_plus2.onCurve) {
- // s = new QuadCurve2D.Float( point.x, -point.y, point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
- gp.quadTo(point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
- offset+=2;
- } else {
- // s = new QuadCurve2D.Float(point.x,-point.y,point_plus1.x,-point_plus1.y,
- // midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
- gp.quadTo(point_plus1.x, -point_plus1.y, midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
- offset+=2;
- }
- }
- } else {
- if (point_plus1.onCurve) {
- // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y),
- // point.x, -point.y, point_plus1.x, -point_plus1.y);
- //gp.curve3(point_plus1.x, -point_plus1.y, point.x, -point.y);
- gp.quadTo(point.x, -point.y, point_plus1.x, -point_plus1.y);
- offset++;
-
- } else {
- // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), point.x, -point.y,
- // midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
- //gp.curve3(midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y), point.x, -point.y);
- gp.quadTo(point.x, -point.y, midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
- offset++;
- }
- }
+
+ if (point.onCurve) {
+ if (point_plus1.onCurve) {
+ // s = new Line2D.Float(point.x, -point.y, point_plus1.x, -point_plus1.y);
+ gp.lineTo( point_plus1.x, -point_plus1.y );
+ offset++;
+ } else {
+ if (point_plus2.onCurve) {
+ // s = new QuadCurve2D.Float( point.x, -point.y, point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
+ gp.quadTo(point_plus1.x, -point_plus1.y, point_plus2.x, -point_plus2.y);
+ offset+=2;
+ } else {
+ // s = new QuadCurve2D.Float(point.x,-point.y,point_plus1.x,-point_plus1.y,
+ // midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
+ gp.quadTo(point_plus1.x, -point_plus1.y, midValue(point_plus1.x, point_plus2.x), -midValue(point_plus1.y, point_plus2.y));
+ offset+=2;
+ }
+ }
+ } else {
+ if (point_plus1.onCurve) {
+ // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y),
+ // point.x, -point.y, point_plus1.x, -point_plus1.y);
+ //gp.curve3(point_plus1.x, -point_plus1.y, point.x, -point.y);
+ gp.quadTo(point.x, -point.y, point_plus1.x, -point_plus1.y);
+ offset++;
+
+ } else {
+ // s = new QuadCurve2D.Float(midValue(point_minus1.x, point.x), -midValue(point_minus1.y, point.y), point.x, -point.y,
+ // midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
+ //gp.curve3(midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y), point.x, -point.y);
+ gp.quadTo(point.x, -point.y, midValue(point.x, point_plus1.x), -midValue(point.y, point_plus1.y));
+ offset++;
+ }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
index 5afb939ab..6b3dc1f6f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
@@ -72,9 +72,9 @@ public class Mnemonic {
public static final short RS = 0x43;
public static final short WCVTP = 0x44;
public static final short RCVT = 0x45;
- public static final short GC = 0x46; // [a]
+ public static final short GC = 0x46; // [a]
public static final short SCFS = 0x48;
- public static final short MD = 0x49; // [a]
+ public static final short MD = 0x49; // [a]
public static final short MPPEM = 0x4B;
public static final short MPS = 0x4C;
public static final short FLIPON = 0x4D;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
index 17b5af594..6e7e76bc7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
@@ -182,8 +182,8 @@ public class OTFont {
}
public OTGlyph getGlyph(int i) {
-
- final GlyfDescript _glyfDescr = _glyf.getDescription(i);
+
+ final GlyfDescript _glyfDescr = _glyf.getDescription(i);
return (null != _glyfDescr)
? new OTGlyph(
_glyfDescr,
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
index 4b6242d56..5c004246a 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
@@ -103,7 +103,7 @@ public class OTGlyph {
}
public AABBox getBBox() {
- return _bbox;
+ return _bbox;
}
public int getAdvanceWidth() {
@@ -164,6 +164,6 @@ public class OTGlyph {
// _points[gd.getPointCount()] = new Point(0, 0, true, true);
// _points[gd.getPointCount()+1] = new Point(_advanceWidth, 0, true, true);
- _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0);
+ _bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0);
}
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
index ed82f2654..4804c35f2 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
@@ -175,15 +175,15 @@ public class PostTable implements Table {
"lessequal", // 148
"greaterequal", // 149
"yen", // 150
- "mu", // 151
+ "mu", // 151
"partialdiff", // 152
"summation", // 153
"product", // 154
- "pi", // 155
+ "pi", // 155
"integral'", // 156
"ordfeminine", // 157
"ordmasculine", // 158
- "Omega", // 159
+ "Omega", // 159
"ae", // 160
"oslash", // 161
"questiondown", // 162
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
index 252c6acc4..a659a7003 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
@@ -140,8 +140,8 @@ public class Interpreter {
private void _deltac1() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -151,8 +151,8 @@ public class Interpreter {
private void _deltac2() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -162,8 +162,8 @@ public class Interpreter {
private void _deltac3() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -173,8 +173,8 @@ public class Interpreter {
private void _deltap1() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -184,8 +184,8 @@ public class Interpreter {
private void _deltap2() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -195,8 +195,8 @@ public class Interpreter {
private void _deltap3() {
int n = pop();
for (int i = 0; i < n; i++) {
- pop(); // pn
- pop(); // argn
+ pop(); // pn
+ pop(); // argn
}
}
@@ -407,12 +407,12 @@ public class Interpreter {
* to inhibit grid-fitting when a glyph is being rotated or stretched, use the
* following sequence on the preprogram:
*
- * PUSHB[000] 6 ; ask GETINFO to check for stretching or rotation
- * GETINFO[] ; will push TRUE if glyph is stretched or rotated
- * IF[] ; tests value at top of stack
- * PUSHB[000] 1 ; value for INSTCTRL
- * PUSHB[000] 1 ; selector for INSTCTRL
- * INSTRCTRL[] ; based on selector and value will turn grid-fitting off
+ * PUSHB[000] 6 ; ask GETINFO to check for stretching or rotation
+ * GETINFO[] ; will push TRUE if glyph is stretched or rotated
+ * IF[] ; tests value at top of stack
+ * PUSHB[000] 1 ; value for INSTCTRL
+ * PUSHB[000] 1 ; selector for INSTCTRL
+ * INSTRCTRL[] ; based on selector and value will turn grid-fitting off
* EIF[]
*
* Selector flag 2 is used to establish that any parameters set in the CVT program
@@ -923,8 +923,8 @@ public class Interpreter {
* Set Freedom_Vector From Stack
*/
private void _sfvfs() {
- gs.freedom_vector[1] = pop(); // y
- gs.freedom_vector[0] = pop(); // x
+ gs.freedom_vector[1] = pop(); // y
+ gs.freedom_vector[0] = pop(); // x
}
/*
@@ -988,9 +988,9 @@ public class Interpreter {
* USES: loop
*/
private void _shpix() {
- pop(); // amount
+ pop(); // amount
while (gs.loop-- > 0) {
- pop(); // p
+ pop(); // p
}
gs.loop = 1;
}
@@ -1017,8 +1017,8 @@ public class Interpreter {
* Set Projection_Vector From Stack
*/
private void _spvfs() {
- gs.projection_vector[1] = pop(); // y
- gs.projection_vector[0] = pop(); // x
+ gs.projection_vector[1] = pop(); // y
+ gs.projection_vector[0] = pop(); // x
}
/*
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
index 3e2a594c5..79e842887 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
@@ -80,14 +80,14 @@ public class AffineTransform implements Cloneable, Serializable {
}
public AffineTransform(Factory<? extends Vertex> factory) {
- pointFactory = factory;
+ pointFactory = factory;
type = TYPE_IDENTITY;
m00 = m11 = 1.0f;
m10 = m01 = m02 = m12 = 0.0f;
}
public AffineTransform(AffineTransform t) {
- this.pointFactory = t.pointFactory;
+ this.pointFactory = t.pointFactory;
this.type = t.type;
this.m00 = t.m00;
this.m10 = t.m10;
@@ -98,7 +98,7 @@ public class AffineTransform implements Cloneable, Serializable {
}
public AffineTransform(Vertex.Factory<? extends Vertex> factory, float m00, float m10, float m01, float m11, float m02, float m12) {
- pointFactory = factory;
+ pointFactory = factory;
this.type = TYPE_UNKNOWN;
this.m00 = m00;
this.m10 = m10;
@@ -109,7 +109,7 @@ public class AffineTransform implements Cloneable, Serializable {
}
public AffineTransform(Vertex.Factory<? extends Vertex> factory, float[] matrix) {
- pointFactory = factory;
+ pointFactory = factory;
this.type = TYPE_UNKNOWN;
m00 = matrix[0];
m10 = matrix[1];
@@ -316,25 +316,25 @@ public class AffineTransform implements Cloneable, Serializable {
}
public static <T extends Vertex> AffineTransform getScaleInstance(Vertex.Factory<? extends Vertex> factory, float scx, float scY) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToScale(scx, scY);
return t;
}
public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToShear(shx, shy);
return t;
}
public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToRotation(angle);
return t;
}
public static <T extends Vertex> AffineTransform getRotateInstance(Vertex.Factory<? extends Vertex> factory, float angle, float x, float y) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToRotation(angle, x, y);
return t;
}
@@ -391,7 +391,7 @@ public class AffineTransform implements Cloneable, Serializable {
throw new NoninvertibleTransformException(determinantIsZero);
}
return new AffineTransform(
- this.pointFactory,
+ this.pointFactory,
m11 / det, // m00
-m10 / det, // m10
-m01 / det, // m01
@@ -401,9 +401,9 @@ public class AffineTransform implements Cloneable, Serializable {
);
}
- public Vertex transform(Vertex src, Vertex dst) {
+ public Vertex transform(Vertex src, Vertex dst) {
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create();
}
float x = src.getX();
@@ -415,12 +415,12 @@ public class AffineTransform implements Cloneable, Serializable {
public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) {
while (--length >= 0) {
- Vertex srcPoint = src[srcOff++];
+ Vertex srcPoint = src[srcOff++];
float x = srcPoint.getX();
float y = srcPoint.getY();
Vertex dstPoint = dst[dstOff];
if (dstPoint == null) {
- throw new IllegalArgumentException("dst["+dstOff+"] is null");
+ throw new IllegalArgumentException("dst["+dstOff+"] is null");
}
dstPoint.setCoord(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12);
dst[dstOff++] = dstPoint;
@@ -444,9 +444,9 @@ public class AffineTransform implements Cloneable, Serializable {
}
}
- public Vertex deltaTransform(Vertex src, Vertex dst) {
+ public Vertex deltaTransform(Vertex src, Vertex dst) {
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create();
}
float x = src.getX();
@@ -465,13 +465,13 @@ public class AffineTransform implements Cloneable, Serializable {
}
}
- public Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException {
+ public Vertex inverseTransform(Vertex src, Vertex dst) throws NoninvertibleTransformException {
float det = getDeterminant();
if (MathFloat.abs(det) < ZERO) {
- throw new NoninvertibleTransformException(determinantIsZero);
+ throw new NoninvertibleTransformException(determinantIsZero);
}
if (dst == null) {
- dst = pointFactory.create();
+ dst = pointFactory.create();
}
float x = src.getX() - m02;
@@ -486,7 +486,7 @@ public class AffineTransform implements Cloneable, Serializable {
{
float det = getDeterminant();
if (MathFloat.abs(det) < ZERO) {
- throw new NoninvertibleTransformException(determinantIsZero);
+ throw new NoninvertibleTransformException(determinantIsZero);
}
while (--length >= 0) {
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
index 431891361..edeabaa40 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
@@ -243,11 +243,11 @@ public final class Path2D implements Cloneable {
}
final public int size() {
- return typeSize;
+ return typeSize;
}
final public boolean isClosed() {
- return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ;
+ return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ;
}
public void closePath() {
@@ -258,7 +258,7 @@ public final class Path2D implements Cloneable {
}
public String toString() {
- return "[size "+size()+", closed "+isClosed()+"]";
+ return "[size "+size()+", closed "+isClosed()+"]";
}
public void append(Path2D path, boolean connect) {
diff --git a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
index 8f8638632..2138b217d 100644
--- a/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
+++ b/src/jogl/classes/jogamp/graph/math/plane/Crossing.java
@@ -385,12 +385,12 @@ public class Crossing {
// START
if (x == x1) {
- return x1 < x2 ? 0 : -1;
+ return x1 < x2 ? 0 : -1;
}
// END
if (x == x2) {
- return x1 < x2 ? 1 : 0;
+ return x1 < x2 ? 1 : 0;
}
// INSIDE-DOWN
@@ -496,9 +496,9 @@ public class Crossing {
// checks if the point (x,y) is the vertex of shape with PathIterator p
if (x == cx && y == cy) {
- cross = 0;
- cy = my;
- break;
+ cross = 0;
+ cy = my;
+ break;
}
p.next();
}
diff --git a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
new file mode 100644
index 000000000..96d62fbb3
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
@@ -0,0 +1,137 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.opengl;
+
+import java.io.PrintStream;
+import javax.media.opengl.FPSCounter;
+
+/**
+ * Default implementation of FPSCounter to be used for FPSCounter implementing renderer.
+ */
+public class FPSCounterImpl implements FPSCounter {
+ private int fpsUpdateFramesInterval;
+ private PrintStream fpsOutputStream ;
+ private long fpsStartTime, fpsLastUpdateTime, fpsLastPeriod, fpsTotalDuration;
+ private int fpsTotalFrames;
+ private float fpsLast, fpsTotal;
+
+ /** Creates a disabled instance */
+ public FPSCounterImpl() {
+ setUpdateFPSFrames(0, null);
+ }
+
+ /**
+ * Increases total frame count and updates values if feature is enabled and
+ * update interval is reached.<br>
+ *
+ * Shall be called by actual FPSCounter implementing renderer, after display a new frame.
+ *
+ */
+ public final synchronized void tickFPS() {
+ fpsTotalFrames++;
+ if(fpsUpdateFramesInterval>0 && fpsTotalFrames%fpsUpdateFramesInterval == 0) {
+ final long now = System.currentTimeMillis();
+ fpsLastPeriod = now - fpsLastUpdateTime;
+ fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0
+ fpsLast = ( (float)fpsUpdateFramesInterval * 1000f ) / ( (float) fpsLastPeriod ) ;
+
+ fpsTotalDuration = now - fpsStartTime;
+ fpsTotalDuration = Math.max(fpsTotalDuration, 1); // div 0
+ fpsTotal= ( (float)fpsTotalFrames * 1000f ) / ( (float) fpsTotalDuration ) ;
+
+ if(null != fpsOutputStream) {
+ fpsOutputStream.println(toString());
+ }
+
+ fpsLastUpdateTime = now;
+ }
+ }
+
+ public StringBuilder toString(StringBuilder sb) {
+ if(null==sb) {
+ sb = new StringBuilder();
+ }
+ String fpsLastS = String.valueOf(fpsLast);
+ fpsLastS = fpsLastS.substring(0, fpsLastS.indexOf('.') + 2);
+ String fpsTotalS = String.valueOf(fpsTotal);
+ fpsTotalS = fpsTotalS.substring(0, fpsTotalS.indexOf('.') + 2);
+ sb.append(fpsTotalDuration/1000 +" s: "+ fpsUpdateFramesInterval+" f / "+ fpsLastPeriod+" ms, " + fpsLastS+" fps, "+ fpsLastPeriod/fpsUpdateFramesInterval+" ms/f; "+
+ "total: "+ fpsTotalFrames+" f, "+ fpsTotalS+ " fps, "+ fpsTotalDuration/fpsTotalFrames+" ms/f");
+ return sb;
+ }
+
+ public String toString() {
+ return toString(null).toString();
+ }
+
+ public final synchronized void setUpdateFPSFrames(int frames, PrintStream out) {
+ fpsUpdateFramesInterval = frames;
+ fpsOutputStream = out;
+ resetFPSCounter();
+ }
+
+ public final synchronized void resetFPSCounter() {
+ fpsStartTime = System.currentTimeMillis(); // overwrite startTime to real init one
+ fpsLastUpdateTime = fpsStartTime;
+ fpsLastPeriod = 0;
+ fpsTotalFrames = 0;
+ fpsLast = 0f; fpsTotal = 0f;
+ }
+
+ public final synchronized int getUpdateFPSFrames() {
+ return fpsUpdateFramesInterval;
+ }
+
+ public final synchronized long getFPSStartTime() {
+ return fpsStartTime;
+ }
+
+ public final synchronized long getLastFPSUpdateTime() {
+ return fpsLastUpdateTime;
+ }
+
+ public final synchronized long getLastFPSPeriod() {
+ return fpsLastPeriod;
+ }
+
+ public final synchronized float getLastFPS() {
+ return fpsLast;
+ }
+
+ public final synchronized int getTotalFPSFrames() {
+ return fpsTotalFrames;
+ }
+
+ public final synchronized long getTotalFPSDuration() {
+ return fpsTotalDuration;
+ }
+
+ public final synchronized float getTotalFPS() {
+ return fpsTotal;
+ }
+}
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
index 15e3affee..fc8be95e9 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
@@ -107,17 +107,7 @@ public class GLBufferSizeTracker {
int target, GL caller, long size) {
// Need to do some similar queries to getBufferSize below
int buffer = bufferStateTracker.getBoundBufferObject(target, caller);
- boolean valid = bufferStateTracker.isBoundBufferObjectKnown(target);
- if (valid) {
- if (buffer == 0) {
- // FIXME: this really should not happen if we know what's
- // going on. Very likely there is an OpenGL error in the
- // application if we get here. Could silently return 0, but it
- // seems better to get an early warning that something is
- // wrong.
- throw new GLException("Error: no OpenGL buffer object appears to be bound to target 0x" +
- Integer.toHexString(target));
- }
+ if (buffer != 0) {
setDirectStateBufferSize(buffer, caller, size);
}
// We don't know the current buffer state. Note that the buffer
@@ -135,18 +125,8 @@ public class GLBufferSizeTracker {
GL caller) {
// See whether we know what buffer is currently bound to the given
// state
- int buffer = bufferStateTracker.getBoundBufferObject(target, caller);
- boolean valid = bufferStateTracker.isBoundBufferObjectKnown(target);
- if (valid) {
- if (0 == buffer) {
- // FIXME: this really should not happen if we know what's
- // going on. Very likely there is an OpenGL error in the
- // application if we get here. Could silently return 0, but it
- // seems better to get an early warning that something is
- // wrong.
- throw new GLException("Error: no OpenGL buffer object appears to be bound to target 0x" +
- Integer.toHexString(target));
- }
+ final int buffer = bufferStateTracker.getBoundBufferObject(target, caller);
+ if (0 != buffer) {
return getBufferSizeImpl(target, buffer, caller);
}
// We don't know what's going on in this case; query the GL for an answer
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
index d028bf98d..5a31431d8 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
@@ -136,14 +136,6 @@ public class GLBufferStateTracker {
return value;
}
- /** Indicates whether the binding state for the specified target is
- currently known, ie it could be bound or not but it must be tracked.<br>
- Should be called after getBoundBufferObject()
- because that method may change the answer for a given target. */
- public boolean isBoundBufferObjectKnown(int target) {
- return 0 < bindingMap.get(target) ;
- }
-
/** Clears out the known/unknown state of the various buffer object
binding states. These will be refreshed later on an as-needed
basis. This is called by the implementations of
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 9361fb0f9..6128b30b4 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -41,11 +41,13 @@
package jogamp.opengl;
import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
import com.jogamp.common.os.DynamicLookupHelper;
import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.gluegen.runtime.FunctionAddressResolver;
import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLExtensionNames;
@@ -57,6 +59,8 @@ import javax.media.nativewindow.NativeSurface;
import javax.media.opengl.GL;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLContext;
+import javax.media.opengl.GLDebugListener;
+import javax.media.opengl.GLDebugMessage;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLException;
import javax.media.opengl.GLPipelineFactory;
@@ -65,7 +69,8 @@ import javax.media.opengl.GLProfile;
public abstract class GLContextImpl extends GLContext {
public static final boolean DEBUG = Debug.debug("GLContext");
- protected GLContextLock lock = new GLContextLock();
+ // RecursiveLock maintains a queue of waiting Threads, ensuring the longest waiting thread will be notified at unlock.
+ protected RecursiveLock lock = new RecursiveLock();
/**
* Context full qualified name: display_type + display_connection + major + minor + ctp.
@@ -73,6 +78,8 @@ public abstract class GLContextImpl extends GLContext {
*/
private String contextFQN;
+ private int additionalCtxCreationFlags;
+
// Cache of the functions that are available to be called at the current
// moment in time
protected ExtensionAvailabilityCache extensionAvailability;
@@ -85,22 +92,23 @@ public abstract class GLContextImpl extends GLContext {
private GLBufferSizeTracker bufferSizeTracker; // Singleton - Set by GLContextShareSet
private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker();
private GLStateTracker glStateTracker = new GLStateTracker();
-
+ private GLDebugMessageHandler glDebugHandler = null;
+
protected GLDrawableImpl drawable;
protected GLDrawableImpl drawableRead;
protected GL gl;
protected static final Object mappedContextTypeObjectLock;
- protected static final HashMap mappedExtensionAvailabilityCache;
- protected static final HashMap mappedGLProcAddress;
- protected static final HashMap mappedGLXProcAddress;
+ protected static final HashMap<String, ExtensionAvailabilityCache> mappedExtensionAvailabilityCache;
+ protected static final HashMap<String, ProcAddressTable> mappedGLProcAddress;
+ protected static final HashMap<String, ProcAddressTable> mappedGLXProcAddress;
static {
mappedContextTypeObjectLock = new Object();
- mappedExtensionAvailabilityCache = new HashMap();
- mappedGLProcAddress = new HashMap();
- mappedGLXProcAddress = new HashMap();
+ mappedExtensionAvailabilityCache = new HashMap<String, ExtensionAvailabilityCache>();
+ mappedGLProcAddress = new HashMap<String, ProcAddressTable>();
+ mappedGLXProcAddress = new HashMap<String, ProcAddressTable>();
}
public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith) {
@@ -113,6 +121,8 @@ public abstract class GLContextImpl extends GLContext {
this.drawable = drawable;
this.drawableRead = drawable;
+
+ this.glDebugHandler = new GLDebugMessageHandler(this);
}
protected void resetStates() {
@@ -137,6 +147,7 @@ public abstract class GLContextImpl extends GLContext {
glProcAddressTable = null;
gl = null;
contextFQN = null;
+ additionalCtxCreationFlags = 0;
super.resetStates();
}
@@ -145,7 +156,7 @@ public abstract class GLContextImpl extends GLContext {
if(null!=read && drawable!=read && !isGLReadDrawableAvailable()) {
throw new GLException("GL Read Drawable not available");
}
- boolean lockHeld = lock.isHeld();
+ boolean lockHeld = lock.isOwner();
if(lockHeld) {
release();
}
@@ -185,19 +196,36 @@ public abstract class GLContextImpl extends GLContext {
// This is only needed for Mac OS X on-screen contexts
protected void update() throws GLException { }
+ boolean lockFailFast = true;
+ Object lockFailFastSync = new Object();
+
public boolean isSynchronized() {
- return !lock.getFailFastMode();
+ synchronized (lockFailFastSync) {
+ return !lockFailFast;
+ }
}
public void setSynchronized(boolean isSynchronized) {
- lock.setFailFastMode(!isSynchronized);
+ synchronized (lockFailFastSync) {
+ lockFailFast = !isSynchronized;
+ }
}
+ private final void lockConsiderFailFast() {
+ synchronized (lockFailFastSync) {
+ if(lockFailFast && lock.isLockedByOtherThread()) {
+ throw new GLException("Error: Attempt to make context current on thread " + Thread.currentThread() +
+ " which is already current on thread " + lock.getOwner());
+ }
+ }
+ lock.lock();
+ }
+
public abstract Object getPlatformGLExtensions();
// Note: the surface is locked within [makeCurrent .. swap .. release]
public void release() throws GLException {
- if (!lock.isHeld()) {
+ if ( !lock.isOwner() ) {
throw new GLException("Context not current on current thread");
}
setCurrent(null);
@@ -213,14 +241,17 @@ public abstract class GLContextImpl extends GLContext {
protected abstract void releaseImpl() throws GLException;
public final void destroy() {
- if (lock.isHeld()) {
- // release current context
+ if ( lock.isOwner() ) {
+ // release current context
+ if(null != glDebugHandler) {
+ glDebugHandler.enable(false);
+ }
release();
}
// Must hold the lock around the destroy operation to make sure we
// don't destroy the context out from under another thread rendering to it
- lock.lock();
+ lockConsiderFailFast();
try {
/* FIXME: refactor dependence on Java 2D / JOGL bridge
if (tracker != null) {
@@ -248,6 +279,7 @@ public abstract class GLContextImpl extends GLContext {
try {
destroyImpl();
contextHandle = 0;
+ glDebugHandler = null;
GLContextShareSet.contextDestroyed(this);
} finally {
drawable.unlockSurface();
@@ -345,9 +377,10 @@ public abstract class GLContextImpl extends GLContext {
if (null == getGLDrawable().getChosenGLCapabilities()) {
throw new GLException("drawable has no chosen GLCapabilities: "+getGLDrawable());
}
+ additionalCtxCreationFlags |= DEBUG_GL ? GLContext.CTX_OPTION_DEBUG : 0 ;
}
- lock.lock();
+ lockConsiderFailFast();
int res = 0;
try {
res = makeCurrentLocking();
@@ -366,6 +399,7 @@ public abstract class GLContextImpl extends GLContext {
if (res == CONTEXT_NOT_CURRENT) {
lock.unlock();
} else {
+ setCurrent(this);
if(res == CONTEXT_CURRENT_NEW) {
// check if the drawable's and the GL's GLProfile are equal
// throws an GLException if not
@@ -373,12 +407,13 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG_GL) {
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
+ glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener());
}
if(TRACE_GL) {
gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
}
+ glDebugHandler.init(0 != (additionalCtxCreationFlags & GLContext.CTX_OPTION_DEBUG));
}
- setCurrent(this);
/* FIXME: refactor dependence on Java 2D / JOGL bridge
@@ -501,13 +536,13 @@ public abstract class GLContextImpl extends GLContext {
* @see #createContextARBImpl
* @see #destroyContextARBImpl
*/
- protected final long createContextARB(long share, boolean direct,
- int major[], int minor[], int ctp[])
+ protected final long createContextARB(long share, boolean direct)
{
AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
AbstractGraphicsDevice device = config.getScreen().getDevice();
GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
GLProfile glp = glCaps.getGLProfile();
+ GLProfile glpImpl = GLProfile.get(glp.getImplName());
if (DEBUG) {
System.err.println(getThreadName() + ": !!! createContextARB: mappedVersionsAvailableSet("+device.getConnection()+"): "+
@@ -519,15 +554,15 @@ public abstract class GLContextImpl extends GLContext {
}
int reqMajor;
- if(glp.isGL4()) {
+ if(glpImpl.isGL4()) {
reqMajor=4;
- } else if (glp.isGL3()) {
+ } else if (glpImpl.isGL3()) {
reqMajor=3;
- } else /* if (glp.isGL2()) */ {
+ } else /* if (glpImpl.isGL2()) */ {
reqMajor=2;
}
- boolean compat = glp.isGL2(); // incl GL3bc and GL4bc
+ boolean compat = glpImpl.isGL2(); // incl GL3bc and GL4bc
int _major[] = { 0 };
int _minor[] = { 0 };
int _ctp[] = { 0 };
@@ -535,6 +570,7 @@ public abstract class GLContextImpl extends GLContext {
if( GLContext.getAvailableGLVersion(device, reqMajor, compat?CTX_PROFILE_COMPAT:CTX_PROFILE_CORE,
_major, _minor, _ctp)) {
+ _ctp[0] |= additionalCtxCreationFlags;
_ctx = createContextARBImpl(share, direct, _ctp[0], _major[0], _minor[0]);
if(0!=_ctx) {
setGLFunctionAvailability(true, _major[0], _minor[0], _ctp[0]);
@@ -545,17 +581,16 @@ public abstract class GLContextImpl extends GLContext {
private final void mapGLVersions(AbstractGraphicsDevice device) {
synchronized (GLContext.deviceVersionAvailable) {
- createContextARBMapVersionsAvailable(4, false /* core */); // GL4
createContextARBMapVersionsAvailable(4, true /* compat */); // GL4bc
- createContextARBMapVersionsAvailable(3, false /* core */); // GL3
+ createContextARBMapVersionsAvailable(4, false /* core */); // GL4
createContextARBMapVersionsAvailable(3, true /* compat */); // GL3bc
+ createContextARBMapVersionsAvailable(3, false /* core */); // GL3
createContextARBMapVersionsAvailable(2, true /* compat */); // GL2
GLContext.setAvailableGLVersionsSet(device);
}
}
- private final void createContextARBMapVersionsAvailable(int reqMajor, boolean compat)
- {
+ private final void createContextARBMapVersionsAvailable(int reqMajor, boolean compat) {
resetStates();
long _context;
@@ -765,14 +800,14 @@ public abstract class GLContextImpl extends GLContext {
name. Currently this is only used to map "glAllocateMemoryNV" and
associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */
protected String mapToRealGLFunctionName(String glFunctionName) {
- Map/*<String, String>*/ map = getFunctionNameMap();
- String lookup = ( null != map ) ? (String) map.get(glFunctionName) : null;
+ Map<String, String> map = getFunctionNameMap();
+ String lookup = ( null != map ) ? map.get(glFunctionName) : null;
if (lookup != null) {
return lookup;
}
return glFunctionName;
}
- protected abstract Map/*<String, String>*/ getFunctionNameMap() ;
+ protected abstract Map<String, String> getFunctionNameMap() ;
/** Maps the given "platform-independent" extension name to a real
function name. Currently this is only used to map
@@ -780,14 +815,14 @@ public abstract class GLContextImpl extends GLContext {
"GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a."
*/
protected String mapToRealGLExtensionName(String glExtensionName) {
- Map/*<String, String>*/ map = getExtensionNameMap();
- String lookup = ( null != map ) ? (String) map.get(glExtensionName) : null;
+ Map<String, String> map = getExtensionNameMap();
+ String lookup = ( null != map ) ? map.get(glExtensionName) : null;
if (lookup != null) {
return lookup;
}
return glExtensionName;
}
- protected abstract Map/*<String, String>*/ getExtensionNameMap() ;
+ protected abstract Map<String, String> getExtensionNameMap() ;
/** Helper routine which resets a ProcAddressTable generated by the
GLEmitter by looking up anew all of its function pointers. */
@@ -841,7 +876,7 @@ public abstract class GLContextImpl extends GLContext {
ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
- table = (ProcAddressTable) mappedGLProcAddress.get( contextFQN );
+ table = mappedGLProcAddress.get( contextFQN );
if(null != table && !verifyInstance(gl.getGLProfile(), "ProcAddressTable", table)) {
throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+") -> "+
table.getClass().getName()+" not matching "+gl.getGLProfile().getGLImplBaseClassName());
@@ -877,7 +912,7 @@ public abstract class GLContextImpl extends GLContext {
//
ExtensionAvailabilityCache eCache;
synchronized(mappedContextTypeObjectLock) {
- eCache = (ExtensionAvailabilityCache) mappedExtensionAvailabilityCache.get( contextFQN );
+ eCache = mappedExtensionAvailabilityCache.get( contextFQN );
}
if(null != eCache) {
extensionAvailability = eCache;
@@ -1046,7 +1081,78 @@ public abstract class GLContextImpl extends GLContext {
//
public boolean hasWaiters() {
- return lock.hasWaiters();
+ return lock.getWaitingThreadQueueSize()>0;
+ }
+
+ //---------------------------------------------------------------------------
+ // GL_ARB_debug_output, GL_AMD_debug_output helpers
+ //
+
+ public final String getGLDebugMessageExtension() {
+ return glDebugHandler.getExtension();
+ }
+
+ public final boolean isGLDebugMessageEnabled() {
+ return glDebugHandler.isEnabled();
+ }
+
+ public int getContextCreationFlags() {
+ return additionalCtxCreationFlags;
}
+ public void setContextCreationFlags(int flags) {
+ if(!isCreated()) {
+ additionalCtxCreationFlags = flags & GLContext.CTX_OPTION_DEBUG;
+ }
+ }
+
+ public void enableGLDebugMessage(boolean enable) throws GLException {
+ if(!isCreated()) {
+ if(enable) {
+ additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG;
+ } else {
+ additionalCtxCreationFlags &= ~GLContext.CTX_OPTION_DEBUG;
+ }
+ } else if(0 != (additionalCtxCreationFlags & GLContext.CTX_OPTION_DEBUG) &&
+ null != getGLDebugMessageExtension()) {
+ glDebugHandler.enable(enable);
+ }
+ }
+
+ public void addGLDebugListener(GLDebugListener listener) {
+ glDebugHandler.addListener(listener);
+ }
+
+ public void removeGLDebugListener(GLDebugListener listener) {
+ glDebugHandler.removeListener(listener);
+ }
+
+ public int getGLDebugListenerSize() {
+ return glDebugHandler.listenerSize();
+ }
+
+ public void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled) {
+ if(glDebugHandler.isExtensionARB()) {
+ gl.getGL2GL3().glDebugMessageControlARB(source, type, severity, count, ids, enabled);
+ } else if(glDebugHandler.isExtensionAMD()) {
+ gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, enabled);
+ }
+ }
+
+ public void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled) {
+ if(glDebugHandler.isExtensionARB()) {
+ gl.getGL2GL3().glDebugMessageControlARB(source, type, severity, count, ids, ids_offset, enabled);
+ } else if(glDebugHandler.isExtensionAMD()) {
+ gl.getGL2GL3().glDebugMessageEnableAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, count, ids, ids_offset, enabled);
+ }
+ }
+
+ public void glDebugMessageInsert(int source, int type, int id, int severity, int length, String buf) {
+ if(glDebugHandler.isExtensionARB()) {
+ gl.getGL2GL3().glDebugMessageInsertARB(source, type, id, severity, length, buf);
+ } else if(glDebugHandler.isExtensionAMD()) {
+ if(0>length) { length = 0; }
+ gl.getGL2GL3().glDebugMessageInsertAMD(GLDebugMessage.translateARB2AMDCategory(source, type), severity, id, length, buf);
+ }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextLock.java b/src/jogl/classes/jogamp/opengl/GLContextLock.java
deleted file mode 100644
index f725508d8..000000000
--- a/src/jogl/classes/jogamp/opengl/GLContextLock.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package jogamp.opengl;
-
-import javax.media.opengl.*;
-
-/** Implements the makeCurrent / release locking behavior of the
- GLContext class. When "fail fast mode" is enabled, attempts to
- lock the same GLContextLock on more than one thread cause
- GLException to be raised. This lock is not recursive. Attempts to
- lock it more than once on a given thread will cause GLException to
- be raised. */
-
-public class GLContextLock {
- protected static final boolean DEBUG = GLContextImpl.DEBUG;
-
- static class SyncData {
- boolean failFastMode = true;
- Thread owner = null;
- int waiters = 0;
- Exception lockedStack = null; // only enabled if DEBUG
- }
- private SyncData sdata = new SyncData(); // synchronized (flow/mem) mutable access
-
- /** Locks this GLContextLock on the current thread. If fail fast
- mode is enabled and the GLContextLock is already owned by
- another thread, throws GLException. */
- public final void lock() throws GLException {
- synchronized(sdata) {
- Thread current = Thread.currentThread();
- if (sdata.owner == null) {
- sdata.owner = current;
- if(DEBUG) {
- sdata.lockedStack = new Exception("Error: Previously made current (1) by "+sdata.owner+", lock: "+this);
- }
- } else if (sdata.owner != current) {
- while (sdata.owner != null) {
- if (sdata.failFastMode) {
- if(null!=sdata.lockedStack) {
- sdata.lockedStack.printStackTrace();
- }
- throw new GLException("Error: Attempt to make context current on thread " + current +
- " which is already current on thread " + sdata.owner);
- } else {
- try {
- ++sdata.waiters;
- sdata.wait();
- } catch (InterruptedException e) {
- throw new GLException(e);
- } finally {
- --sdata.waiters;
- }
- }
- }
- sdata.owner = current;
- if(DEBUG) {
- sdata.lockedStack = new Exception("Previously made current (2) by "+sdata.owner+", lock: "+this);
- }
- } else {
- throw new GLException("Attempt to make the same context current twice on thread " + current);
- }
- }
- }
-
- /** Unlocks this GLContextLock. */
- public final void unlock() throws GLException {
- synchronized (sdata) {
- Thread current = Thread.currentThread();
- if (sdata.owner == current) {
- sdata.owner = null;
- sdata.lockedStack = null;
- // Assuming notify() implementation weaks up the longest waiting thread, to avoid starvation.
- // Otherwise we would need to have a Thread queue implemented, using sleep(timeout) and interrupt.
- sdata.notify();
- } else {
- if (sdata.owner != null) {
- throw new GLException("Attempt by thread " + current +
- " to release context owned by thread " + sdata.owner);
- } else {
- throw new GLException("Attempt by thread " + current +
- " to release unowned context");
- }
- }
- }
- }
-
- /** Indicates whether this lock is held by the current thread. */
- public final boolean isHeld() {
- synchronized(sdata) {
- return (Thread.currentThread() == sdata.owner);
- }
- }
-
- public final void setFailFastMode(boolean onOrOff) {
- synchronized(sdata) {
- sdata.failFastMode = onOrOff;
- }
- }
-
- public final boolean getFailFastMode() {
- synchronized(sdata) {
- return sdata.failFastMode;
- }
- }
-
- public final boolean hasWaiters() {
- synchronized(sdata) {
- return (0 != sdata.waiters);
- }
- }
-
- /** holding the owners stack trace when lock is acquired and DEBUG is true */
- public final Exception getLockedStack() {
- synchronized(sdata) {
- return sdata.lockedStack;
- }
- }
-
-}
diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
new file mode 100644
index 000000000..f67c916ea
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
@@ -0,0 +1,266 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.opengl;
+
+import java.util.ArrayList;
+
+import javax.media.nativewindow.NativeWindowException;
+import javax.media.opengl.GL2GL3;
+import javax.media.opengl.GLDebugListener;
+import javax.media.opengl.GLDebugMessage;
+import javax.media.opengl.GLException;
+
+import com.jogamp.gluegen.runtime.ProcAddressTable;
+import jogamp.opengl.gl4.GL4bcProcAddressTable;
+
+/**
+ * The GLDebugMessageHandler, handling <i>GL_ARB_debug_output</i> or <i>GL_AMD_debug_output</i>
+ * debug messages.<br>
+ *
+ * <p>An instance must be bound to the current thread's GLContext to achieve thread safety.</p>
+ *
+ * <p>A native callback function is registered at {@link #enable(boolean) enable(true)},
+ * which forwards received messages to the added {@link GLDebugListener} directly.
+ * Hence the {@link GLDebugListener#messageSent(GLDebugMessage)} implementation shall
+ * return as fast as possible.</p>
+ *
+ * <p>In case no <i>GL_ARB_debug_output</i> is available, but <i>GL_AMD_debug_output</i>,
+ * the messages are translated to <i>ARB</i> {@link GLDebugMessage}, using {@link GLDebugMessage#translateAMDEvent(javax.media.opengl.GLContext, long, int, int, int, String)}.</p>
+ */
+public class GLDebugMessageHandler {
+ /** Extension <i>GL_ARB_debug_output</i> implementing GLDebugMessage */
+ public static final String GL_ARB_debug_output = "GL_ARB_debug_output".intern();
+
+ /** Extension <i>GL_AMD_debug_output</i> implementing GLDebugMessage */
+ public static final String GL_AMD_debug_output = "GL_AMD_debug_output".intern();
+
+ private static final boolean DEBUG = Debug.debug("GLDebugMessageHandler");
+
+ private static final int EXT_ARB = 1;
+ private static final int EXT_AMD = 2;
+
+ static {
+ if ( !initIDs0() ) {
+ throw new NativeWindowException("Failed to initialize GLDebugMessageHandler jmethodIDs");
+ }
+ }
+
+ private final GLContextImpl ctx;
+ private final ListenerSyncedImplStub<GLDebugListener> listenerImpl;
+
+ // licefycle: init - EOL
+ private String extName;
+ private int extType;
+ private long glDebugMessageCallbackProcAddress;
+ private boolean extAvailable;
+
+ // licefycle: enable - disable/EOL
+ private long handle;
+
+ /**
+ * @param ctx the associated GLContext
+ * @param glDebugExtension chosen extension to use
+ */
+ public GLDebugMessageHandler(GLContextImpl ctx) {
+ this.ctx = ctx;
+ this.listenerImpl = new ListenerSyncedImplStub<GLDebugListener>();
+ this.glDebugMessageCallbackProcAddress = 0;
+ this.extName = null;
+ this.extType = 0;
+ this.extAvailable = false;
+ this.handle = 0;
+ }
+
+ public void init(boolean enable) {
+ init();
+ if(isAvailable()) {
+ enableImpl(enable);
+ }
+ }
+
+ public void init() {
+ ctx.validateCurrent();
+ if( isAvailable()) {
+ return;
+ }
+
+ if( ctx.isExtensionAvailable(GL_ARB_debug_output) ) {
+ extName = GL_ARB_debug_output;
+ extType = EXT_ARB;
+ } else if( ctx.isExtensionAvailable(GL_AMD_debug_output) ) {
+ extName = GL_AMD_debug_output;
+ extType = EXT_AMD;
+ }
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler: Using extension: <"+extName+">");
+ }
+
+ if(0 == extType) {
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler: No extension available!");
+ }
+ return;
+ }
+
+ final ProcAddressTable procAddressTable = ctx.getGLProcAddressTable();
+ if( procAddressTable instanceof GL4bcProcAddressTable) {
+ final GL4bcProcAddressTable desktopProcAddressTable = (GL4bcProcAddressTable)procAddressTable;
+ switch(extType) {
+ case EXT_ARB:
+ glDebugMessageCallbackProcAddress = desktopProcAddressTable._addressof_glDebugMessageCallbackARB;
+ break;
+ case EXT_AMD:
+ glDebugMessageCallbackProcAddress = desktopProcAddressTable._addressof_glDebugMessageCallbackAMD;
+ break;
+ }
+ } else {
+ if(DEBUG) {
+ System.err.println("Non desktop context not supported");
+ }
+ }
+ extAvailable = 0 < extType && null != extName && 0 != glDebugMessageCallbackProcAddress;
+
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler: extAvailable: "+extAvailable+", glDebugMessageCallback* : 0x"+Long.toHexString(glDebugMessageCallbackProcAddress));
+ }
+
+ if(!extAvailable) {
+ glDebugMessageCallbackProcAddress = 0;
+ }
+
+ handle = 0;
+ }
+
+ public final boolean isAvailable() { return extAvailable; }
+
+ /**
+ * @return The extension implementing the GLDebugMessage feature,
+ * either {@link #GL_ARB_debug_output} or {@link #GL_AMD_debug_output}.
+ * If unavailable <i>null</i> is returned.
+ */
+ public final String getExtension() {
+ return extName;
+ }
+
+ public final boolean isExtensionARB() {
+ return extName == GL_ARB_debug_output;
+ }
+
+ public final boolean isExtensionAMD() {
+ return extName == GL_AMD_debug_output;
+ }
+
+ /**
+ * @throws GLException if context not current or callback registration failed (enable)
+ */
+ public final void enable(boolean enable) throws GLException {
+ ctx.validateCurrent();
+ if(!isAvailable()) {
+ return;
+ }
+ enableImpl(enable);
+ }
+ final void enableImpl(boolean enable) throws GLException {
+ if(enable) {
+ if(0 == handle) {
+ handle = register0(glDebugMessageCallbackProcAddress, extType);
+ if(0 == handle) {
+ throw new GLException("Failed to register via \"glDebugMessageCallback*\" using "+extName);
+ }
+ }
+ } else {
+ if(0 != handle) {
+ unregister0(glDebugMessageCallbackProcAddress, handle);
+ handle = 0;
+ }
+ }
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler: enable("+enable+") -> 0x" + Long.toHexString(handle));
+ }
+ }
+
+ public final boolean isEnabled() { return 0 != handle; }
+
+ public final int listenerSize() {
+ return listenerImpl.size();
+ }
+
+ public final void addListener(GLDebugListener listener) {
+ listenerImpl.addListener(-1, listener);
+ }
+
+ public final void addListener(int index, GLDebugListener listener) {
+ listenerImpl.addListener(index, listener);
+ }
+
+ public final void removeListener(GLDebugListener listener) {
+ listenerImpl.removeListener(listener);
+ }
+
+ private final void sendMessage(GLDebugMessage msg) {
+ synchronized(listenerImpl) {
+ if(DEBUG) {
+ System.err.println("GLDebugMessageHandler: "+msg);
+ }
+ final ArrayList<GLDebugListener> listeners = listenerImpl.getListeners();
+ for(int i=0; i<listeners.size(); i++) {
+ listeners.get(i).messageSent(msg);
+ }
+ }
+ }
+
+ public static class StdErrGLDebugListener implements GLDebugListener {
+ public void messageSent(GLDebugMessage event) {
+ System.err.println(event);
+ }
+ }
+
+ //
+ // native -> java
+ //
+
+ protected final void glDebugMessageARB(int source, int type, int id, int severity, String msg) {
+ final GLDebugMessage event = new GLDebugMessage(ctx, System.currentTimeMillis(), source, type, id, severity, msg);
+ sendMessage(event);
+ }
+
+ protected final void glDebugMessageAMD(int id, int category, int severity, String msg) {
+ final GLDebugMessage event = GLDebugMessage.translateAMDEvent(ctx, System.currentTimeMillis(), id, category, severity, msg);
+ sendMessage(event);
+ }
+
+ //
+ // java -> native
+ //
+
+ private static native boolean initIDs0();
+ private native long register0(long glDebugMessageCallbackProcAddress, int extType);
+ private native void unregister0(long glDebugMessageCallbackProcAddress, long handle);
+}
+
+
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index d079a1bd1..887e571cc 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -50,12 +50,11 @@ public class GLDrawableHelper {
protected static final boolean DEBUG = GLDrawableImpl.DEBUG;
private static final boolean VERBOSE = Debug.verbose();
private Object listenersLock = new Object();
- private List listeners;
- private volatile boolean listenersIter; // avoid java.util.ConcurrentModificationException
- private Set listenersToBeInit;
+ private ArrayList<GLEventListener> listeners;
+ private HashSet<GLEventListener> listenersToBeInit;
private boolean autoSwapBufferMode;
private Object glRunnablesLock = new Object();
- private ArrayList glRunnables;
+ private ArrayList<GLRunnable> glRunnables;
private GLAnimatorControl animatorCtrl;
public GLDrawableHelper() {
@@ -64,13 +63,12 @@ public class GLDrawableHelper {
public final void reset() {
synchronized(listenersLock) {
- listeners = new ArrayList();
- listenersIter = false;
- listenersToBeInit = new HashSet();
+ listeners = new ArrayList<GLEventListener>();
+ listenersToBeInit = new HashSet<GLEventListener>();
}
autoSwapBufferMode = true;
synchronized(glRunnablesLock) {
- glRunnables = new ArrayList();
+ glRunnables = new ArrayList<GLRunnable>();
}
animatorCtrl = null;
}
@@ -81,7 +79,6 @@ public class GLDrawableHelper {
sb.append("GLAnimatorControl: "+animatorCtrl+", ");
synchronized(listenersLock) {
sb.append("GLEventListeners num "+listeners.size()+" [");
- listenersIter = true;
for (int i=0; i < listeners.size(); i++) {
Object l = listeners.get(i);
sb.append(l);
@@ -89,7 +86,6 @@ public class GLDrawableHelper {
sb.append( !listenersToBeInit.contains(l) );
sb.append("], ");
}
- listenersIter = false;
}
sb.append("]");
return sb.toString();
@@ -107,29 +103,13 @@ public class GLDrawableHelper {
// GLEventListener may be added after context is created,
// hence we earmark initialization for the next display call.
listenersToBeInit.add(listener);
- if(!listenersIter) {
- // fast path
- listeners.add(index, listener);
- } else {
- // copy mode in case this is issued while iterating, eg via init, display, ..
- List newListeners = (List) ((ArrayList) listeners).clone();
- newListeners.add(index, listener);
- listeners = newListeners;
- }
+ listeners.add(index, listener);
}
}
public final void removeGLEventListener(GLEventListener listener) {
synchronized(listenersLock) {
- if(!listenersIter) {
- // fast path
- listeners.remove(listener);
- } else {
- // copy mode in case this is issued while iterating, eg via init, display, ..
- List newListeners = (List) ((ArrayList) listeners).clone();
- newListeners.remove(listener);
- listeners = newListeners;
- }
+ listeners.remove(listener);
listenersToBeInit.remove(listener);
}
}
@@ -141,12 +121,9 @@ public class GLDrawableHelper {
*/
public final void dispose(GLAutoDrawable drawable) {
synchronized(listenersLock) {
- listenersIter = true;
for (int i=0; i < listeners.size(); i++) {
- GLEventListener listener = (GLEventListener) listeners.get(i) ;
- listener.dispose(drawable);
+ listeners.get(i).dispose(drawable);
}
- listenersIter = false;
}
}
@@ -163,9 +140,8 @@ public class GLDrawableHelper {
public final void init(GLAutoDrawable drawable) {
synchronized(listenersLock) {
- listenersIter = true;
for (int i=0; i < listeners.size(); i++) {
- GLEventListener listener = (GLEventListener) listeners.get(i) ;
+ final GLEventListener listener = listeners.get(i) ;
// If make current ctx, invoked by invokGL(..), results in a new ctx, init gets called.
// This may happen not just for initial setup, but for ctx recreation due to resource change (drawable/window),
@@ -176,21 +152,18 @@ public class GLDrawableHelper {
throw new GLException("GLEventListener "+listener+" already initialized: "+drawable);
}
}
- listenersIter = false;
}
}
public final void display(GLAutoDrawable drawable) {
synchronized(listenersLock) {
- listenersIter = true;
for (int i=0; i < listeners.size(); i++) {
- GLEventListener listener = (GLEventListener) listeners.get(i) ;
+ final GLEventListener listener = listeners.get(i) ;
// GLEventListener may need to be init,
// in case this one is added after the realization of the GLAutoDrawable
init( listener, drawable, true ) ;
listener.display(drawable);
}
- listenersIter = false;
}
execGLRunnables(drawable);
}
@@ -205,27 +178,25 @@ public class GLDrawableHelper {
public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
synchronized(listenersLock) {
- listenersIter = true;
for (int i=0; i < listeners.size(); i++) {
reshape((GLEventListener) listeners.get(i), drawable, x, y, width, height, 0==i);
}
- listenersIter = false;
}
}
private void execGLRunnables(GLAutoDrawable drawable) {
if(glRunnables.size()>0) {
// swap one-shot list asap
- ArrayList _glRunnables = null;
+ ArrayList<GLRunnable> _glRunnables = null;
synchronized(glRunnablesLock) {
if(glRunnables.size()>0) {
_glRunnables = glRunnables;
- glRunnables = new ArrayList();
+ glRunnables = new ArrayList<GLRunnable>();
}
}
if(null!=_glRunnables) {
for (int i=0; i < _glRunnables.size(); i++) {
- ((GLRunnable) _glRunnables.get(i)).run(drawable);
+ _glRunnables.get(i).run(drawable);
}
}
}
@@ -337,6 +308,7 @@ public class GLDrawableHelper {
// Support for recursive makeCurrent() calls as well as calling
// other drawables' display() methods from within another one's
+ // FIXME: re-evaluate due to possible expensive TLS access ?
GLContext lastContext = GLContext.getCurrent();
Runnable lastInitAction = (Runnable) perThreadInitAction.get();
if (lastContext != null) {
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
index 671390fbb..1d52bedbb 100644
--- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
@@ -64,6 +64,7 @@ public class GLPbufferImpl implements GLPbuffer {
private GLContextImpl context;
private GLDrawableHelper drawableHelper = new GLDrawableHelper();
private int floatMode;
+ private int additionalCtxCreationFlags = 0;
public GLPbufferImpl(GLDrawableImpl pbufferDrawable,
GLContext parentContext) {
@@ -177,6 +178,9 @@ public class GLPbufferImpl implements GLPbuffer {
public void setContext(GLContext ctx) {
context=(GLContextImpl)ctx;
+ if(null != context) {
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ }
}
public GLContext getContext() {
@@ -207,6 +211,17 @@ public class GLPbufferImpl implements GLPbuffer {
invokeGL(swapBuffersAction);
}
+ public void setContextCreationFlags(int flags) {
+ additionalCtxCreationFlags = flags;
+ if(null != context) {
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ }
+ }
+
+ public int getContextCreationFlags() {
+ return additionalCtxCreationFlags;
+ }
+
public void bindTexture() {
// Doesn't make much sense to try to do this on the event dispatch
// thread given that it has to be called while the context is current
diff --git a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java
new file mode 100644
index 000000000..1cde551be
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java
@@ -0,0 +1,79 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package jogamp.opengl;
+
+import java.util.ArrayList;
+
+/**
+ * Simple locked listener implementation stub to be used for listener handler,
+ * synchronized on it's instance.
+ *
+ * <p>Utilizing simple locking via synchronized.</p>
+ *
+ * @param <E> The listener type
+ */
+public class ListenerSyncedImplStub<E> {
+ private ArrayList<E> listeners;
+
+ public ListenerSyncedImplStub() {
+ reset();
+ }
+
+ public synchronized final void reset() {
+ listeners = new ArrayList<E>();
+ }
+
+ public synchronized final void destroy() {
+ listeners.clear();
+ listeners = null;
+ }
+
+ public synchronized final int size() {
+ return listeners.size();
+ }
+
+ public synchronized final void addListener(E listener) {
+ addListener(-1, listener);
+ }
+
+ public synchronized final void addListener(int index, E listener) {
+ if(0>index) {
+ index = listeners.size();
+ }
+ listeners.add(index, listener);
+ }
+
+ public synchronized final void removeListener(E listener) {
+ listeners.remove(listener);
+ }
+
+ public final ArrayList<E> getListeners() {
+ return listeners;
+ }
+}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 864b9583d..dbdfcd5d9 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -76,9 +76,9 @@ public abstract class EGLContext extends GLContextImpl {
return eglExtProcAddressTable;
}
- protected Map/*<String, String>*/ getFunctionNameMap() { return null; }
+ protected Map<String, String> getFunctionNameMap() { return null; }
- protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
+ protected Map<String, String> getExtensionNameMap() { return null; }
public final boolean isGLReadDrawableAvailable() {
return true;
@@ -203,12 +203,12 @@ public abstract class EGLContext extends GLContextImpl {
eglQueryStringInitialized = false;
eglQueryStringAvailable = false;
- EGLExtProcAddressTable table = null;
+ ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
- table = (EGLExtProcAddressTable) mappedGLXProcAddress.get( key );
+ table = mappedGLXProcAddress.get( key );
}
if(null != table) {
- eglExtProcAddressTable = table;
+ eglExtProcAddressTable = (EGLExtProcAddressTable) table;
if(DEBUG) {
System.err.println(getThreadName() + ": !!! GLContext EGL ProcAddressTable reusing key("+key+") -> "+table.hashCode());
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
index 5eb73cd2e..3f8a76535 100644
--- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
@@ -223,7 +223,7 @@ public class GLUquadricImpl implements GLUquadric {
* GLU.LINE: Quadrics are rendered as a set of lines.
*
* GLU.SILHOUETTE: Quadrics are rendered as a set of lines, except that edges
- * separating coplanar faces will not be drawn.
+ * separating coplanar faces will not be drawn.
*
* GLU.POINT: Quadrics are rendered as a set of points.
*
@@ -234,8 +234,8 @@ public class GLUquadricImpl implements GLUquadric {
}
/**
- * specifies what kind of normals are desired for quadrics.
- * The legal values are as follows:
+ * specifies what kind of normals are desired for quadrics.
+ * The legal values are as follows:
*
* GLU.NONE: No normals are generated.
*
@@ -252,7 +252,7 @@ public class GLUquadricImpl implements GLUquadric {
/**
* specifies what kind of orientation is desired for.
- * The orientation values are as follows:
+ * The orientation values are as follows:
*
* GLU.OUTSIDE: Quadrics are drawn with normals pointing outward.
*
@@ -495,10 +495,10 @@ public class GLUquadricImpl implements GLUquadric {
glNormal3f(gl, 0.0f, 0.0f, -1.0f);
}
}
-
+
da = 2.0f * PI / slices;
dr = (outerRadius - innerRadius) / loops;
-
+
switch (drawStyle) {
case GLU.GLU_FILL:
{
@@ -916,7 +916,7 @@ public class GLUquadricImpl implements GLUquadric {
}
/**
- * draws a sphere of the given radius centered around the origin.
+ * draws a sphere of the given radius centered around the origin.
* The sphere is subdivided around the z axis into slices and along the z axis
* into stacks (similar to lines of longitude and latitude).
*
@@ -1188,7 +1188,7 @@ public class GLUquadricImpl implements GLUquadric {
*/
private void normal3f(GL gl, float x, float y, float z) {
float mag;
-
+
mag = (float)Math.sqrt(x * x + y * y + z * z);
if (mag > 0.00001F) {
x /= mag;
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
index 043edac89..2ef4468e5 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
@@ -131,7 +131,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
CArrayOfFloats ps) {
if (output_triangles) {
// TODO code for callback (output_triangles probably indicates callback)
- // System.out.println("TODO curveevaluator.map1f-output_triangles");
+ // System.out.println("TODO curveevaluator.map1f-output_triangles");
} else {
gl.glMap1f(type, ulo, uhi, stride, order, ps.getArray(), ps
.getPointer());
@@ -166,10 +166,10 @@ class GL2CurveEvaluator implements CurveEvaluator {
*/
public void mapgrid1f(int nu, float u1, float u2) {
if (output_triangles) {
- // System.out.println("TODO curveevaluator.mapgrid1f");
+ // System.out.println("TODO curveevaluator.mapgrid1f");
} else
gl.glMapGrid1f(nu, u1, u2);
- // // System.out.println("upravit NU");
+ // // System.out.println("upravit NU");
// gl.glMapGrid1f(50,u1,u2);
}
@@ -189,7 +189,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
*/
if (output_triangles) {
// TODO code for callback
- // System.out.println("TODO openglcurveevaluator.mapmesh1f output_triangles");
+ // System.out.println("TODO openglcurveevaluator.mapmesh1f output_triangles");
} else {
switch (style) {
case Backend.N_MESHFILL:
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
index bc63994cb..155c4f9a9 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
@@ -76,10 +76,10 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
if (output_triangles) {
// TODO outp triangles surfaceevaluator bgnmap2f
- // System.out.println("TODO surfaceevaluator.bgnmap2f output triangles");
+ // System.out.println("TODO surfaceevaluator.bgnmap2f output triangles");
} else {
gl.glPushAttrib(GL2.GL_EVAL_BIT);
- // System.out.println("TODO surfaceevaluator.bgnmap2f glgetintegerv");
+ // System.out.println("TODO surfaceevaluator.bgnmap2f glgetintegerv");
}
}
@@ -112,7 +112,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
public void endmap2f() {
// TODO Auto-generated method stub
if (output_triangles) {
- // System.out.println("TODO surfaceevaluator.endmap2f output triangles");
+ // System.out.println("TODO surfaceevaluator.endmap2f output triangles");
} else {
gl.glPopAttrib();
// TODO use LOD
@@ -142,7 +142,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) {
if (output_triangles) {
- // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles");
+ // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles");
} else {
gl.glMapGrid2d(nu, u0, u1, nv, v0, v1);
}
@@ -159,7 +159,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
*/
public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) {
if (output_triangles) {
- // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles");
+ // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles");
} else {
/* //DEBUG - draw control points
this.poradi++;
@@ -199,7 +199,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) {
// TODO Auto-generated method stub
if (output_triangles) {
- // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles");
+ // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles");
} else {
gl.glMap2f(type, ulo, uhi, ustride, uorder, vlo, vhi, vstride,
vorder, pts.getArray(), pts.getPointer());
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
index bd0eaf771..58b565484 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
@@ -442,7 +442,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
// TODO errval ??
if (numTrims > 0) {
- // System.out.println("TODO glunurbs.do_endsurface - numtrims > 0");
+ // System.out.println("TODO glunurbs.do_endsurface - numtrims > 0");
}
subdivider.beginQuilts(new GL2Backend());
@@ -461,7 +461,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
public void do_endcurve() {
// DONE
- // // System.out.println("do_endcurve");
+ // // System.out.println("do_endcurve");
if (inCurve <= 0) {
do_nurbserror(7);
return;
@@ -509,7 +509,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
private void do_nurbserror(int i) {
// TODO nurberror
- // System.out.println("TODO nurbserror " + i);
+ // System.out.println("TODO nurbserror " + i);
}
/**
@@ -527,7 +527,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
private void loadGLMatrices() {
// TODO Auto-generated method stub
- // System.out.println("TODO glunurbs.loadGLMatrices");
+ // System.out.println("TODO glunurbs.loadGLMatrices");
}
/**
@@ -783,7 +783,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
// DONE
O_surface o_surface = new O_surface();
// TODO nuid
- // System.out.println("TODO glunurbs.bgnsurface nuid");
+ // System.out.println("TODO glunurbs.bgnsurface nuid");
thread("do_bgnsurface", o_surface);
}
@@ -800,7 +800,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
*/
private void endtrim() {
// TODO Auto-generated method stub
- // System.out.println("TODO glunurbs.endtrim");
+ // System.out.println("TODO glunurbs.endtrim");
}
/**
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
index 0d04d4cd6..f4ad70193 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
@@ -47,7 +47,7 @@ public class ArcSdirSorter {
*/
public ArcSdirSorter(Subdivider subdivider) {
//TODO
- // System.out.println("TODO arcsdirsorter.constructor");
+ // System.out.println("TODO arcsdirsorter.constructor");
}
/**
@@ -57,7 +57,7 @@ public class ArcSdirSorter {
*/
public void qsort(CArrayOfArcs list, int count) {
// TODO
- // System.out.println("TODO arcsdirsorter.qsort");
+ // System.out.println("TODO arcsdirsorter.qsort");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
index bee98b8c3..be72c53d2 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
@@ -46,7 +46,7 @@ public class ArcTdirSorter {
*/
public ArcTdirSorter(Subdivider subdivider) {
// TODO Auto-generated constructor stub
- // System.out.println("TODO arcTsorter.konstruktor");
+ // System.out.println("TODO arcTsorter.konstruktor");
}
/**
* Sorts list of arcs
@@ -55,6 +55,6 @@ public class ArcTdirSorter {
*/
public void qsort(CArrayOfArcs list, int count) {
// TODO Auto-generated method stub
- // System.out.println("TODO arcTsorter.qsort");
+ // System.out.println("TODO arcTsorter.qsort");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java
index 2e4d3eb96..bd6311414 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java
@@ -72,7 +72,7 @@ public class ArcTesselator {
*/
public void pwl_right(Arc newright, float s, float t1, float t2, float f) {
// TODO Auto-generated method stub
- // System.out.println("TODO arctesselator.pwl_right");
+ // System.out.println("TODO arctesselator.pwl_right");
}
/**
@@ -85,6 +85,6 @@ public class ArcTesselator {
*/
public void pwl_left(Arc newright, float s, float t2, float t1, float f) {
// TODO Auto-generated method stub
- // System.out.println("TODO arctesselator.pwl_left");
+ // System.out.println("TODO arctesselator.pwl_left");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
index 4959f8000..610a19556 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
@@ -188,7 +188,7 @@ public abstract class Backend {
* @param m step in v direction
*/
public void surfmesh(int u, int v, int n, int m) {
- // System.out.println("TODO backend.surfmesh wireframequads");
+ // System.out.println("TODO backend.surfmesh wireframequads");
// TODO wireframequads
surfaceEvaluator.mapmesh2f(NurbsConsts.N_MESHFILL, u, u + n, v, v + m);
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
index b0ff4e6e5..786781723 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
@@ -135,7 +135,7 @@ public class Curve {
stride);
}
if (cullval == Subdivider.CULL_ACCEPT) {
- // System.out.println("TODO curve.Curve-cullval");
+ // System.out.println("TODO curve.Curve-cullval");
// mapdesc.xformCulling(ps,qs.get().order,qs.get().stride,cpts,stride);
}
@@ -145,13 +145,13 @@ public class Curve {
range[2] = range[1] - range[0];
// TODO it is necessary to solve problem with "this" pointer here
if (range[0] != pta[0]) {
- // System.out.println("TODO curve.Curve-range0");
+ // System.out.println("TODO curve.Curve-range0");
// Curve lower=new Curve(this,pta,0);
// lower.next=next;
// this=lower;
}
if (range[1] != ptb[0]) {
- // System.out.println("TODO curve.Curve-range1");
+ // System.out.println("TODO curve.Curve-range1");
// Curve lower=new Curve(this,ptb,0);
}
}
@@ -162,7 +162,7 @@ public class Curve {
*/
public int cullCheck() {
if (cullval == Subdivider.CULL_ACCEPT) {
- // System.out.println("TODO curve.cullval");
+ // System.out.println("TODO curve.cullval");
// cullval=mapdesc.cullCheck(cpts,order,stride);
}
// TODO compute cullval and return the computed value
@@ -189,16 +189,16 @@ public class Curve {
int val = 0;
// mapdesc.project(spts,stride,tmp,tstride,order);
- // System.out.println("TODO curve.getsptepsize mapdesc.project");
+ // System.out.println("TODO curve.getsptepsize mapdesc.project");
if (val == 0) {
setstepsize(mapdesc.maxrate);
} else {
float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE);
if (mapdesc.isParametricDistanceSampling()) {
- // System.out.println("TODO curve.getstepsize - parametric");
+ // System.out.println("TODO curve.getstepsize - parametric");
} else if (mapdesc.isPathLengthSampling()) {
- // System.out.println("TODO curve.getstepsize - pathlength");
+ // System.out.println("TODO curve.getstepsize - pathlength");
} else {
setstepsize(mapdesc.maxrate);
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java
index 5c80ffd30..d9d012606 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java
@@ -51,6 +51,6 @@ public class DisplayList {
*/
public void append(Object src, Method m, Object arg) {
// TODO Auto-generated method stub
- // System.out.println("TODO displaylist append");
+ // System.out.println("TODO displaylist append");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
index 4f97b1271..114832a1c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
@@ -366,7 +366,7 @@ public class Knotspec {
break;
default:
// TODO break with copying in general case
- // System.out.println("TODO knotspec.pt_io_copy");
+ // System.out.println("TODO knotspec.pt_io_copy");
break;
}
@@ -388,7 +388,7 @@ public class Knotspec {
if (istransformed) {
p.raisePointerBy(postoffset);
for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(),
- p.getPointer() + postwidth); p.getPointer() != pend
+ p.getPointer() + postwidth); p.getPointer() != pend
.getPointer(); p.raisePointerBy(poststride))
next.transform(p);
@@ -409,7 +409,7 @@ public class Knotspec {
if (istransformed) {
p.raisePointerBy(postoffset);
for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(),
- p.getPointer() + postwidth); p.getPointer() != pend
+ p.getPointer() + postwidth); p.getPointer() != pend
.getPointer(); p.raisePointerBy(poststride)) {
kspectotrans.insert(p);
}
@@ -549,8 +549,8 @@ public class Knotspec {
* z.getRelative(0)));
break;
default:
- //no need of default - see previous method and its case statement
- // System.out.println("TODO pt_oo_sum default");
+ //no need of default - see previous method and its case statement
+ // System.out.println("TODO pt_oo_sum default");
break;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
index 89389dea6..aac4dfc52 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
@@ -160,7 +160,7 @@ public class Knotvector {
*/
public void show(String msg) {
// TODO Auto-generated method stub
- // System.out.println("TODO knotvector.show");
+ // System.out.println("TODO knotvector.show");
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
index 8fab114ff..bd5d2db98 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
@@ -349,7 +349,7 @@ public class Mapdesc {
*/
public float getProperty(int tag) {
// TODO Auto-generated method stub
- // System.out.println("TODO mapdesc.getproperty");
+ // System.out.println("TODO mapdesc.getproperty");
return 0;
}
@@ -428,10 +428,10 @@ public class Mapdesc {
* @param outstride output number of control points' coordinates
*/
private void xFormMat(float[][] mat, CArrayOfFloats pts, int order,
- int stride, float[] cp, int outstride) {
+ int stride, float[] cp, int outstride) {
// TODO Auto-generated method stub
- // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats");
+ // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats");
if (isrational > 0) {
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java
index 51c43fca7..a44f2451c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java
@@ -49,6 +49,6 @@ public class Patch {
* @param patch
*/
public Patch(Quilt q, float[] pta, float[] ptb, Patch patch) {
- // System.out.println("TODO patch.constructor");
+ // System.out.println("TODO patch.constructor");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
index f60a0cc43..f1e499a28 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
@@ -82,7 +82,7 @@ public class Patchlist {
*/
public Patchlist(Patchlist patchlist, int param, float mid) {
// TODO Auto-generated constructor stub
- // System.out.println("TODO patchlist.konstruktor 2");
+ // System.out.println("TODO patchlist.konstruktor 2");
}
/**
@@ -91,7 +91,7 @@ public class Patchlist {
*/
public int cullCheck() {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.cullcheck");
+ // System.out.println("TODO patchlist.cullcheck");
return 0;
}
@@ -99,7 +99,7 @@ public class Patchlist {
* Empty method
*/
public void getstepsize() {
- // System.out.println("TODO patchlist.getsptepsize");
+ // System.out.println("TODO patchlist.getsptepsize");
// TODO Auto-generated method stub
}
@@ -110,7 +110,7 @@ public class Patchlist {
*/
public boolean needsSamplingSubdivision() {
// TODO Auto-generated method stub
- // System.out.println("patchlist.needsSamplingSubdivision");
+ // System.out.println("patchlist.needsSamplingSubdivision");
return false;
}
@@ -121,7 +121,7 @@ public class Patchlist {
*/
public boolean needsSubdivision(int i) {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.needsSubdivision");
+ // System.out.println("TODO patchlist.needsSubdivision");
return false;
}
@@ -131,7 +131,7 @@ public class Patchlist {
*/
public boolean needsNonSamplingSubdivision() {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.needsNonSamplingSubdivision");
+ // System.out.println("TODO patchlist.needsNonSamplingSubdivision");
return false;
}
@@ -140,6 +140,6 @@ public class Patchlist {
*/
public void bbox() {
// TODO Auto-generated method stub
- // System.out.println("TODO patchlist.bbox");
+ // System.out.println("TODO patchlist.bbox");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java
index 6d732a44f..6bea4928c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java
@@ -248,7 +248,7 @@ public class Quilt {
*/
public int isCulled() {
if (mapdesc.isCulling()) {
- // System.out.println("TODO quilt.isculled mapdesc.isculling");
+ // System.out.println("TODO quilt.isculled mapdesc.isculling");
return 0;
} else {
return Subdivider.CULL_ACCEPT;
@@ -277,6 +277,6 @@ public class Quilt {
*/
public void findRates(Flist sbrkpts, Flist tbrkpts, float[] rate) {
// TODO Auto-generated method stub
- // System.out.println("TODO quilt.findrates");
+ // System.out.println("TODO quilt.findrates");
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt b/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt
index 89630c71e..7f80e568c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/README.txt
@@ -1,59 +1,59 @@
Unimplemented functionality
- - tesselation and callbacks
- - trimming
- - setting NURBS properties (-> sampling etc.)
+ - tesselation and callbacks
+ - trimming
+ - setting NURBS properties (-> sampling etc.)
Differences from C++ source
- - no pooling
- - pointers to arrays are replaced by CArrayOf... classes and their methods
+ - no pooling
+ - pointers to arrays are replaced by CArrayOf... classes and their methods
Unimplemented or incomplete "calltree top" methods (according to glu.def in Mesa 6.5)
- gluBeginTrim
- gluDeleteNurbsRenderer - won't be needed
- gluEndTrim
- gluGetNurbsProperty
- gluLoadSamplingMatrices
- gluNurbsCallback
- gluNurbsCallbackData
- gluNurbsCallbackDataEXT
- gluNurbsCurve - TODO type switch
- gluNurbsProperty
- gluPwlCurve
- gluQuadricCallback - not a NURBS method
+ gluBeginTrim
+ gluDeleteNurbsRenderer - won't be needed
+ gluEndTrim
+ gluGetNurbsProperty
+ gluLoadSamplingMatrices
+ gluNurbsCallback
+ gluNurbsCallbackData
+ gluNurbsCallbackDataEXT
+ gluNurbsCurve - TODO type switch
+ gluNurbsProperty
+ gluPwlCurve
+ gluQuadricCallback - not a NURBS method
As of files
- - Arc[ST]dirSorter.java - unimplemented (part of tesselation)
- - Backend.java:194 - wireframe quads - part of tesselation/callback
- - Curve.java:141-204 - culling
- - DisplayList.java:57 - append to DL - not sure whether it will be needed
- - GLUnurbs.java :443,484 - error values
- :445 - trimming
- :512 - error handling (callback)
- :530 - loadGLmatrices
- :786 - nuid - nurbs object id - won't be needed I think
- :803 - end trim
- - GLUwNURBS.java:68,176 - NUBRS properties
- - Knotspec.java :371 - copying in general case (more than 4 coords)
- :517 - copying with more than 4 coords
- :556 - pt_oo_sum default
- - Knotvector.java:165 - show method (probably debugging)
- - Mapdesc.java :354 - get property
- :435 - xFormMat - change param cp to CArrayOfFloats; probably sampling functionality
- - Maplist.java:68 - clear ?
- - OpenGLCurveEvaluator.java :132 - tess./callback code
- :168 - mapgrid1f
- :190 - tess./callback code (output triangles)
- - OpenGLSurfaceEvaluator.java :77 . tess./callback code
- :81 - glGetIntegerValue
- :114 - tess./callback code
- :117 - Level of detail
- :144,161,201 - tess./callback code - output triangles
- - Patch.java:55 - constructor stuff ?
- - Patchlist.java:55 - constructor stuff ?
- :97 - cull check
- :105 - step size
- :115 - need of sampling subdivision
- :126 - need of subdivision
- :137 - need of non sampling subd.
- :146 - bbox (??)
- -Quilt.java :254 - culling
- :282 - rates
- -Subdivider.java - all TODOs - it's stuff about trimming probably
- :545 - jumpbuffer - not sure purpose it exactly served in original source
+ - Arc[ST]dirSorter.java - unimplemented (part of tesselation)
+ - Backend.java:194 - wireframe quads - part of tesselation/callback
+ - Curve.java:141-204 - culling
+ - DisplayList.java:57 - append to DL - not sure whether it will be needed
+ - GLUnurbs.java :443,484 - error values
+ :445 - trimming
+ :512 - error handling (callback)
+ :530 - loadGLmatrices
+ :786 - nuid - nurbs object id - won't be needed I think
+ :803 - end trim
+ - GLUwNURBS.java:68,176 - NUBRS properties
+ - Knotspec.java :371 - copying in general case (more than 4 coords)
+ :517 - copying with more than 4 coords
+ :556 - pt_oo_sum default
+ - Knotvector.java:165 - show method (probably debugging)
+ - Mapdesc.java :354 - get property
+ :435 - xFormMat - change param cp to CArrayOfFloats; probably sampling functionality
+ - Maplist.java:68 - clear ?
+ - OpenGLCurveEvaluator.java :132 - tess./callback code
+ :168 - mapgrid1f
+ :190 - tess./callback code (output triangles)
+ - OpenGLSurfaceEvaluator.java :77 . tess./callback code
+ :81 - glGetIntegerValue
+ :114 - tess./callback code
+ :117 - Level of detail
+ :144,161,201 - tess./callback code - output triangles
+ - Patch.java:55 - constructor stuff ?
+ - Patchlist.java:55 - constructor stuff ?
+ :97 - cull check
+ :105 - step size
+ :115 - need of sampling subdivision
+ :126 - need of subdivision
+ :137 - need of non sampling subd.
+ :146 - bbox (??)
+ -Quilt.java :254 - culling
+ :282 - rates
+ -Subdivider.java - all TODOs - it's stuff about trimming probably
+ :545 - jumpbuffer - not sure purpose it exactly served in original source
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
index 3378dba8d..37774f811 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
@@ -187,7 +187,7 @@ public class Subdivider {
renderhints.init();
if (qlist == null) {
- // System.out.println("qlist is null");
+ // System.out.println("qlist is null");
return;
}
@@ -217,7 +217,7 @@ public class Subdivider {
} else {
float[] rate = new float[2];
qlist.findRates(spbrkpts, tpbrkpts, rate);
- // System.out.println("subdivider.drawsurfaces decompose");
+ // System.out.println("subdivider.drawsurfaces decompose");
}
backend.bgnsurf(renderhints.wiretris, renderhints.wirequads);
@@ -268,7 +268,7 @@ public class Subdivider {
*/
private void freejarcs(Bin initialbin2) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.freejarcs");
+ // System.out.println("TODO subdivider.freejarcs");
}
/**
@@ -319,7 +319,7 @@ public class Subdivider {
}
}
} else{
- // System.out.println("Source is empty - subdivider.splitins");
+ // System.out.println("Source is empty - subdivider.splitins");
}
}
@@ -331,7 +331,7 @@ public class Subdivider {
*/
private void splitInT(Bin source, int start, int end) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.splitint");
+ // System.out.println("TODO subdivider.splitint");
if (source.isnonempty()) {
if (start != end) {
@@ -485,7 +485,7 @@ public class Subdivider {
*/
private void monosplitInS(Bin source, int start, int end) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.monosplitins");
+ // System.out.println("TODO subdivider.monosplitins");
}
/**
@@ -494,7 +494,7 @@ public class Subdivider {
*/
private void findIrregularS(Bin source) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.findIrregularS");
+ // System.out.println("TODO subdivider.findIrregularS");
}
/**
@@ -502,7 +502,7 @@ public class Subdivider {
*/
private void setArcTypePwl() {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.setarctypepwl");
+ // System.out.println("TODO subdivider.setarctypepwl");
}
/**
@@ -512,7 +512,7 @@ public class Subdivider {
*/
private void tesselation(Bin source, Patchlist patchlist) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.tesselation");
+ // System.out.println("TODO subdivider.tesselation");
}
/**
@@ -520,7 +520,7 @@ public class Subdivider {
*/
private void setDegenerate() {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.setdegenerate");
+ // System.out.println("TODO subdivider.setdegenerate");
}
/**
@@ -611,7 +611,7 @@ public class Subdivider {
*/
private void join_t(Bin left, Bin right, Arc arc, Arc relative) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.join_t");
+ // System.out.println("TODO subdivider.join_t");
}
/**
@@ -621,7 +621,7 @@ public class Subdivider {
*/
private void check_t(Arc arc, Arc relative) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.check_t");
+ // System.out.println("TODO subdivider.check_t");
}
/**
@@ -670,7 +670,7 @@ public class Subdivider {
*/
private void link(Arc jarc1, Arc jarc2, Arc newright, Arc newleft) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.link");
+ // System.out.println("TODO subdivider.link");
}
/**
@@ -679,7 +679,7 @@ public class Subdivider {
*/
private boolean isBezierArcType() {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.isbezierarc");
+ // System.out.println("TODO subdivider.isbezierarc");
return true;
}
@@ -690,7 +690,7 @@ public class Subdivider {
*/
private void simplelink(Arc jarc1, Arc jarc2) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.simplelink");
+ // System.out.println("TODO subdivider.simplelink");
}
/**
@@ -700,7 +700,7 @@ public class Subdivider {
*/
private void check_s(Arc arc, Arc relative) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.check_s");
+ // System.out.println("TODO subdivider.check_s");
}
@@ -756,7 +756,7 @@ public class Subdivider {
} else {
if (hdiff > 0) {
// TODO rest
- // System.out.println("TODO subdivider.partition rest of else");
+ // System.out.println("TODO subdivider.partition rest of else");
} else if (hdiff == 0) {
tailonleft.addarc(jarc);
} else {
@@ -788,7 +788,7 @@ public class Subdivider {
private void classify_tailonright_t(Bin tailonright, Bin intersections,
Bin right, float value) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.classify_tailonright_t");
+ // System.out.println("TODO subdivider.classify_tailonright_t");
}
@@ -862,7 +862,7 @@ public class Subdivider {
*/
private boolean ccwTurn_sr(Arc prev, Arc j) {
// TODO Auto-generated method stub
- // System.out.println("TODO ccwTurn_sr");
+ // System.out.println("TODO ccwTurn_sr");
return false;
}
@@ -876,7 +876,7 @@ public class Subdivider {
private void classify_headonright_t(Bin headonright, Bin intersections,
Bin right, float value) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.classify_headonright_t");
+ // System.out.println("TODO subdivider.classify_headonright_t");
}
/**
@@ -889,7 +889,7 @@ public class Subdivider {
private void classify_tailonleft_t(Bin tailonleft, Bin intersections,
Bin left, float value) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.classify_tailonleft_t");
+ // System.out.println("TODO subdivider.classify_tailonleft_t");
}
/**
@@ -930,7 +930,7 @@ public class Subdivider {
*/
private boolean ccwTurn_tl(Arc prev, Arc j) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.ccwTurn_tl");
+ // System.out.println("TODO subdivider.ccwTurn_tl");
return false;
}
@@ -1004,7 +1004,7 @@ public class Subdivider {
*/
private boolean ccwTurn_sl(Arc prev, Arc j) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.ccwTurn_sl");
+ // System.out.println("TODO subdivider.ccwTurn_sl");
return false;
}
@@ -1018,7 +1018,7 @@ public class Subdivider {
*/
private int arc_split(Arc jarc, int param, float value, int i) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.arc_split");
+ // System.out.println("TODO subdivider.arc_split");
return 0;
}
@@ -1045,7 +1045,7 @@ public class Subdivider {
*/
private void outline(Bin source) {
// TODO Auto-generated method stub
- // System.out.println("TODO subdivider.outline");
+ // System.out.println("TODO subdivider.outline");
}
/**
@@ -1128,7 +1128,7 @@ public class Subdivider {
if (curvelist.needsSamplingSubdivision() && (subdivisions > 0)) {
// TODO kód
- // System.out.println("TODO subdivider-needsSamplingSubdivision");
+ // System.out.println("TODO subdivider-needsSamplingSubdivision");
} else {
int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize);
backend.curvgrid(curvelist.range[0], curvelist.range[1], nu);
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java
index 13c226a7c..17f58309a 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/ActiveRegion.java
@@ -54,16 +54,16 @@ package jogamp.opengl.glu.tessellator;
class ActiveRegion {
- GLUhalfEdge eUp; /* upper edge, directed right to left */
- DictNode nodeUp; /* dictionary node corresponding to eUp */
- int windingNumber; /* used to determine which regions are
+ GLUhalfEdge eUp; /* upper edge, directed right to left */
+ DictNode nodeUp; /* dictionary node corresponding to eUp */
+ int windingNumber; /* used to determine which regions are
* inside the polygon */
- boolean inside; /* is this region inside the polygon? */
- boolean sentinel; /* marks fake edges at t = +/-infinity */
- boolean dirty; /* marks regions where the upper or lower
+ boolean inside; /* is this region inside the polygon? */
+ boolean sentinel; /* marks fake edges at t = +/-infinity */
+ boolean dirty; /* marks regions where the upper or lower
* edge has changed, but we haven't checked
* whether they intersect yet */
- boolean fixUpperEdge; /* marks temporary edges introduced when
+ boolean fixUpperEdge; /* marks temporary edges introduced when
* we process a "right vertex" (one without
* any edges leaving to the right) */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java
index b15bf7195..892722d9f 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUface.java
@@ -53,13 +53,13 @@
package jogamp.opengl.glu.tessellator;
class GLUface {
- public GLUface next; /* next face (never NULL) */
- public GLUface prev; /* previous face (never NULL) */
- public GLUhalfEdge anEdge; /* a half edge with this left face */
- public Object data; /* room for client's data */
+ public GLUface next; /* next face (never NULL) */
+ public GLUface prev; /* previous face (never NULL) */
+ public GLUhalfEdge anEdge; /* a half edge with this left face */
+ public Object data; /* room for client's data */
/* Internal data (keep hidden) */
- public GLUface trail; /* "stack" for conversion to strips */
- public boolean marked; /* flag for conversion to strips */
- public boolean inside; /* this face is in the polygon interior */
+ public GLUface trail; /* "stack" for conversion to strips */
+ public boolean marked; /* flag for conversion to strips */
+ public boolean inside; /* this face is in the polygon interior */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java
index 385a4384b..29944f9b2 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java
@@ -53,16 +53,16 @@
package jogamp.opengl.glu.tessellator;
class GLUhalfEdge {
- public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */
- public GLUhalfEdge Sym; /* same edge, opposite direction */
- public GLUhalfEdge Onext; /* next edge CCW around origin */
- public GLUhalfEdge Lnext; /* next edge CCW around left face */
- public GLUvertex Org; /* origin vertex (Overtex too long) */
- public jogamp.opengl.glu.tessellator.GLUface Lface; /* left face */
+ public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */
+ public GLUhalfEdge Sym; /* same edge, opposite direction */
+ public GLUhalfEdge Onext; /* next edge CCW around origin */
+ public GLUhalfEdge Lnext; /* next edge CCW around left face */
+ public GLUvertex Org; /* origin vertex (Overtex too long) */
+ public jogamp.opengl.glu.tessellator.GLUface Lface; /* left face */
/* Internal data (keep hidden) */
- public jogamp.opengl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */
- public int winding; /* change in winding number when crossing */
+ public jogamp.opengl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */
+ public int winding; /* change in winding number when crossing */
public boolean first;
public GLUhalfEdge(boolean first) {
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java
index dfdf5be70..10af74319 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUmesh.java
@@ -53,8 +53,8 @@
package jogamp.opengl.glu.tessellator;
class GLUmesh {
- GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */
- jogamp.opengl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */
- jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */
- jogamp.opengl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */
+ GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */
+ jogamp.opengl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */
+ jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */
+ jogamp.opengl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
index 182820bbc..d594cb3eb 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
@@ -59,32 +59,32 @@ import javax.media.opengl.glu.*;
public class GLUtessellatorImpl implements GLUtessellator {
public static final int TESS_MAX_CACHE = 100;
- private int state; /* what begin/end calls have we seen? */
+ private int state; /* what begin/end calls have we seen? */
- private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */
- GLUmesh mesh; /* stores the input contours, and eventually
+ private GLUhalfEdge lastEdge; /* lastEdge->Org is the most recent vertex */
+ GLUmesh mesh; /* stores the input contours, and eventually
the tessellation itself */
/*** state needed for projecting onto the sweep plane ***/
- double[] normal = new double[3]; /* user-specified normal (if provided) */
- double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */
- double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */
+ double[] normal = new double[3]; /* user-specified normal (if provided) */
+ double[] sUnit = new double[3]; /* unit vector in s-direction (debugging) */
+ double[] tUnit = new double[3]; /* unit vector in t-direction (debugging) */
/*** state needed for the line sweep ***/
- private double relTolerance; /* tolerance for merging features */
- int windingRule; /* rule for determining polygon interior */
- boolean fatalError; /* fatal error: needed combine callback */
+ private double relTolerance; /* tolerance for merging features */
+ int windingRule; /* rule for determining polygon interior */
+ boolean fatalError; /* fatal error: needed combine callback */
- Dict dict; /* edge dictionary for sweep line */
- PriorityQ pq; /* priority queue of vertex events */
- GLUvertex event; /* current sweep event being processed */
+ Dict dict; /* edge dictionary for sweep line */
+ PriorityQ pq; /* priority queue of vertex events */
+ GLUvertex event; /* current sweep event being processed */
/*** state needed for rendering callbacks (see render.c) ***/
- boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */
- boolean boundaryOnly; /* Extract contours, not triangles */
+ boolean flagBoundary; /* mark boundary edges (use EdgeFlag) */
+ boolean boundaryOnly; /* Extract contours, not triangles */
boolean avoidDegenerateTris; /* JOGL-specific hint to try to improve triangulation
by avoiding producing degenerate (zero-area) triangles;
has not been tested exhaustively and is therefore an option */
@@ -96,12 +96,12 @@ public class GLUtessellatorImpl implements GLUtessellator {
/*** state needed to cache single-contour polygons for renderCache() */
- private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */
- int cacheCount; /* number of cached vertices */
- CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */
+ private boolean flushCacheOnNextVertex; /* empty cache on next vertex() call */
+ int cacheCount; /* number of cached vertices */
+ CachedVertex[] cache = new CachedVertex[TESS_MAX_CACHE]; /* the vertex data */
/*** rendering callbacks that also pass polygon data ***/
- private Object polygonData; /* client data for current polygon */
+ private Object polygonData; /* client data for current polygon */
private GLUtessellatorCallback callBegin;
private GLUtessellatorCallback callEdgeFlag;
@@ -120,10 +120,10 @@ public class GLUtessellatorImpl implements GLUtessellator {
private GLUtessellatorCallback callCombineData;
private static final double GLU_TESS_DEFAULT_TOLERANCE = 0.0;
-// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */
+// private static final int GLU_TESS_MESH = 100112; /* void (*)(GLUmesh *mesh) */
private static GLUtessellatorCallback NULL_CB = new GLUtessellatorCallbackAdapter();
-// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \
+// #define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \
// MAX(sizeof(GLUvertex),sizeof(GLUface))))
private GLUtessellatorImpl() {
@@ -220,7 +220,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
case GLU.GLU_TESS_WINDING_RULE:
int windingRule = (int) value;
- if (windingRule != value) break; /* not an integer */
+ if (windingRule != value) break; /* not an integer */
switch (windingRule) {
case GLU.GLU_TESS_WINDING_ODD:
@@ -523,7 +523,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
* Each interior region is guaranteed be monotone.
*/
if (!Sweep.__gl_computeInterior(this)) {
- throw new RuntimeException(); /* could've used a label */
+ throw new RuntimeException(); /* could've used a label */
}
mesh = this.mesh;
@@ -539,7 +539,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
} else {
rc = TessMono.__gl_meshTessellateInterior(mesh, avoidDegenerateTris);
}
- if (!rc) throw new RuntimeException(); /* could've used a label */
+ if (!rc) throw new RuntimeException(); /* could've used a label */
Mesh.__gl_meshCheckMesh(mesh);
@@ -552,7 +552,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
if (boundaryOnly) {
Render.__gl_renderBoundary(this, mesh); /* output boundary contours */
} else {
- Render.__gl_renderMesh(this, mesh); /* output strips and fans */
+ Render.__gl_renderMesh(this, mesh); /* output strips and fans */
}
}
// if (callMesh != NULL_CB) {
@@ -564,7 +564,7 @@ public class GLUtessellatorImpl implements GLUtessellator {
// * faces in the first place.
// */
// TessMono.__gl_meshDiscardExterior(mesh);
-// callMesh.mesh(mesh); /* user wants the mesh itself */
+// callMesh.mesh(mesh); /* user wants the mesh itself */
// mesh = null;
// polygonData = null;
// return;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java
index c30d75946..ecc91c2b6 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUvertex.java
@@ -53,13 +53,13 @@
package jogamp.opengl.glu.tessellator;
class GLUvertex {
- public GLUvertex next; /* next vertex (never NULL) */
- public GLUvertex prev; /* previous vertex (never NULL) */
- public jogamp.opengl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */
- public Object data; /* client's data */
+ public GLUvertex next; /* next vertex (never NULL) */
+ public GLUvertex prev; /* previous vertex (never NULL) */
+ public jogamp.opengl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */
+ public Object data; /* client's data */
/* Internal data (keep hidden) */
- public double[] coords = new double[3]; /* vertex location in 3D */
- public double s, t; /* projection onto the sweep plane */
- public int pqHandle; /* to allow deletion from priority queue */
+ public double[] coords = new double[3]; /* vertex location in 3D */
+ public double s, t; /* projection onto the sweep plane */
+ public int pqHandle; /* to allow deletion from priority queue */
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java
index 942dfe8d1..eb48aa5a4 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java
@@ -281,8 +281,8 @@ class Mesh {
/* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the
* mesh connectivity and topology. It changes the mesh so that
- * eOrg->Onext <- OLD( eDst->Onext )
- * eDst->Onext <- OLD( eOrg->Onext )
+ * eOrg->Onext <- OLD( eDst->Onext )
+ * eDst->Onext <- OLD( eOrg->Onext )
* where OLD(...) means the value before the meshSplice operation.
*
* This can have two effects on the vertex structure:
@@ -453,9 +453,9 @@ class Mesh {
/* Set the vertex and face information */
eOrg.Sym.Org = eNew.Org;
- eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */
+ eNew.Sym.Org.anEdge = eNew.Sym; /* may have pointed to eOrg.Sym */
eNew.Sym.Lface = eOrg.Sym.Lface;
- eNew.winding = eOrg.winding; /* copy old winding information */
+ eNew.winding = eOrg.winding; /* copy old winding information */
eNew.Sym.winding = eOrg.Sym.winding;
return eNew;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
index 7d5acd9f8..196e6cf27 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
@@ -60,7 +60,7 @@ class Normal {
}
static boolean SLANTED_SWEEP = false;
- static double S_UNIT_X; /* Pre-normalized */
+ static double S_UNIT_X; /* Pre-normalized */
static double S_UNIT_Y;
private static final boolean TRUE_PROJECT = false;
@@ -75,7 +75,7 @@ class Normal {
* direction to be something unusual (ie. not parallel to one of the
* coordinate axes).
*/
- S_UNIT_X = 0.50941539564955385; /* Pre-normalized */
+ S_UNIT_X = 0.50941539564955385; /* Pre-normalized */
S_UNIT_Y = 0.86052074622010633;
} else {
S_UNIT_X = 1.0;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
index 899df2e3d..474056cc3 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
@@ -76,7 +76,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
freeList = 0;
this.leq = leq;
- nodes[1].handle = 1; /* so that Minimum() returns NULL */
+ nodes[1].handle = 1; /* so that Minimum() returns NULL */
handles[1].key = null;
}
@@ -171,7 +171,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
}
nodes = pqNodes;
if (nodes == null) {
- nodes = saveNodes; /* restore ptr to free upon return */
+ nodes = saveNodes; /* restore ptr to free upon return */
return Integer.MAX_VALUE;
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
index f37f98ace..f9e0225e3 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
@@ -152,7 +152,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
} while (LT(leq, keys[order[j]], keys[piv]));
Swap(order, i, j);
} while (i < j);
- Swap(order, i, j); /* Undo last swap */
+ Swap(order, i, j); /* Undo last swap */
if (i - p < r - j) {
stack[top].p = j + 1;
stack[top].r = r;
@@ -176,7 +176,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
}
max = size;
initialized = true;
- heap.pqInit(); /* always succeeds */
+ heap.pqInit(); /* always succeeds */
/* #ifndef NDEBUG
p = order;
@@ -208,7 +208,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
System.arraycopy( keys, 0, pqKeys, 0, keys.length );
keys = pqKeys;
if (keys == null) {
- keys = saveKey; /* restore ptr to free upon return */
+ keys = saveKey; /* restore ptr to free upon return */
return Integer.MAX_VALUE;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
index 34b7ee55b..1801e1c59 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
@@ -79,8 +79,8 @@ class Render {
this.render = render;
}
- long size; /* number of triangles used */
- jogamp.opengl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */
+ long size; /* number of triangles used */
+ jogamp.opengl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */
renderCallBack render;
};
@@ -295,7 +295,7 @@ class Render {
*/
jogamp.opengl.glu.tessellator.GLUhalfEdge e;
int newState;
- int edgeState = -1; /* force edge state output for first vertex */
+ int edgeState = -1; /* force edge state output for first vertex */
tess.callBeginOrBeginData(GL.GL_TRIANGLES);
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
index 95eb5dda1..b4a400c1c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
@@ -300,7 +300,7 @@ class Sweep {
regPrev = regFirst;
ePrev = regFirst.eUp;
while (regPrev != regLast) {
- regPrev.fixUpperEdge = false; /* placement was OK */
+ regPrev.fixUpperEdge = false; /* placement was OK */
reg = RegionBelow(regPrev);
e = reg.eUp;
if (e.Org != ePrev.Org) {
@@ -327,7 +327,7 @@ class Sweep {
if (!Mesh.__gl_meshSplice(e.Sym.Lnext, e)) throw new RuntimeException();
if (!Mesh.__gl_meshSplice(ePrev, e)) throw new RuntimeException();
}
- FinishRegion(tess, regPrev); /* may change reg.eUp */
+ FinishRegion(tess, regPrev); /* may change reg.eUp */
ePrev = reg.eUp;
regPrev = reg;
}
@@ -627,11 +627,11 @@ class Sweep {
assert (orgUp != tess.event && orgLo != tess.event);
assert (!regUp.fixUpperEdge && !regLo.fixUpperEdge);
- if (orgUp == orgLo) return false; /* right endpoints are the same */
+ if (orgUp == orgLo) return false; /* right endpoints are the same */
tMinUp = Math.min(orgUp.t, dstUp.t);
tMaxLo = Math.max(orgLo.t, dstLo.t);
- if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */
+ if (tMinUp > tMaxLo) return false; /* t ranges do not overlap */
if (Geom.VertLeq(orgUp, orgLo)) {
if (Geom.EdgeSign(dstLo, orgUp, orgLo) > 0) return false;
@@ -743,7 +743,7 @@ class Sweep {
eUp.Org.t = isect.t;
eUp.Org.pqHandle = tess.pq.pqInsert(eUp.Org); /* __gl_pqSortInsert */
if (eUp.Org.pqHandle == Long.MAX_VALUE) {
- tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
+ tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
tess.pq = null;
throw new RuntimeException();
}
@@ -959,7 +959,7 @@ class Sweep {
regUp.fixUpperEdge = false;
}
if (!Mesh.__gl_meshSplice(vEvent.anEdge, e)) throw new RuntimeException();
- SweepEvent(tess, vEvent); /* recurse */
+ SweepEvent(tess, vEvent); /* recurse */
return;
}
@@ -1001,9 +1001,9 @@ class Sweep {
*
* - the degenerate case: if vEvent is close enough to U or L, we
* merge vEvent into that edge chain. The subcases are:
- * - merging with the rightmost vertex of U or L
- * - merging with the active edge of U or L
- * - merging with an already-processed portion of U or L
+ * - merging with the rightmost vertex of U or L
+ * - merging with the active edge of U or L
+ * - merging with an already-processed portion of U or L
*/ {
ActiveRegion regUp, regLo, reg;
GLUhalfEdge eUp, eLo, eNew;
@@ -1063,7 +1063,7 @@ class Sweep {
ActiveRegion regUp, reg;
GLUhalfEdge e, eTopLeft, eBottomLeft;
- tess.event = vEvent; /* for access in EdgeLeq() */
+ tess.event = vEvent; /* for access in EdgeLeq() */
DebugEvent(tess);
/* Check if this vertex is the right endpoint of an edge that is
@@ -1130,7 +1130,7 @@ class Sweep {
e.Org.t = t;
e.Sym.Org.s = -SENTINEL_COORD;
e.Sym.Org.t = t;
- tess.event = e.Sym.Org; /* initialize it */
+ tess.event = e.Sym.Org; /* initialize it */
reg.eUp = e;
reg.windingNumber = 0;
@@ -1180,7 +1180,7 @@ class Sweep {
DeleteRegion(tess, reg);
/* __gl_meshDelete( reg.eUp );*/
}
- Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */
+ Dict.dictDeleteDict(tess.dict); /* __gl_dictListDeleteDict */
}
@@ -1199,7 +1199,7 @@ class Sweep {
if (Geom.VertEq(e.Org, e.Sym.Org) && e.Lnext.Lnext != e) {
/* Zero-length edge, contour has at least 3 edges */
- SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */
+ SpliceMergeVertices(tess, eLnext, e); /* deletes e.Org */
if (!Mesh.__gl_meshDelete(e)) throw new RuntimeException(); /* e is a self-loop */
e = eLnext;
eLnext = e.Lnext;
@@ -1243,7 +1243,7 @@ class Sweep {
if (v.pqHandle == Long.MAX_VALUE) break;
}
if (v != vHead || !pq.pqInit()) { /* __gl_pqSortInit */
- tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
+ tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
tess.pq = null;
return false;
}
@@ -1306,7 +1306,7 @@ class Sweep {
* all the vertices in a priority queue. Events are processed in
* lexicographic order, ie.
*
- * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y)
+ * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y)
*/
RemoveDegenerateEdges(tess);
if (!InitPriorityQ(tess)) return false; /* if error */
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 085889739..db737902a 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -49,7 +49,7 @@ import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
public abstract class MacOSXCGLContext extends GLContextImpl
-{
+{
protected boolean isNSContext;
private CGLExt cglExt;
// Table that holds the addresses of the native C-language entry points for
@@ -82,9 +82,9 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return cglExtProcAddressTable;
}
- protected Map/*<String, String>*/ getFunctionNameMap() { return null; }
+ protected Map<String, String> getFunctionNameMap() { return null; }
- protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
+ protected Map<String, String> getExtensionNameMap() { return null; }
protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
return 0; // FIXME
@@ -178,7 +178,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
protected void releaseImpl() throws GLException {
if ( isNSContext ) {
if (!CGL.clearCurrentContext(contextHandle)) {
@@ -188,7 +188,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
CGL.CGLReleaseContext(contextHandle);
}
}
-
+
protected void destroyImpl() throws GLException {
if ( !isNSContext ) {
if (CGL.kCGLNoError != CGL.CGLDestroyContext(contextHandle)) {
@@ -230,12 +230,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing CGL extension address table: "+key);
}
- CGLExtProcAddressTable table = null;
+ ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
- table = (CGLExtProcAddressTable) mappedGLXProcAddress.get( key );
+ table = mappedGLXProcAddress.get( key );
}
if(null != table) {
- cglExtProcAddressTable = table;
+ cglExtProcAddressTable = (CGLExtProcAddressTable) table;
if(DEBUG) {
System.err.println(getThreadName() + ": !!! GLContext CGL ProcAddressTable reusing key("+key+") -> "+table.hashCode());
}
@@ -254,12 +254,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
public String getPlatformExtensionsString()
{
return "";
}
-
+
protected void swapBuffers() {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable)config.getChosenCapabilities();
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
index 6dba11038..949963fa0 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLContext.java
@@ -48,7 +48,7 @@ public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext
GLContext shareWith) {
super(drawable, shareWith);
}
-
+
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
index 6eda3f068..dc5ce26c8 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -138,7 +138,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
- !isTigerOrLater) {
+ !isTigerOrLater) {
throw new GLException("Floating-point pbuffers supported only on OS X 10.4 or later");
}
// Change our OpenGL mode to match that of any share context before we create ourselves
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
index 4e5afc683..854d01fa6 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
@@ -214,15 +214,15 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glVertexPointer(GLArrayDataWrapper.createFixed(gl, GL_VERTEX_ARRAY, size, type, false, stride, pointer, 0, 0));
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, false, stride, pointer, -1, -1, -1));
}
public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glVertexPointer(GLArrayDataWrapper.createFixed(gl, GL_VERTEX_ARRAY, size, type, false,
- stride, null, vboName, pointer_buffer_offset));
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, false, stride,
+ null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW));
}
public void glColorPointer(GLArrayData array) {
@@ -241,16 +241,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glColorPointer(gl, array);
}
public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glColorPointer(GLArrayDataWrapper.createFixed(gl, GL_COLOR_ARRAY, size, type, false,
- stride, pointer, 0, 0));
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, false, stride,
+ pointer, -1, -1, -1));
}
public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glColorPointer(GLArrayDataWrapper.createFixed(gl, GL_COLOR_ARRAY, size, type, false,
- stride, null, vboName, pointer_buffer_offset));
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, false, stride,
+ null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW));
}
public void glNormalPointer(GLArrayData array) {
@@ -272,16 +272,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glNormalPointer(gl, array);
}
public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) {
- glNormalPointer(GLArrayDataWrapper.createFixed(gl, GL_NORMAL_ARRAY, 3, type, false,
- stride, pointer, 0, 0));
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, false, stride,
+ pointer, -1, -1, -1));
}
public void glNormalPointer(int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glNormalPointer(GLArrayDataWrapper.createFixed(gl, GL_NORMAL_ARRAY, 3, type, false,
- stride, null, vboName, pointer_buffer_offset));
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, false, stride,
+ null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW));
}
public void glTexCoordPointer(GLArrayData array) {
@@ -301,7 +301,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) {
glTexCoordPointer(
- GLArrayDataWrapper.createFixed(gl, GL_TEXTURE_COORD_ARRAY, size, type, false, stride, pointer, 0,0));
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, false, stride, pointer, -1, -1, -1));
}
public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
@@ -309,8 +309,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
glTexCoordPointer(
- GLArrayDataWrapper.createFixed(gl, GL_TEXTURE_COORD_ARRAY, size, type, false,
- stride, null, vboName, pointer_buffer_offset) );
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, false, stride,
+ null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW) );
}
public final String toString() {
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
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index 94017e79a..55e2e478c 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -58,8 +58,8 @@ import jogamp.opengl.GLContextShareSet;
import jogamp.opengl.GLDrawableImpl;
public class WindowsWGLContext extends GLContextImpl {
- static final Map/*<String, String>*/ functionNameMap;
- static final Map/*<String, String>*/ extensionNameMap;
+ static final Map<String, String> functionNameMap;
+ static final Map<String, String> extensionNameMap;
private boolean wglGetExtensionsStringEXTInitialized;
private boolean wglGetExtensionsStringEXTAvailable;
private boolean wglGLReadDrawableAvailableSet;
@@ -70,11 +70,11 @@ public class WindowsWGLContext extends GLContextImpl {
private WGLExtProcAddressTable wglExtProcAddressTable;
static {
- functionNameMap = new HashMap();
+ functionNameMap = new HashMap<String, String>();
functionNameMap.put("glAllocateMemoryNV", "wglAllocateMemoryNV");
functionNameMap.put("glFreeMemoryNV", "wglFreeMemoryNV");
- extensionNameMap = new HashMap();
+ extensionNameMap = new HashMap<String, String>();
extensionNameMap.put("GL_ARB_pbuffer", "WGL_ARB_pbuffer");
extensionNameMap.put("GL_ARB_pixel_format", "WGL_ARB_pixel_format");
}
@@ -161,9 +161,9 @@ public class WindowsWGLContext extends GLContextImpl {
return wglExtProcAddressTable;
}
- protected Map/*<String, String>*/ getFunctionNameMap() { return functionNameMap; }
+ protected Map<String, String> getFunctionNameMap() { return functionNameMap; }
- protected Map/*<String, String>*/ getExtensionNameMap() { return extensionNameMap; }
+ protected Map<String, String> getExtensionNameMap() { return extensionNameMap; }
protected void destroyContextARBImpl(long context) {
WGL.wglMakeCurrent(0, 0);
@@ -273,14 +273,11 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
- int minor[] = new int[1];
- int major[] = new int[1];
- int ctp[] = new int[1];
boolean createContextARBTried = false;
// utilize the shared context's GLXExt in case it was using the ARB method and it already exists
if( null!=sharedContext && sharedContext.isCreatedWithARBMethod() ) {
- contextHandle = createContextARB(share, true, major, minor, ctp);
+ contextHandle = createContextARB(share, true);
createContextARBTried = true;
if (DEBUG && 0!=contextHandle) {
System.err.println(getThreadName() + ": createImpl: OK (ARB, using sharedContext) share "+share);
@@ -306,7 +303,7 @@ public class WindowsWGLContext extends GLContextImpl {
if(isCreateContextAttribsARBAvailable &&
isExtensionAvailable("WGL_ARB_create_context") ) {
// initial ARB context creation
- contextHandle = createContextARB(share, true, major, minor, ctp);
+ contextHandle = createContextARB(share, true);
createContextARBTried=true;
if (DEBUG) {
if(0!=contextHandle) {
@@ -334,10 +331,10 @@ public class WindowsWGLContext extends GLContextImpl {
if(glCaps.getGLProfile().isGL3()) {
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(temp_ctx);
- throw new GLException("WindowsWGLContext.createContext failed, but context > GL2 requested "+getGLVersion(major[0], minor[0], ctp[0], "@creation")+", ");
+ throw new GLException("WindowsWGLContext.createContext failed, but context > GL2 requested "+getGLVersion()+", ");
}
if(DEBUG) {
- System.err.println("WindowsWGLContext.createContext failed, fall back to !ARB context "+getGLVersion(major[0], minor[0], ctp[0], "@creation"));
+ System.err.println("WindowsWGLContext.createContext failed, fall back to !ARB context "+getGLVersion());
}
// continue with temp context for GL < 3.0
@@ -405,12 +402,12 @@ public class WindowsWGLContext extends GLContextImpl {
wglGLReadDrawableAvailableSet=false;
wglGLReadDrawableAvailable=false;
- WGLExtProcAddressTable table = null;
+ ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
- table = (WGLExtProcAddressTable) mappedGLXProcAddress.get( key );
+ table = mappedGLXProcAddress.get( key );
}
if(null != table) {
- wglExtProcAddressTable = table;
+ wglExtProcAddressTable = (WGLExtProcAddressTable) table;
if(DEBUG) {
System.err.println(getThreadName() + ": !!! GLContext WGL ProcAddressTable reusing key("+key+") -> "+table.hashCode());
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 248dfa482..c9cdcad90 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -169,7 +169,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
/**
* http://msdn.microsoft.com/en-us/library/ms724832%28v=vs.85%29.aspx
- * Windows XP 5.1
+ * Windows XP 5.1
*/
static final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
@@ -199,22 +199,22 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
hasARBReadDrawable = arbReadDrawable;
vendor = glVendor;
if(null != vendor) {
- isVendorNVIDIA = vendor.startsWith("NVIDIA") ;
- isVendorATI = vendor.startsWith("ATI") ;
+ isVendorNVIDIA = vendor.startsWith("NVIDIA") ;
+ isVendorATI = vendor.startsWith("ATI") ;
}
- if ( isVendorATI() ) {
- final VersionNumber winVersion = new VersionNumber(Platform.getOSVersion(), ".");
- final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0;
- if(DEBUG) {
- System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion());
- }
- needsCurrenContext4ARBPFDQueries = isWinXPOrLess;
- } else {
- if(DEBUG) {
- System.err.println("needsCurrenContext4ARBPFDQueries: false");
- }
- needsCurrenContext4ARBPFDQueries = false;
+ if ( isVendorATI() ) {
+ final VersionNumber winVersion = new VersionNumber(Platform.getOSVersion(), ".");
+ final boolean isWinXPOrLess = winVersion.compareTo(winXPVersionNumber) <= 0;
+ if(DEBUG) {
+ System.err.println("needsCurrenContext4ARBPFDQueries: "+winVersion+" <= "+winXPVersionNumber+" = "+isWinXPOrLess+" - "+Platform.getOSVersion());
+ }
+ needsCurrenContext4ARBPFDQueries = isWinXPOrLess;
+ } else {
+ if(DEBUG) {
+ System.err.println("needsCurrenContext4ARBPFDQueries: false");
+ }
+ needsCurrenContext4ARBPFDQueries = false;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 1899f5212..8859d636a 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -158,7 +158,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
if (0 == hdc) {
throw new GLException("Error: HDC is null");
}
-
+
if (!GDI.SetPixelFormat(hdc, caps.getPFDID(), caps.getPFD())) {
throw new GLException("Unable to set pixel format " + caps +
" for device context " + toHexString(hdc) +
@@ -166,7 +166,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
if (DEBUG) {
System.err.println("!!! setPixelFormat (ARB): hdc "+toHexString(hdc) +", "+caps);
- }
+ }
setCapsPFD(caps);
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 8c1f5e87c..d765572a6 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -192,25 +192,25 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration().getNativeGraphicsConfiguration();
if( !config.isExternal() ) {
- if( !config.isDetermined() ) {
- updateGraphicsConfiguration(config, chooser, factory, hdc, false, pfdIDs);
- } else {
- // set PFD if not set yet
- int pfdID = -1;
- boolean set = false;
- if ( 1 > ( pfdID = GDI.GetPixelFormat(hdc) ) ) {
- if (!GDI.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) {
- throw new GLException("Unable to set pixel format " + config.getPixelFormatID() +
- " for device context " + toHexString(hdc) +
- ": error code " + GDI.GetLastError());
- }
- set = true;
- }
- if (DEBUG) {
- System.err.println("!!! setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set);
- Thread.dumpStack();
- }
- }
+ if( !config.isDetermined() ) {
+ updateGraphicsConfiguration(config, chooser, factory, hdc, false, pfdIDs);
+ } else {
+ // set PFD if not set yet
+ int pfdID = -1;
+ boolean set = false;
+ if ( 1 > ( pfdID = GDI.GetPixelFormat(hdc) ) ) {
+ if (!GDI.SetPixelFormat(hdc, config.getPixelFormatID(), config.getPixelFormat())) {
+ throw new GLException("Unable to set pixel format " + config.getPixelFormatID() +
+ " for device context " + toHexString(hdc) +
+ ": error code " + GDI.GetLastError());
+ }
+ set = true;
+ }
+ if (DEBUG) {
+ System.err.println("!!! setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set);
+ Thread.dumpStack();
+ }
+ }
}
} finally {
ns.unlockSurface();
@@ -400,9 +400,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
if ( !extHDC && !pixelFormatSet ) {
- config.setPixelFormat(hdc, pixelFormatCaps);
+ config.setPixelFormat(hdc, pixelFormatCaps);
} else {
- config.setCapsPFD(pixelFormatCaps);
+ config.setCapsPFD(pixelFormatCaps);
}
return true;
}
@@ -476,9 +476,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
if ( !extHDC && !pixelFormatSet ) {
- config.setPixelFormat(hdc, pixelFormatCaps);
+ config.setPixelFormat(hdc, pixelFormatCaps);
} else {
- config.setCapsPFD(pixelFormatCaps);
+ config.setCapsPFD(pixelFormatCaps);
}
return true;
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 7d7614ca2..9f6a5cd1a 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -56,8 +56,8 @@ import jogamp.nativewindow.x11.X11Util;
public abstract class X11GLXContext extends GLContextImpl {
protected static final boolean TRACE_CONTEXT_CURRENT = false; // true;
- private static final Map/*<String, String>*/ functionNameMap;
- private static final Map/*<String, String>*/ extensionNameMap;
+ private static final Map<String, String> functionNameMap;
+ private static final Map<String, String> extensionNameMap;
private VersionNumber glXVersion;
private boolean glXVersionOneThreeCapable;
private boolean glXQueryExtensionsStringInitialized;
@@ -74,11 +74,11 @@ public abstract class X11GLXContext extends GLContextImpl {
protected boolean isDirect;
static {
- functionNameMap = new HashMap();
+ functionNameMap = new HashMap<String, String>();
functionNameMap.put("glAllocateMemoryNV", "glXAllocateMemoryNV");
functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV");
- extensionNameMap = new HashMap();
+ extensionNameMap = new HashMap<String, String>();
extensionNameMap.put("GL_ARB_pbuffer", "GLX_SGIX_pbuffer");
extensionNameMap.put("GL_ARB_pixel_format", "GLX_SGIX_pbuffer"); // good enough
}
@@ -118,9 +118,9 @@ public abstract class X11GLXContext extends GLContextImpl {
return glXExt;
}
- protected Map/*<String, String>*/ getFunctionNameMap() { return functionNameMap; }
+ protected Map<String, String> getFunctionNameMap() { return functionNameMap; }
- protected Map/*<String, String>*/ getExtensionNameMap() { return extensionNameMap; }
+ protected Map<String, String> getExtensionNameMap() { return extensionNameMap; }
public final boolean isGLXVersionGreaterEqualOneThree() {
if(null == glXVersion) {
@@ -297,7 +297,6 @@ public abstract class X11GLXContext extends GLContextImpl {
GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
GLProfile glp = glCaps.getGLProfile();
- isVendorATI = factory.isGLXVendorATI(device);
if(config.getFBConfigID()<0) {
// not able to use FBConfig
@@ -319,14 +318,11 @@ public abstract class X11GLXContext extends GLContextImpl {
return true;
}
- int minor[] = new int[1];
- int major[] = new int[1];
- int ctp[] = new int[1];
boolean createContextARBTried = false;
// utilize the shared context's GLXExt in case it was using the ARB method and it already exists
if(null!=sharedContext && sharedContext.isCreatedWithARBMethod()) {
- contextHandle = createContextARB(share, direct, major, minor, ctp);
+ contextHandle = createContextARB(share, direct);
createContextARBTried = true;
if (DEBUG && 0!=contextHandle) {
System.err.println(getThreadName() + ": createContextImpl: OK (ARB, using sharedContext) share "+share);
@@ -352,7 +348,7 @@ public abstract class X11GLXContext extends GLContextImpl {
if ( isCreateContextAttribsARBAvailable &&
isExtensionAvailable("GLX_ARB_create_context") ) {
// initial ARB context creation
- contextHandle = createContextARB(share, direct, major, minor, ctp);
+ contextHandle = createContextARB(share, direct);
createContextARBTried=true;
if (DEBUG) {
if(0!=contextHandle) {
@@ -379,10 +375,10 @@ public abstract class X11GLXContext extends GLContextImpl {
if(glp.isGL3()) {
glXMakeContextCurrent(display, 0, 0, 0);
GLX.glXDestroyContext(display, temp_ctx);
- throw new GLException("X11GLXContext.createContextImpl failed, but context > GL2 requested "+getGLVersion(major[0], minor[0], ctp[0], "@creation")+", ");
+ throw new GLException("X11GLXContext.createContextImpl failed, but context > GL2 requested "+getGLVersion()+", ");
}
if(DEBUG) {
- System.err.println("X11GLXContext.createContextImpl failed, fall back to !ARB context "+getGLVersion(major[0], minor[0], ctp[0], "@creation"));
+ System.err.println("X11GLXContext.createContextImpl failed, fall back to !ARB context "+getGLVersion());
}
// continue with temp context for GL <= 3.0
@@ -472,12 +468,12 @@ public abstract class X11GLXContext extends GLContextImpl {
glXQueryExtensionsStringInitialized = false;
glXQueryExtensionsStringAvailable = false;
- GLXExtProcAddressTable table = null;
+ ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
- table = (GLXExtProcAddressTable) mappedGLXProcAddress.get( key );
+ table = mappedGLXProcAddress.get( key );
}
if(null != table) {
- glXExtProcAddressTable = table;
+ glXExtProcAddressTable = (GLXExtProcAddressTable) table;
if(DEBUG) {
System.err.println(getThreadName() + ": !!! GLContext GLX ProcAddressTable reusing key("+key+") -> "+table.hashCode());
}
@@ -581,7 +577,4 @@ public abstract class X11GLXContext extends GLContextImpl {
//----------------------------------------------------------------------
// Internals only below this point
//
-
- private boolean isVendorATI = false;
-
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 8203a440c..8d9de8144 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -212,7 +212,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext, glXVersion, glXVendorName);
} catch (Throwable t) {
- throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources for "+connection, t);
+ throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+connection, t);
} finally {
sharedDevice.unlock();
}