diff options
Diffstat (limited to 'src/jogl/classes')
8 files changed, 43 insertions, 29 deletions
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java index 749c7ef65..63713887b 100755 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -114,14 +114,16 @@ public abstract class GLRegion extends Region { * current width/hight of window for multi pass rendering
* of the region.
* @param matrix current {@link PMVMatrix}.
+ * @param rs the RenderState to be used
* @param vp_width current screen width
* @param vp_height current screen height
- * @param width texture width for mp rendering
+ * @param texWidth desired texture width for multipass-rendering.
+ * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
*/
- public final void draw(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int width) {
+ public final void draw(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
update(gl, rs);
- drawImpl(gl, rs, vp_width, vp_height, width);
+ drawImpl(gl, rs, vp_width, vp_height, texWidth);
}
- protected abstract void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int width);
+ protected abstract void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth);
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java index 86d962fd8..2f078d7bb 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -54,10 +54,11 @@ public abstract class RegionRenderer extends Renderer { * the triangles of the shapes will be generated, if not yet generated * @param region the OutlineShape to Render. * @param position the initial translation of the outlineShape. - * @param texSize texture size for multipass render + * @param texWidth desired texture width for multipass-rendering. + * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched. * @throws Exception if HwRegionRenderer not initialized */ - public final void draw(GL2ES2 gl, Region region, float[] position, int texSize) { + public final void draw(GL2ES2 gl, Region region, float[] position, int[/*1*/] texWidth) { if(!isInitialized()) { throw new GLException("RegionRenderer: not initialized!"); } @@ -65,14 +66,14 @@ public abstract class RegionRenderer extends Renderer { throw new GLException("Incompatible render modes, : region modes "+region.getRenderModes()+ " doesn't contain renderer modes "+this.getRenderModes()); } - drawImpl(gl, region, position, texSize); + drawImpl(gl, region, position, texWidth); } /** * Usually just dispatched the draw call to the Region's draw implementation, - * e.g. {@link com.jogamp.graph.curve.opengl.GLRegion#draw(GL2ES2, RenderState, int, int, int) GLRegion#draw(GL2ES2, RenderState, int, int, int)}. + * e.g. {@link com.jogamp.graph.curve.opengl.GLRegion#draw(GL2ES2, RenderState, int, int, int[]) GLRegion#draw(GL2ES2, RenderState, int, int, int[])}. */ - protected abstract void drawImpl(GL2ES2 gl, Region region, float[] position, int texSize); + protected abstract void drawImpl(GL2ES2 gl, Region region, float[] position, int[] texWidth); @Override protected void destroyImpl(GL2ES2 gl) { diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java index b466670cc..8dc41b0c0 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java @@ -59,11 +59,12 @@ public abstract class TextRenderer extends Renderer { * @param str text to be rendered * @param position the lower left corner of the string * @param fontSize font size - * @param texSize texture size for multipass render + * @param texWidth desired texture width for multipass-rendering. + * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched. * @throws Exception if TextRenderer not initialized */ public abstract void drawString3D(GL2ES2 gl, Font font, - String str, float[] position, int fontSize, int texSize); + String str, float[] position, int fontSize, int[/*1*/] texSize); /**Create the resulting {@link GlyphString} that represents * the String wrt to the font. diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java index 06499208f..32a2f0b73 100755 --- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java @@ -87,7 +87,7 @@ public class RegionRendererImpl01 extends RegionRenderer { }
@Override
- protected void drawImpl(GL2ES2 gl, Region region, float[] position, int texSize) {
+ protected void drawImpl(GL2ES2 gl, Region region, float[] position, int[] texSize) {
((GLRegion)region).draw(gl, rs, vp_width, vp_height, texSize);
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java index fa57b3468..05d0707e2 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java @@ -80,7 +80,7 @@ public class TextRendererImpl01 extends TextRenderer { } @Override - public void drawString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int texSize) { + public void drawString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int[/*1*/] texSize) { if(!isInitialized()){ throw new GLException("TextRendererImpl01: not initialized!"); } @@ -92,5 +92,4 @@ public class TextRendererImpl01 extends TextRenderer { glyphString.renderString3D(gl, rs, 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 4c664e883..703fd6151 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java @@ -192,18 +192,18 @@ public class VBORegion2PES2 extends GLRegion { int[] maxTexSize = new int[] { -1 } ; - protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int width) { - if(vp_width <=0 || vp_height <= 0 || width <= 0){ + protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { + if(vp_width <=0 || vp_height <= 0 || null==texWidth || texWidth[0] <= 0){ renderRegion(gl); } else { if(0 > maxTexSize[0]) { gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, maxTexSize, 0); } - if(width > maxTexSize[0]) { - width = maxTexSize[0]; - } - if(width != tex_width_c) { - renderRegion2FBO(gl, rs, width); + if(texWidth[0] != tex_width_c) { + if(texWidth[0] > maxTexSize[0]) { + texWidth[0] = maxTexSize[0]; // clip to max - write-back user value! + } + renderRegion2FBO(gl, rs, texWidth); } // System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3)); renderFBO(gl, rs, vp_width, vp_height); @@ -230,15 +230,19 @@ public class VBORegion2PES2 extends GLRegion { // setback: gl.glActiveTexture(currentActiveTextureEngine[0]); } - private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int tex_width) { + private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int[/*1*/] texWidth) { final ShaderState st = rs.getShaderState(); - tex_width_c = tex_width; + if(0>=texWidth[0]) { + throw new IllegalArgumentException("texWidth must be greater than 0: "+texWidth[0]); + } + + tex_width_c = texWidth[0]; tex_height_c = (int) ( ( ( tex_width_c * box.getHeight() ) / box.getWidth() ) + 0.5f ); - // System.out.println("FBO Size: "+tex_width+" -> "+tex_height_c+"x"+tex_width_c); + // System.out.println("FBO Size: "+texWidth[0]+" -> "+tex_width_c+"x"+tex_height_c); // System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5)); - + if(null != fbo && fbo.getWidth() != tex_width_c && fbo.getHeight() != tex_height_c ) { fbo.destroy(gl); fbo = null; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 21671386c..6ff6a078f 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -125,7 +125,7 @@ public class VBORegionSPES2 extends GLRegion { setDirty(false); } - protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int width) { + protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { verticeAttr.enableBuffer(gl, true); texCoordAttr.enableBuffer(gl, true); indices.enableBuffer(gl, true); diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java index bc9a93042..f86d02f40 100644 --- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java +++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java @@ -45,6 +45,7 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RenderState; +import com.jogamp.opengl.util.PMVMatrix; public class GlyphString { /** Static font size for all default font OutlineShape generations via {@link #createString(OutlineShape, Factory, Font, String)}. @@ -171,13 +172,19 @@ public class GlyphString { * previously generated. */ public void renderString3D(GL2ES2 gl) { - region.draw(gl, null, 0, 0, 0); + region.draw(gl, null, 0, 0, null); } /** Render the Object based using the associated Region * previously generated. + * @param matrix current {@link PMVMatrix}. + * @param rs the RenderState to be used + * @param vp_width current screen width + * @param vp_height current screen height + * @param texWidth desired texture width for multipass-rendering. + * The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched. */ - public void renderString3D(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int size) { - region.draw(gl, rs, vp_width, vp_height, size); + public void renderString3D(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) { + region.draw(gl, rs, vp_width, vp_height, texWidth); } /** Get the Origin of this GlyphString |