diff options
author | Sven Gothel <[email protected]> | 2023-03-21 09:33:06 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-21 09:33:06 +0100 |
commit | 59a7fdeb4ed36f0014ba1fdcc0ec144c04aaa2d5 (patch) | |
tree | ecd36c5dc7e3af7aa6c42795566640c9d49d11ab | |
parent | 8abe939c5132e4a58c4b9a6b31f0b1fd10734516 (diff) |
Graph: Cleanup Vertex.Factory referencing: Only bind to OutlineShape and use its default. GraphUI: Always use default.
Graph RegionRenderer, its RenderState as well as GraphUI's Scene don't need to have knowledge of Vertex.Factory,
which is only used within OutlineShape and its 'inner geom workings'.
34 files changed, 142 insertions, 225 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java index 94dd0ff4d..089731e40 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener00.java @@ -51,13 +51,13 @@ public class GPURegionGLListener00 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; public GPURegionGLListener00 (final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { - super(RegionRenderer.create(null, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); + super(RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); } private void createTestOutline(final GLProfile glp){ - outlineShape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); + outlineShape = new OutlineShape(); outlineShape.addVertex(0.0f,-10.0f, true); outlineShape.addVertex(15.0f,-10.0f, true); outlineShape.addVertex(10.0f,5.0f, false); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java index 23e1e1b64..bc7aebdec 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener01.java @@ -254,7 +254,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { gl.glEnable(GL.GL_BLEND); rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); - outlineShape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); + outlineShape = new OutlineShape(); switch( shape_ctor_mode ) { case 0: createTestOutline00(); diff --git a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java index 966f18972..6024b1410 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/GPURegionGLListener10.java @@ -57,7 +57,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { } private void createTestOutline(final GLProfile glp){ - OutlineShape shape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); + OutlineShape shape = new OutlineShape(); outlineShapes.add(shape); shape.addVertex(0.0f,-10.0f,true); shape.addVertex(15.0f,-10.0f, true); @@ -75,7 +75,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { shape.closeLastOutline(true); /** Same shape as above but without any off-curve vertices */ - shape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); + shape = new OutlineShape(); outlineShapes.add(shape); final float offset = 30; shape.addVertex(offset+0.0f,-10.0f, true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java index 43840af97..c0093c6c8 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java +++ b/src/demos/com/jogamp/opengl/demos/graph/TextRendererGLELBase.java @@ -131,7 +131,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { @Override public void init(final GLAutoDrawable drawable) { exclusivePMVMatrix = null == sharedPMVMatrix; - this.renderer = RegionRenderer.create(null, sharedPMVMatrix, enableCallback, disableCallback); + this.renderer = RegionRenderer.create(sharedPMVMatrix, enableCallback, disableCallback); this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); this.textRenderUtil = new TextRegionUtil(renderModes); final GL2ES2 gl = drawable.getGL().getGL2ES2(); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneGLListener0A.java b/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneGLListener0A.java index 32a6fb2b3..2fcdeb592 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneGLListener0A.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneGLListener0A.java @@ -56,7 +56,6 @@ import com.jogamp.graph.curve.opengl.RenderState; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontScale; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.ui.gl.Scene; import com.jogamp.graph.ui.gl.Shape; import com.jogamp.graph.ui.gl.Scene.PMVMatrixSetup; @@ -281,7 +280,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { final float diffX = 1.2f * buttonXSize; final float diffY = 1.5f * buttonYSize; - Button button = new Button(SVertex.factory(), renderModes, font, "Next Text", buttonXSize, buttonYSize); + Button button = new Button(renderModes, font, "Next Text", buttonXSize, buttonYSize); button.setName(BUTTON_NEXTTEXT); button.move(xStartLeft, yStartTop-diffY*buttons.size(), 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @@ -298,7 +297,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new Button(SVertex.factory(), renderModes, font, "Show FPS", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "Show FPS", buttonXSize, buttonYSize); button.setName(BUTTON_FPS); button.move(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.setToggleable(true); @@ -315,7 +314,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new Button(SVertex.factory(), renderModes, font, "V-Sync", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "V-Sync", buttonXSize, buttonYSize); button.setName(BUTTON_VSYNC); button.move(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.setToggleable(true); @@ -339,7 +338,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new Button(SVertex.factory(), renderModes, font, "< Tilt >", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "< Tilt >", buttonXSize, buttonYSize); button.move(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -358,7 +357,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); if( pass2Mode ) { // second column to the left - button = new Button(SVertex.factory(), renderModes, font, "< Samples >", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "< Samples >", buttonXSize, buttonYSize); button.move(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -377,7 +376,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.addMouseListener(dragZoomRotateListener); buttons.add(button); - button = new Button(SVertex.factory(), renderModes, font, "< Quality >", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "< Quality >", buttonXSize, buttonYSize); button.move(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -402,7 +401,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); } - button = new Button(SVertex.factory(), renderModes, font, "Quit", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "Quit", buttonXSize, buttonYSize); button.setName(BUTTON_QUIT); button.move(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.setColor(0.7f, 0.0f, 0.0f, 1.0f); @@ -430,7 +429,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { { final int j = 1; // column int k = 0; // row - button = new Button(SVertex.factory(), renderModes, font, "Y Flip", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "Y Flip", buttonXSize, buttonYSize); button.move(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -441,7 +440,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new Button(SVertex.factory(), renderModes, font, "X Flip", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "X Flip", buttonXSize, buttonYSize); button.move(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -452,7 +451,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new Button(SVertex.factory(), renderModes, font, "< Space >", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "< Space >", buttonXSize, buttonYSize); button.move(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -473,7 +472,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new Button(SVertex.factory(), renderModes, font, "< Corner >", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "< Corner >", buttonXSize, buttonYSize); button.move(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -494,7 +493,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new Button(SVertex.factory(), renderModes, font, "Reset", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "Reset", buttonXSize, buttonYSize); button.move(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -505,7 +504,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.add(button); k++; - button = new Button(SVertex.factory(), renderModes, font, "Snapshot", buttonXSize, buttonYSize); + button = new Button(renderModes, font, "Snapshot", buttonXSize, buttonYSize); button.move(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new Shape.MouseGestureAdapter() { @Override @@ -536,8 +535,8 @@ public class GPUUISceneGLListener0A implements GLEventListener { if( true ) { final GLMediaPlayer mPlayer = GLMediaPlayerFactory.createDefault(); mPlayer.setTextureUnit(texUnitMediaPlayer); - final MediaButton mPlayerButton = new MediaButton(scene.getVertexFactory(), renderModes, - button2XSize, button2YSize, mPlayer); + final MediaButton mPlayerButton = new MediaButton(renderModes, button2XSize, + button2YSize, mPlayer); mPlayerButton.setName(BUTTON_MOVIE); mPlayerButton.setVerbose(false); mPlayerButton.addDefaultEventListener(); @@ -556,8 +555,8 @@ public class GPUUISceneGLListener0A implements GLEventListener { } if( true ) { final ImageSequence imgSeq = new ImageSequence(texUnitImageButton, true); - final ImageButton imgButton = new ImageButton(scene.getVertexFactory(), renderModes, - button2XSize, button2YSize, imgSeq); + final ImageButton imgButton = new ImageButton(renderModes, button2XSize, + button2YSize, imgSeq); try { imgSeq.addFrame(gl, GPUUISceneGLListener0A.class, "button-released-145x53.png", TextureIO.PNG); imgSeq.addFrame(gl, GPUUISceneGLListener0A.class, "button-pressed-145x53.png", TextureIO.PNG); @@ -606,9 +605,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { System.err.println("Gears Anim: End"); } }).start(); - final GLButton b = new GLButton(scene.getVertexFactory(), renderModes, - button2XSize, button2YSize, - texUnitGLELButton, gears, false /* useAlpha */); + final GLButton b = new GLButton(renderModes, button2XSize, + button2YSize, texUnitGLELButton, + gears, false /* useAlpha */); b.setName(BUTTON_GLEL); b.setToggleable(true); b.setToggle(false); // toggle == true -> animation @@ -667,7 +666,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { scene.surfaceToPlaneSize(new int[] { 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()}, sceneSize); final float modelSizeFixed = fontSizeFixedNorm * sceneSize[1]; - jogampLabel = new Label(scene.getVertexFactory(), renderModes, font, modelSizeFixed, jogamp); + jogampLabel = new Label(renderModes, font, modelSizeFixed, jogamp); jogampLabel.addMouseListener(dragZoomRotateListener); scene.addShape(jogampLabel); jogampLabel.setEnabled(enableOthers); @@ -675,7 +674,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { final float pixelSize10Pt = FontScale.toPixels(fontSizePt, dpiV); final float modelSize10Pt = pixelSize10Pt / drawable.getSurfaceHeight() * sceneSize[1]; System.err.println("10Pt PixelSize: Display "+dpiV+" dpi, fontSize "+fontSizePt+" ppi -> "+pixelSize10Pt+" pixe-size, "+modelSize10Pt+" model-size"); - truePtSizeLabel = new Label(scene.getVertexFactory(), renderModes, font, modelSize10Pt, truePtSize); + truePtSizeLabel = new Label(renderModes, font, modelSize10Pt, truePtSize); scene.addShape(truePtSizeLabel); truePtSizeLabel.setEnabled(enableOthers); truePtSizeLabel.move(0, - 1.5f * jogampLabel.getLineHeight(), 0f); @@ -688,7 +687,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { */ final float pixelSizeFPS = fontSizeFpsNorm * drawable.getSurfaceHeight(); final float modelSizeFPS = pixelSizeFPS / drawable.getSurfaceHeight() * sceneSize[1]; - fpsLabel = new Label(scene.getVertexFactory(), renderModes, fontFPS, modelSizeFPS, "Nothing there yet"); + fpsLabel = new Label(renderModes, fontFPS, modelSizeFPS, "Nothing there yet"); fpsLabel.addMouseListener(dragZoomRotateListener); scene.addShape(fpsLabel); fpsLabel.setEnabled(enableOthers); @@ -849,7 +848,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { final float pixelSizeFixed = fontSizeFixedNorm * scene.getBounds().getHeight(); final float dyTop = scene.getBounds().getHeight() - 2f*jogampLabel.getLineHeight(); final float dxMiddle = scene.getBounds().getWidth() * relMiddle; - labels[currentText] = new Label(scene.getVertexFactory(), renderModes, font, pixelSizeFixed, strings[currentText]); + labels[currentText] = new Label(renderModes, font, pixelSizeFixed, strings[currentText]); labels[currentText].setColor(0.1f, 0.1f, 0.1f, 1.0f); labels[currentText].setEnabled(enableOthers); labels[currentText].move(dxMiddle, diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneTextAnim01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneTextAnim01.java index b36bb4635..ea88d17bf 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneTextAnim01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/GPUUISceneTextAnim01.java @@ -131,7 +131,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { private void setupUI(final GLAutoDrawable drawable) { final float pixelSizeFixed = fontSizeFixedPVP * drawable.getSurfaceHeight(); - jogampLabel = new Label(scene.getVertexFactory(), renderModes, font, pixelSizeFixed, jogamp); + jogampLabel = new Label(renderModes, font, pixelSizeFixed, jogamp); jogampLabel.addMouseListener(dragZoomRotateListener); scene.addShape(jogampLabel); jogampLabel.setEnabled(true); @@ -145,7 +145,7 @@ public class GPUUISceneTextAnim01 implements GLEventListener { * [FPS] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 15.679012 */ final float pixelSizeFPS = fontSizeFpsPVP * drawable.getSurfaceHeight(); - fpsLabel = new Label(scene.getVertexFactory(), renderModes, fontFPS, pixelSizeFPS, "Nothing there yet"); + fpsLabel = new Label(renderModes, fontFPS, pixelSizeFPS, "Nothing there yet"); fpsLabel.addMouseListener(dragZoomRotateListener); scene.addShape(fpsLabel); fpsLabel.setEnabled(true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java index d7677ecbd..df0f681ad 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo00.java @@ -34,7 +34,6 @@ import com.jogamp.graph.curve.Region; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.ui.gl.Scene; import com.jogamp.graph.ui.gl.Shape; import com.jogamp.graph.ui.gl.shapes.Button; @@ -81,7 +80,7 @@ public class UISceneDemo00 { final Font font = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_LIGHT, FontSet.STYLE_SERIF); System.err.println("Font: "+font.getFullFamilyName()); - final Shape shape = new Button(SVertex.factory(), renderModes, font, "+", 0.10f, 0.10f/2.5f); // normalized: 1 is 100% surface size (width and/or height) + final Shape shape = new Button(renderModes, font, "+", 0.10f, 0.10f/2.5f); // normalized: 1 is 100% surface size (width and/or height) System.err.println("Shape bounds "+shape.getBounds(glp)); final Scene scene = new Scene(); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java index 6368387bf..436c0d847 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo01.java @@ -34,7 +34,6 @@ import com.jogamp.graph.curve.Region; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.ui.gl.Scene; import com.jogamp.graph.ui.gl.Scene.PMVMatrixSetup; import com.jogamp.graph.ui.gl.Shape; @@ -241,8 +240,8 @@ public class UISceneDemo01 { } }).start(); final int texUnit = 1; - final GLButton b = new GLButton(SVertex.factory(), renderModes, - sw, sh, texUnit, gears, false /* useAlpha */); + final GLButton b = new GLButton(renderModes, sw, + sh, texUnit, gears, false /* useAlpha */); b.setToggleable(true); b.setToggle(true); // toggle == true -> animation b.setAnimate(true); diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java index 4ba64a4b5..b2fcf6de0 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo10.java @@ -37,7 +37,6 @@ import com.jogamp.graph.curve.Region; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.ui.gl.Scene; import com.jogamp.graph.ui.gl.Shape; import com.jogamp.graph.ui.gl.shapes.Button; @@ -245,7 +244,7 @@ public class UISceneDemo10 { } final GLMediaPlayer mPlayer = GLMediaPlayerFactory.createDefault(); // mPlayer.setTextureUnit(texUnitMediaPlayer); - final MediaButton b = new MediaButton(SVertex.factory(), renderModes, sw, sh, mPlayer); + final MediaButton b = new MediaButton(renderModes, sw, sh, mPlayer); b.setVerbose(false); b.addDefaultEventListener(); b.setToggleable(true); @@ -268,8 +267,8 @@ public class UISceneDemo10 { glel = gears; } final int texUnit = 1; - final GLButton b = new GLButton(SVertex.factory(), renderModes, - sw, sh, texUnit, glel, false /* useAlpha */); + final GLButton b = new GLButton(renderModes, sw, + sh, texUnit, glel, false /* useAlpha */); b.setToggleable(true); b.setToggle(true); // toggle == true -> animation b.setAnimate(true); @@ -280,11 +279,11 @@ public class UISceneDemo10 { } } ); return b; } else if( true ){ - final Button b = new Button(SVertex.factory(), renderModes, font, "+", sw, sh); + final Button b = new Button(renderModes, font, "+", sw, sh); b.setCorner(0.0f); return b; } else { - final CrossHair b = new CrossHair(SVertex.factory(), renderModes, sw, sw, 1f/100f); + final CrossHair b = new CrossHair(renderModes, sw, sw, 1f/100f); return b; } } diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java index b1eca9b20..5501bdf7e 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UIShapeDemo01.java @@ -52,7 +52,6 @@ import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.geom.plane.AffineTransform; import com.jogamp.graph.ui.gl.Shape; import com.jogamp.graph.ui.gl.shapes.Button; @@ -182,7 +181,7 @@ public class UIShapeDemo01 implements GLEventListener { final float sz1_w = 1/8f; final float sz2 = 1/20f; - button = new Button(SVertex.factory(), renderModes, font, "Click me!", sz1_w, sz1_w/2f); + button = new Button(renderModes, font, "Click me!", sz1_w, sz1_w/2f); button.setLabelColor(0.0f,0.0f,0.0f); /** Button defaults ! button.setLabelColor(1.0f,1.0f,1.0f); @@ -191,7 +190,7 @@ public class UIShapeDemo01 implements GLEventListener { button.setSpacing(2.0f); */ System.err.println(button); - crossHair = new CrossHair(SVertex.factory(), renderModes, sz2, sz2, 1/1000f); + crossHair = new CrossHair(renderModes, sz2, sz2, 1/1000f); crossHair.setColor(0f,0f,1f,1f); crossHair.setEnabled(true); } diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java index 816c9929d..5d380b396 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java @@ -30,35 +30,15 @@ package com.jogamp.opengl.demos.graph.ui; import java.io.File; import java.io.IOException; -import com.jogamp.opengl.FPSCounter; -import com.jogamp.opengl.GL; -import com.jogamp.opengl.GL2ES2; -import com.jogamp.opengl.GLAnimatorControl; -import com.jogamp.opengl.GLAutoDrawable; -import com.jogamp.opengl.GLCapabilities; -import com.jogamp.opengl.GLEventListener; -import com.jogamp.opengl.GLException; -import com.jogamp.opengl.GLPipelineFactory; -import com.jogamp.opengl.GLProfile; -import com.jogamp.opengl.GLRunnable; -import com.jogamp.opengl.demos.graph.MSAATool; -import com.jogamp.opengl.demos.graph.ui.testshapes.Glyph03FreeMonoRegular_M; -import com.jogamp.opengl.demos.graph.ui.testshapes.Glyph04FreeSans_0; -import com.jogamp.opengl.demos.graph.ui.testshapes.Glyph05FreeSerifBoldItalic_ae; -import com.jogamp.opengl.demos.util.MiscUtils; -import com.jogamp.opengl.fixedfunc.GLMatrixFunc; -import com.jogamp.opengl.math.FloatUtil; -import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.TextRegionUtil; import com.jogamp.graph.font.Font; +import com.jogamp.graph.font.Font.Glyph; import com.jogamp.graph.font.FontFactory; import com.jogamp.graph.font.FontSet; -import com.jogamp.graph.font.Font.Glyph; -import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.geom.plane.AffineTransform; import com.jogamp.graph.ui.gl.Shape; import com.jogamp.graph.ui.gl.shapes.CrossHair; @@ -72,6 +52,23 @@ import com.jogamp.newt.event.MouseListener; import com.jogamp.newt.event.WindowAdapter; import com.jogamp.newt.event.WindowEvent; import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.FPSCounter; +import com.jogamp.opengl.GL; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.opengl.GLAnimatorControl; +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLCapabilities; +import com.jogamp.opengl.GLEventListener; +import com.jogamp.opengl.GLException; +import com.jogamp.opengl.GLPipelineFactory; +import com.jogamp.opengl.GLProfile; +import com.jogamp.opengl.GLRunnable; +import com.jogamp.opengl.demos.graph.MSAATool; +import com.jogamp.opengl.demos.graph.ui.testshapes.Glyph03FreeMonoRegular_M; +import com.jogamp.opengl.demos.util.MiscUtils; +import com.jogamp.opengl.fixedfunc.GLMatrixFunc; +import com.jogamp.opengl.math.FloatUtil; +import com.jogamp.opengl.math.geom.AABBox; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.GLReadBufferUtil; import com.jogamp.opengl.util.PMVMatrix; @@ -201,18 +198,18 @@ public class UITypeDemo01 implements GLEventListener { this.trace = trace; this.screenshot = new GLReadBufferUtil(false, false); - crossHair = new CrossHair(SVertex.factory(), renderModes, 1/20f, 1/20f, 1/1000f); + crossHair = new CrossHair(renderModes, 1/20f, 1/20f, 1/1000f); crossHair.setColor(0f,0f,1f,1f); crossHair.setEnabled(true); if (false ) { - final Rectangle o = new Rectangle(SVertex.factory(), renderModes, 1/10f, 1/20f, 1/1000f); + final Rectangle o = new Rectangle(renderModes, 1/10f, 1/20f, 1/1000f); o.move(o.getWidth(), -o.getHeight(), 0f); testObj = o; } else { final float scale = 0.15312886f; final float size_xz = 0.541f; - final Shape o = new Glyph03FreeMonoRegular_M(SVertex.factory(), renderModes); + final Shape o = new Glyph03FreeMonoRegular_M(renderModes); o.scale(scale, scale, 1f); // o.translate(size_xz, -size_xz, 0f); testObj = o; diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java index 2725ab58e..e2fef0286 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java @@ -27,11 +27,7 @@ */ package com.jogamp.opengl.demos.graph.ui.testshapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.geom.plane.Winding; import com.jogamp.graph.ui.gl.Shape; @@ -42,8 +38,8 @@ import com.jogamp.graph.ui.gl.Shape; */ public class Glyph01UbuntuLight_o extends Shape { - public Glyph01UbuntuLight_o(final Factory<? extends Vertex> factory, final int renderModes) { - super(factory, renderModes); + public Glyph01UbuntuLight_o(final int renderModes) { + super(renderModes); } @SuppressWarnings("unused") diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java index 90bdcdcef..0661f5c91 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java @@ -27,11 +27,7 @@ */ package com.jogamp.opengl.demos.graph.ui.testshapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -41,8 +37,8 @@ import com.jogamp.graph.ui.gl.Shape; */ public class Glyph02UbuntuLight_ae extends Shape { - public Glyph02UbuntuLight_ae(final Factory<? extends Vertex> factory, final int renderModes) { - super(factory, renderModes); + public Glyph02UbuntuLight_ae(final int renderModes) { + super(renderModes); } @SuppressWarnings("unused") diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java index 7c53791a7..f53651536 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java @@ -27,11 +27,7 @@ */ package com.jogamp.opengl.demos.graph.ui.testshapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -41,8 +37,8 @@ import com.jogamp.graph.ui.gl.Shape; */ public class Glyph03FreeMonoRegular_M extends Shape { - public Glyph03FreeMonoRegular_M(final Factory<? extends Vertex> factory, final int renderModes) { - super(factory, renderModes); + public Glyph03FreeMonoRegular_M(final int renderModes) { + super(renderModes); } @SuppressWarnings("unused") diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java index 24474497c..f347c464c 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java @@ -27,11 +27,7 @@ */ package com.jogamp.opengl.demos.graph.ui.testshapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -41,8 +37,8 @@ import com.jogamp.graph.ui.gl.Shape; */ public class Glyph04FreeSans_0 extends Shape { - public Glyph04FreeSans_0(final Factory<? extends Vertex> factory, final int renderModes) { - super(factory, renderModes); + public Glyph04FreeSans_0(final int renderModes) { + super(renderModes); } @Override diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java index 26c519767..d49ae305b 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java @@ -27,11 +27,7 @@ */ package com.jogamp.opengl.demos.graph.ui.testshapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -41,8 +37,8 @@ import com.jogamp.graph.ui.gl.Shape; */ public class Glyph05FreeSerifBoldItalic_ae extends Shape { - public Glyph05FreeSerifBoldItalic_ae(final Factory<? extends Vertex> factory, final int renderModes) { - super(factory, renderModes); + public Glyph05FreeSerifBoldItalic_ae(final int renderModes) { + super(renderModes); } @Override diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java index 16e5c736f..24df8c80a 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java @@ -46,8 +46,6 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.curve.opengl.RenderState; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.graph.geom.Vertex; import com.jogamp.newt.event.GestureHandler; import com.jogamp.newt.event.InputEvent; import com.jogamp.newt.event.MouseEvent; @@ -117,11 +115,8 @@ public final class Scene implements GLEventListener { private GLAutoDrawable cDrawable = null; - /** Returns the default Vertex.Factory. */ - public static Vertex.Factory<? extends Vertex> getDefaultVertexFactory() { return SVertex.factory(); } - private static RegionRenderer createRenderer() { - return RegionRenderer.create(getDefaultVertexFactory(), RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); + return RegionRenderer.create(RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable); } /** @@ -150,9 +145,6 @@ public final class Scene implements GLEventListener { /** Returns the associated RegionRenderer's RenderState. */ public RenderState getRenderState() { return renderer.getRenderState(); } - /** Returns the used Vertex.Factory, as used by Region and RegionRenderer. */ - public final Vertex.Factory<? extends Vertex> getVertexFactory() { return renderer.getRenderState().getVertexFactory(); } - /** * Sets the clear parameter for {@link GL#glClearColor(float, float, float, float) glClearColor(..)} and {@link GL#glClear(int) glClear(..)} * to be issued at {@link #display(GLAutoDrawable)}. diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java index 1876b8057..52a17f49a 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Shape.java @@ -121,8 +121,8 @@ public abstract class Shape { private Listener onMoveListener = null; - public Shape(final Factory<? extends Vertex> factory, final int renderModes) { - this.vertexFactory = factory; + public Shape(final int renderModes) { + this.vertexFactory = OutlineShape.getDefaultVertexFactory(); this.renderModes = renderModes; this.box = new AABBox(); } @@ -132,8 +132,6 @@ public abstract class Shape { /** Return the optional symbolic name for this shape. */ public final int getName() { return this.name; } - public final Vertex.Factory<? extends Vertex> getVertexFactory() { return vertexFactory; } - /** Returns true if this shape is enabled and hence visible, otherwise false. */ public final boolean isEnabled() { return enabled; } /** Enable or disable this shape, i.e. its visibility. */ diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java index fb81522ad..3774b7b1f 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Button.java @@ -33,8 +33,6 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.font.Font; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.math.geom.AABBox; import jogamp.graph.ui.shapes.Label0; @@ -62,10 +60,10 @@ public class Button extends RoundButton { private float spacingX = DEFAULT_SPACING_X; private float spacingY = DEFAULT_SPACING_Y; - public Button(final Factory<? extends Vertex> factory, final int renderModes, - final Font labelFont, final String labelText, - final float width, final float height) { - super(factory, renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height); + public Button(final int renderModes, final Font labelFont, + final String labelText, final float width, + final float height) { + super(renderModes | Region.COLORCHANNEL_RENDERING_BIT, width, height); this.label = new Label0(labelFont, labelText, new float[] { 1.33f, 1.33f, 1.33f, 1.0f }); // 0.75 * 1.33 = 1.0 setColor(0.75f, 0.75f, 0.75f, 1.0f); setPressedColorMod(0.9f, 0.9f, 0.9f, 0.7f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java index 1d2df261e..ac09ea395 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/CrossHair.java @@ -27,11 +27,7 @@ */ package com.jogamp.graph.ui.gl.shapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -43,8 +39,8 @@ import com.jogamp.graph.ui.gl.Shape; public class CrossHair extends Shape { private float width, height, lineWidth; - public CrossHair(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final float linewidth) { - super(factory, renderModes); + public CrossHair(final int renderModes, final float width, final float height, final float linewidth) { + super(renderModes); this.width = width; this.height = height; this.lineWidth = linewidth; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java index 8b81eb4f2..0d51ff09b 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/GLButton.java @@ -37,8 +37,6 @@ import com.jogamp.opengl.GLDrawableFactory; import com.jogamp.opengl.GLEventListener; import com.jogamp.opengl.GLOffscreenAutoDrawable; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.FBObject; import com.jogamp.opengl.util.texture.ImageSequence; import com.jogamp.opengl.util.texture.Texture; @@ -64,10 +62,9 @@ public class GLButton extends TexSeqButton { private volatile GLOffscreenAutoDrawable.FBO fboGLAD = null; private boolean animateGLEL = false; - public GLButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, final int textureUnit, - final GLEventListener glel, final boolean useAlpha) { - super(factory, renderModes, width, height, new ImageSequence(textureUnit, true)); + public GLButton(final int renderModes, final float width, final float height, + final int textureUnit, final GLEventListener glel, final boolean useAlpha) { + super(renderModes, width, height, new ImageSequence(textureUnit, true)); this.glel = glel; this.useAlpha = useAlpha; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java index 957d7141f..bbc4975bf 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/ImageButton.java @@ -29,8 +29,6 @@ package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.util.texture.ImageSequence; /** @@ -45,9 +43,9 @@ import com.jogamp.opengl.util.texture.ImageSequence; */ public class ImageButton extends TexSeqButton { - public ImageButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, final ImageSequence texSeq) { - super(factory, renderModes, width, height, texSeq); + public ImageButton(final int renderModes, final float width, + final float height, final ImageSequence texSeq) { + super(renderModes, width, height, texSeq); setColor(0.95f, 0.95f, 0.95f, 1.0f); setPressedColorMod(1f, 1f, 1f, 0.9f); setToggleOffColorMod(0.8f, 0.8f, 0.8f, 1.0f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java index ac337924a..7db220537 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Label.java @@ -34,8 +34,6 @@ import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.font.Font; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.geom.plane.AffineTransform; import com.jogamp.graph.ui.gl.Shape; @@ -52,14 +50,13 @@ public class Label extends Shape { /** * Label ctor - * @param factory Vertex factory * @param renderModes region renderModes * @param font the font * @param fontScale font-scale factor, by which the em-sized type glyphs shall be scaled * @param text the text to render */ - public Label(final Factory<? extends Vertex> factory, final int renderModes, final Font font, final float fontScale, final String text) { - super(factory, renderModes); + public Label(final int renderModes, final Font font, final float fontScale, final String text) { + super(renderModes); this.font = font; this.fontScale = fontScale; this.text = text; @@ -166,7 +163,15 @@ public class Label extends Shape { @Override public void visit(final OutlineShape shape, final AffineTransform t) { shape.setSharpness(shapesSharpness); - region.addOutlineShape(shape, t, rgbaColor); + try { + region.addOutlineShape(shape, t, rgbaColor); + } catch ( final Exception ex ) { + ex.printStackTrace(); + System.err.println("Ex from "+Label.this); + System.err.println("Ex from "+region.toString()); + region.printBufferStats(System.err); + System.exit(-1); + } } }; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java index e858093ab..8f9ccda3e 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/MediaButton.java @@ -30,8 +30,6 @@ package com.jogamp.graph.ui.gl.shapes; import com.jogamp.opengl.GL2ES2; import com.jogamp.common.util.InterruptSource; import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.opengl.util.av.GLMediaPlayer; import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener; import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException; @@ -51,17 +49,15 @@ public class MediaButton extends TexSeqButton { private boolean verbose = false; /** - * @param factory * @param renderModes * @param width * @param height * @param mPlayer * @param mPlayerListener */ - public MediaButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, - final GLMediaPlayer mPlayer) { - super(factory, renderModes, width, height, mPlayer); + public MediaButton(final int renderModes, final float width, + final float height, final GLMediaPlayer mPlayer) { + super(renderModes, width, height, mPlayer); setColor(0.8f, 0.8f, 0.8f, 1.0f); setPressedColorMod(1.1f, 1.1f, 1.1f, 0.7f); setToggleOffColorMod(0.8f, 0.8f, 0.8f, 1.0f); diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java index 391390bea..ced2a2849 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/Rectangle.java @@ -27,11 +27,7 @@ */ package com.jogamp.graph.ui.gl.shapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -43,8 +39,8 @@ import com.jogamp.graph.ui.gl.Shape; public class Rectangle extends Shape { private float width, height, lineWidth; - public Rectangle(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height, final float linewidth) { - super(factory, renderModes); + public Rectangle(final int renderModes, final float width, final float height, final float linewidth) { + super(renderModes); this.width = width; this.height = height; this.lineWidth = linewidth; diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java index aa8aabbdb..8dde441d9 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/RoundButton.java @@ -27,11 +27,7 @@ */ package com.jogamp.graph.ui.gl.shapes; -import com.jogamp.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.curve.opengl.RegionRenderer; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; /** @@ -52,8 +48,8 @@ public abstract class RoundButton extends Shape { protected float height; protected float corner = DEFAULT_CORNER; - protected RoundButton(final Factory<? extends Vertex> factory, final int renderModes, final float width, final float height) { - super(factory, renderModes); + protected RoundButton(final int renderModes, final float width, final float height) { + super(renderModes); this.width = width; this.height = height; } diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java index 365fa8e66..41dd196e0 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/gl/shapes/TexSeqButton.java @@ -31,8 +31,6 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.graph.curve.OutlineShape; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.Vertex.Factory; import com.jogamp.graph.ui.gl.Shape; import com.jogamp.opengl.util.texture.TextureSequence; @@ -49,9 +47,9 @@ import com.jogamp.opengl.util.texture.TextureSequence; public abstract class TexSeqButton extends RoundButton { protected final TextureSequence texSeq; - public TexSeqButton(final Factory<? extends Vertex> factory, final int renderModes, - final float width, final float height, final TextureSequence texSeq) { - super(factory, renderModes | Region.COLORTEXTURE_RENDERING_BIT, width, height); + public TexSeqButton(final int renderModes, final float width, + final float height, final TextureSequence texSeq) { + super(renderModes | Region.COLORTEXTURE_RENDERING_BIT, width, height); this.texSeq = texSeq; } diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java index fc8d41660..7b487347a 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java +++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java @@ -34,6 +34,7 @@ import java.util.Comparator; import com.jogamp.graph.curve.tess.Triangulation; import com.jogamp.graph.curve.tess.Triangulator; import com.jogamp.graph.geom.Outline; +import com.jogamp.graph.geom.SVertex; import com.jogamp.graph.geom.Triangle; import com.jogamp.graph.geom.Vertex; import com.jogamp.graph.geom.plane.AffineTransform; @@ -187,7 +188,18 @@ public final class OutlineShape implements Comparable<OutlineShape> { private final float[] tmpV2 = new float[3]; private final float[] tmpV3 = new float[3]; - /** Create a new Outline based Shape + /** Returns the default Vertex.Factory. */ + public static Vertex.Factory<? extends Vertex> getDefaultVertexFactory() { return SVertex.factory(); } + + /** + * Create a new Outline based Shape using {@link #getDefaultVertexFactory()} + */ + public OutlineShape() { + this(getDefaultVertexFactory()); + } + + /** + * Create a new Outline based Shape */ public OutlineShape(final Vertex.Factory<? extends Vertex> factory) { this.vertexFactory = factory; 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 28be06eee..b24cc3230 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -47,8 +47,6 @@ import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.common.os.Platform; import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.graph.curve.Region; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.graph.geom.Vertex; /** * OpenGL {@link Region} renderer @@ -164,7 +162,7 @@ public final class RegionRenderer { * @see #enable(GL2ES2, boolean) */ public static RegionRenderer create(final GLCallback enableCallback, final GLCallback disableCallback) { - return new RegionRenderer(null, enableCallback, disableCallback); + return new RegionRenderer(enableCallback, disableCallback); } /** @@ -175,30 +173,6 @@ public final class RegionRenderer { * For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable} * can be utilized to enable and disable {@link GL#GL_BLEND}. * </p> - * @param pointFactory optional {@link Vertex.Factory} to be used for the {@link RenderState} composition, - * If null, SVertex.factory() will be used. - * @param enableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at - * {@link #init(GL2ES2) init(gl)} and {@link #enable(GL2ES2, boolean) enable(gl, true)}. - * @param disableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at - * {@link #enable(GL2ES2, boolean) enable(gl, false)}. - * @return an instance of Region Renderer - * @see #enable(GL2ES2, boolean) - */ - public static RegionRenderer create(final Vertex.Factory<? extends Vertex> pointFactory, - final GLCallback enableCallback, final GLCallback disableCallback) { - return new RegionRenderer(pointFactory, enableCallback, disableCallback); - } - - /** - * Create a hardware accelerated RegionRenderer including its {@link RenderState} composition. - * <p> - * The optional {@link GLCallback}s <code>enableCallback</code> and <code>disableCallback</code> - * maybe used to issue certain tasks at {@link #enable(GL2ES2, boolean)}.<br/> - * For example, instances {@link #defaultBlendEnable} and {@link #defaultBlendDisable} - * can be utilized to enable and disable {@link GL#GL_BLEND}. - * </p> - * @param pointFactory optional {@link Vertex.Factory} to be used for the {@link RenderState} composition. - * If null, SVertex.factory() will be used. * @param sharedPMVMatrix optional shared {@link PMVMatrix} to be used for the {@link RenderState} composition. * @param enableCallback optional {@link GLCallback}, if not <code>null</code> will be issued at * {@link #init(GL2ES2) init(gl)} and {@link #enable(GL2ES2, boolean) enable(gl, true)}. @@ -207,9 +181,9 @@ public final class RegionRenderer { * @return an instance of Region Renderer * @see #enable(GL2ES2, boolean) */ - public static RegionRenderer create(final Vertex.Factory<? extends Vertex> pointFactory, final PMVMatrix sharedPMVMatrix, + public static RegionRenderer create(final PMVMatrix sharedPMVMatrix, final GLCallback enableCallback, final GLCallback disableCallback) { - return new RegionRenderer(pointFactory, sharedPMVMatrix, enableCallback, disableCallback); + return new RegionRenderer(sharedPMVMatrix, enableCallback, disableCallback); } private final RenderState rs; @@ -242,18 +216,17 @@ public final class RegionRenderer { ////////////////////////////////////// - protected RegionRenderer(final Vertex.Factory<? extends Vertex> pointFactory, - final GLCallback enableCallback, final GLCallback disableCallback) + protected RegionRenderer(final GLCallback enableCallback, final GLCallback disableCallback) { - this.rs = new RenderState(pointFactory, null); + this.rs = new RenderState(null); this.enableCallback = enableCallback; this.disableCallback = disableCallback; } - protected RegionRenderer(final Vertex.Factory<? extends Vertex> pointFactory, final PMVMatrix sharedPMVMatrix, + protected RegionRenderer(final PMVMatrix sharedPMVMatrix, final GLCallback enableCallback, final GLCallback disableCallback) { - this.rs = new RenderState(pointFactory, sharedPMVMatrix); + this.rs = new RenderState(sharedPMVMatrix); this.enableCallback = enableCallback; this.disableCallback = disableCallback; } diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java index 6e1886c73..9dc72f617 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java @@ -38,8 +38,6 @@ import jogamp.common.os.PlatformPropsImpl; import jogamp.graph.curve.opengl.shader.UniformNames; import com.jogamp.graph.curve.Region; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.graph.geom.Vertex; import com.jogamp.opengl.util.GLArrayDataServer; import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderProgram; @@ -92,7 +90,6 @@ public class RenderState { return (RenderState) gl.getContext().getAttachedObject(thisKey); } - private final Vertex.Factory<? extends Vertex> vertexFactory; private final PMVMatrix pmvMatrix; private final float[] weight; private final FloatBuffer weightBuffer; @@ -187,13 +184,11 @@ public class RenderState { /** * Create a RenderState, a composition of RegionRenderer - * @param vertexFactory used Vertex.Factory, if null SVertex.factory() will be used. * @param sharedPMVMatrix optional shared PMVMatrix, if null using a local instance */ - /* pp */ RenderState(final Vertex.Factory<? extends Vertex> vertexFactory, final PMVMatrix sharedPMVMatrix) { + /* pp */ RenderState(final PMVMatrix sharedPMVMatrix) { this.id = getNextID(); this.sp = null; - this.vertexFactory = null != vertexFactory ? vertexFactory : SVertex.factory(); this.pmvMatrix = null != sharedPMVMatrix ? sharedPMVMatrix : new PMVMatrix(); this.weight = new float[1]; this.weightBuffer = FloatBuffer.wrap(weight); @@ -233,8 +228,6 @@ public class RenderState { return true; } - public final Vertex.Factory<? extends Vertex> getVertexFactory() { return vertexFactory; } - public final PMVMatrix getMatrix() { return pmvMatrix; } public static boolean isWeightValid(final float v) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 12128f5ad..5720b9a17 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -27,6 +27,13 @@ */ package jogamp.graph.font.typecast; +import com.jogamp.common.util.IntObjectHashMap; +import com.jogamp.graph.curve.OutlineShape; +import com.jogamp.graph.font.Font; +import com.jogamp.graph.font.FontFactory; +import com.jogamp.graph.geom.plane.AffineTransform; +import com.jogamp.opengl.math.geom.AABBox; + import jogamp.graph.font.typecast.ot.OTFontCollection; import jogamp.graph.font.typecast.ot.TTFont; import jogamp.graph.font.typecast.ot.table.CmapFormat; @@ -42,18 +49,8 @@ import jogamp.graph.font.typecast.ot.table.KernTable; import jogamp.graph.font.typecast.ot.table.KerningPair; import jogamp.graph.font.typecast.ot.table.PostTable; -import com.jogamp.common.util.IntObjectHashMap; -import com.jogamp.graph.curve.OutlineShape; -import com.jogamp.graph.font.Font; -import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.geom.SVertex; -import com.jogamp.graph.geom.Vertex; -import com.jogamp.graph.geom.plane.AffineTransform; -import com.jogamp.opengl.math.geom.AABBox; - class TypecastFont implements Font { static final boolean DEBUG = false; - private static final Vertex.Factory<SVertex> vertexFactory = SVertex.factory(); // private final OTFontCollection fontset; /* pp */ final TTFont font; @@ -207,7 +204,7 @@ class TypecastFont implements Font { glyph_advance = glyph.getAdvanceWidth(); glyph_leftsidebearings = glyph.getLeftSideBearing(); glyph_bbox = glyph.getBBox(); - shape = TypecastRenderer.buildShape(metrics.getUnitsPerEM(), glyph, vertexFactory); + shape = TypecastRenderer.buildShape(metrics.getUnitsPerEM(), glyph, OutlineShape.getDefaultVertexFactory()); } else { final int glyph_height = metrics.getAscentFU() - metrics.getDescentFU(); glyph_advance = getAdvanceWidthFU(glyph_id); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java index 688174772..2dacdec68 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener01.java @@ -254,7 +254,7 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { gl.glEnable(GL.GL_BLEND); rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); - outlineShape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); + outlineShape = new OutlineShape(); switch( shape_ctor_mode ) { case 0: createTestOutline00(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java index f285f8bd8..80beafd60 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/GPURegionGLListener10.java @@ -57,7 +57,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { } private void createTestOutline(final GLProfile glp){ - OutlineShape shape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); + OutlineShape shape = new OutlineShape(); outlineShapes.add(shape); shape.addVertex(0.0f,-10.0f,true); shape.addVertex(15.0f,-10.0f, true); @@ -75,7 +75,7 @@ public class GPURegionGLListener10 extends GPURendererListenerBase01 { shape.closeLastOutline(true); /** Same shape as above but without any off-curve vertices */ - shape = new OutlineShape(getRenderer().getRenderState().getVertexFactory()); + shape = new OutlineShape(); outlineShapes.add(shape); final float offset = 30; shape.addVertex(offset+0.0f,-10.0f, true); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java index e208833a8..99cbb5118 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java @@ -127,7 +127,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { @Override public void init(final GLAutoDrawable drawable) { exclusivePMVMatrix = null == sharedPMVMatrix; - this.renderer = RegionRenderer.create(null, sharedPMVMatrix, enableCallback, disableCallback); + this.renderer = RegionRenderer.create(sharedPMVMatrix, enableCallback, disableCallback); this.getRenderer().getRenderState().setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); this.textRenderUtil = new TextRegionUtil(renderModes); final GL2ES2 gl = drawable.getGL().getGL2ES2(); |