aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/graph
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/graph')
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java15
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java6
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java58
-rw-r--r--src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java22
4 files changed, 49 insertions, 52 deletions
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index fa81e2a3f..fbd40ebdd 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -427,7 +427,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
gl.glActiveTexture(GL.GL_TEXTURE0 + gcu_FboTexUnit.intValue());
- fbo.use(gl, fbo.getSamplingSink());
+ fbo.use(gl, fbo.getSamplingSink().getTextureAttachment());
gca_FboVerticesAttr.enableBuffer(gl, true);
gca_FboTexCoordsAttr.enableBuffer(gl, true);
indicesFbo.bindBuffer(gl, true); // keeps VBO binding
@@ -454,19 +454,22 @@ public class VBORegion2PMSAAES2 extends GLRegion {
fboWidth = targetFboWidth;
fboHeight = targetFboHeight;
fbo = new FBObject();
- fbo.reset(gl, fboWidth, fboHeight, sampleCount[0], false);
+ fbo.init(gl, fboWidth, fboHeight, sampleCount[0]);
sampleCount[0] = fbo.getNumSamples();
fbo.attachColorbuffer(gl, 0, true);
- fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ if( !blendingEnabled ) {
+ // no depth-buffer w/ blending
+ fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, FBObject.DEFAULT_BITS);
+ }
final FBObject ssink = new FBObject();
{
- ssink.reset(gl, fboWidth, fboHeight);
+ ssink.init(gl, fboWidth, fboHeight, 0);
// FIXME: shall not use bilinear (GL_LINEAR), due to MSAA ???
// ssink.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
ssink.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
if( !blendingEnabled ) {
// no depth-buffer w/ blending
- ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, FBObject.DEFAULT_BITS);
}
}
fbo.setSamplingSink(ssink);
@@ -475,7 +478,7 @@ public class VBORegion2PMSAAES2 extends GLRegion {
System.err.printf("XXX.createFBO: blending %b, %dx%d%n%s%n", blendingEnabled, fboWidth, fboHeight, fbo.toString());
}
} else if( targetFboWidth != fboWidth || targetFboHeight != fboHeight || fbo.getNumSamples() != sampleCount[0] ) {
- fbo.reset(gl, targetFboWidth, targetFboHeight, sampleCount[0], true /* resetSamplingSink */);
+ fbo.reset(gl, targetFboWidth, targetFboHeight, sampleCount[0]);
sampleCount[0] = fbo.getNumSamples();
if( DEBUG_FBO_1 ) {
System.err.printf("XXX.resetFBO: %dx%d -> %dx%d%n%s%n", fboWidth, fboHeight, targetFboWidth, targetFboHeight, fbo );
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 24fa09058..8f1de9157 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -573,20 +573,20 @@ public class VBORegion2PVBAAES2 extends GLRegion {
fboTexSize.put(1, fboHeight);
}
fbo = new FBObject();
- fbo.reset(gl, fboWidth, fboHeight);
+ fbo.init(gl, fboWidth, fboHeight, 0);
// Shall not use bilinear (GL_LINEAR), due to own VBAA. Result is smooth w/o it now!
// FIXME: FXAA requires bilinear filtering!
// texA = fbo.attachTexture2D(gl, 0, true, GL.GL_LINEAR, GL.GL_LINEAR, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
texA = fbo.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
if( !blendingEnabled ) {
// no depth-buffer w/ blending
- fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
+ fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, FBObject.DEFAULT_BITS);
}
if( DEBUG_FBO_1 ) {
System.err.printf("XXX.createFBO: %dx%d%n%s%n", fboWidth, fboHeight, fbo.toString());
}
} else if( newFboWidth != fboWidth || newFboHeight != fboHeight ) {
- fbo.reset(gl, newFboWidth, newFboHeight);
+ fbo.reset(gl, newFboWidth, newFboHeight, 0);
fbo.bind(gl);
if( DEBUG_FBO_1 ) {
System.err.printf("XXX.resetFBO: %dx%d -> %dx%d, target %dx%d%n", fboWidth, fboHeight, newFboWidth, newFboHeight, targetFboWidth, targetFboHeight);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
index 5bd49dce9..97570d605 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
@@ -32,8 +32,8 @@ import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.font.Font;
import com.jogamp.opengl.math.geom.AABBox;
-public class TypecastGlyph implements Font.Glyph {
- public static class Advance
+public final class TypecastGlyph implements Font.Glyph {
+ public static final class Advance
{
private final Font font;
private final float advance;
@@ -46,40 +46,42 @@ public class TypecastGlyph implements Font.Glyph {
size2advanceI.setKeyNotFoundValue(0);
}
- public void reset() {
+ public final void reset() {
size2advanceI.clear();
}
- public float getScale(final float pixelSize)
+ public final Font getFont() { return font; }
+
+ public final float getScale(final float pixelSize)
{
return this.font.getMetrics().getScale(pixelSize);
}
- public void add(final float advance, final float size)
+ public final void add(final float advance, final float size)
{
size2advanceI.put(Float.floatToIntBits(size), Float.floatToIntBits(advance));
}
- public float get(final float size, final boolean useFrationalMetrics)
+ public final float get(final float pixelSize, final boolean useFrationalMetrics)
{
- final int sI = Float.floatToIntBits(size);
+ final int sI = Float.floatToIntBits(pixelSize);
final int aI = size2advanceI.get(sI);
if( 0 != aI ) {
return Float.intBitsToFloat(aI);
}
final float a;
if ( useFrationalMetrics ) {
- a = this.advance * getScale(size);
+ a = this.advance * getScale(pixelSize);
} else {
- // a = Math.ceil(this.advance * getScale(size));
- a = Math.round(this.advance * getScale(size)); // TODO: check whether ceil should be used instead?
+ // a = Math.ceil(this.advance * getScale(pixelSize));
+ a = Math.round(this.advance * getScale(pixelSize)); // TODO: check whether ceil should be used instead?
}
size2advanceI.put(sI, Float.floatToIntBits(a));
return a;
}
@Override
- public String toString()
+ public final String toString()
{
return "\nAdvance:"+
"\n advance: "+this.advance+
@@ -87,7 +89,7 @@ public class TypecastGlyph implements Font.Glyph {
}
}
- public static class Metrics
+ public static final class Metrics
{
private final AABBox bbox;
private final Advance advance;
@@ -98,32 +100,34 @@ public class TypecastGlyph implements Font.Glyph {
this.advance = new Advance(font, advance);
}
- public void reset() {
+ public final void reset() {
advance.reset();
}
- public float getScale(final float pixelSize)
+ public final Font getFont() { return advance.getFont(); }
+
+ public final float getScale(final float pixelSize)
{
return this.advance.getScale(pixelSize);
}
- public AABBox getBBox()
+ public final AABBox getBBox()
{
return this.bbox;
}
- public void addAdvance(final float advance, final float size)
+ public final void addAdvance(final float advance, final float size)
{
this.advance.add(advance, size);
}
- public float getAdvance(final float size, final boolean useFrationalMetrics)
+ public final float getAdvance(final float pixelSize, final boolean useFrationalMetrics)
{
- return this.advance.get(size, useFrationalMetrics);
+ return this.advance.get(pixelSize, useFrationalMetrics);
}
@Override
- public String toString()
+ public final String toString()
{
return "\nMetrics:"+
"\n bbox: "+this.bbox+
@@ -134,31 +138,21 @@ public class TypecastGlyph implements Font.Glyph {
public static final short INVALID_ID = (short)((1 << 16) - 1);
public static final short MAX_ID = (short)((1 << 16) - 2);
- private final Font font;
private final char symbol;
private final OutlineShape shape; // in EM units
private final short id;
- private final int advance;
private final Metrics metrics;
protected TypecastGlyph(final Font font, final char symbol, final short id, final AABBox bbox, final int advance, final OutlineShape shape) {
- this.font = font;
this.symbol = symbol;
this.shape = shape;
this.id = id;
- this.advance = advance;
- this.metrics = new Metrics(this.font, bbox, this.advance);
+ this.metrics = new Metrics(font, bbox, advance);
}
- /**
- public void reset(Path2D path) {
- this.path = path;
- this.metrics.reset();
- } */
-
@Override
public final Font getFont() {
- return this.font;
+ return this.metrics.getFont();
}
@Override
@@ -211,7 +205,7 @@ public class TypecastGlyph implements Font.Glyph {
@Override
public final int hashCode() {
// 31 * x == (x << 5) - x
- final int hash = 31 + font.getName(Font.NAME_UNIQUNAME).hashCode();
+ final int hash = 31 + getFont().getName(Font.NAME_UNIQUNAME).hashCode();
return ((hash << 5) - hash) + id;
}
}
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 7bfffd58c..8ed450326 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
@@ -65,10 +65,10 @@ import com.jogamp.opengl.math.geom.AABBox;
* @version $Id: Glyph.java,v 1.3 2007-02-21 12:23:54 davidsch Exp $
* @author <a href="mailto:[email protected]">David Schweinsberg</a>, Sven Gothel
*/
-public class OTGlyph {
+public final class OTGlyph {
- protected short _leftSideBearing;
- protected int _advanceWidth;
+ private final short _leftSideBearing;
+ private final int _advanceWidth;
private Point[] _points;
AABBox _bbox;
@@ -102,33 +102,32 @@ public class OTGlyph {
}
}
- public void clearPointData() {
+ public final void clearPointData() {
_points = null;
}
- public AABBox getBBox() {
+ public final AABBox getBBox() {
return _bbox;
}
- public int getAdvanceWidth() {
+ public final int getAdvanceWidth() {
return _advanceWidth;
}
- public short getLeftSideBearing() {
+ public final short getLeftSideBearing() {
return _leftSideBearing;
}
- public Point getPoint(final int i) {
+ public final Point getPoint(final int i) {
return _points[i];
}
- public int getPointCount() {
+ public final int getPointCount() {
return null != _points ? _points.length : 0;
}
/**
* @param factor a 16.16 fixed value
- */
public void scale(final int factor) {
for (int i = 0; i < _points.length; i++) {
//points[i].x = ( points[i].x * factor ) >> 6;
@@ -139,11 +138,12 @@ public class OTGlyph {
_leftSideBearing = (short)(( _leftSideBearing * factor) >> 6);
_advanceWidth = (_advanceWidth * factor) >> 6;
}
+ */
/**
* Set the points of a glyph from the GlyphDescription
*/
- private void describe(final GlyphDescription gd) {
+ private final void describe(final GlyphDescription gd) {
int endPtIndex = 0;
_points = new Point[gd.getPointCount() /* + 2 */ ];
for (int i = 0; i < gd.getPointCount(); i++) {