summaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-04-20 22:00:11 +0200
committerSven Gothel <[email protected]>2023-04-20 22:00:11 +0200
commit2aae33b94cea15b2fc0c54479277611c67cdaf13 (patch)
treee1956d8361fd1ef6860c50f0a0aa8aab6b5ce612 /src/demos
parentc21082a5d7caf0ae6e29144358b4b4a1eafec019 (diff)
GraphUI GraphShape: createGLRegion() -> updateGLRegion(), called by addShapeToRegion() impl to utilize OutlineShape -> GLRegion ctor w/ proper buffer-size
This way we avoid unnecessary buffer growth and allow creation of 'always' fitting buffer sizes. +++ Update or freshly create the GLRegion, while allocating its buffers with given initial `vertexCount` and `indexCount`. Method shall be invoked by the addShapeToRegion(GLProfile, GL2ES2) implementation before actually adding the OutlineShape to the GLRegion. addShapeToRegion(GLProfile, GL2ES2) is capable to determine initial `vertexCount` and `indexCount` buffer sizes, as it composes the OutlineShapes to be added. updateGLRegion(GLProfile, GL2ES2, TextureSequence, OutlineShape) maybe used for convenience. In case GLRegion is `null`, a new instance is being created. In case the GLRegion already exists, it will be either cleared if the GL2ES2 `gl` instance is not `null` or earmarked for deletion at a later time and a new instance is being created.
Diffstat (limited to 'src/demos')
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo12.java9
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java2
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph01UbuntuLight_o.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph02UbuntuLight_ae.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph03FreeMonoRegular_M.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph04FreeSans_0.java8
-rw-r--r--src/demos/com/jogamp/opengl/demos/graph/ui/testshapes/Glyph05FreeSerifBoldItalic_ae.java8
7 files changed, 35 insertions, 16 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo12.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo12.java
index 846f03184..4a0fa9a90 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo12.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo12.java
@@ -91,7 +91,6 @@ public class UISceneDemo12 {
final GLWindow window = GLWindow.create(caps);
window.setSize(options.surface_width, options.surface_height);
window.setTitle(UISceneDemo12.class.getSimpleName()+": "+window.getSurfaceWidth()+" x "+window.getSurfaceHeight());
- window.setVisible(true);
window.addWindowListener(new WindowAdapter() {
@Override
public void windowResized(final WindowEvent e) {
@@ -104,17 +103,17 @@ public class UISceneDemo12 {
});
- animator.setUpdateFPSFrames(1*60, null); // System.err);
- animator.add(window);
- animator.start();
-
final Scene scene = new Scene();
scene.setClearParams(new float[] { 1f, 1f, 1f, 1f}, GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
scene.setFrustumCullingEnabled(true);
scene.attachInputListenerTo(window);
window.addGLEventListener(scene);
+ window.setVisible(true);
scene.waitUntilDisplayed();
+ animator.setUpdateFPSFrames(1*60, null); // System.err);
+ animator.add(window);
+ animator.start();
//
// Resolution independent, no screen size
//
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 6fe7e1791..1640f1426 100644
--- a/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
+++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UITypeDemo01.java
@@ -332,7 +332,7 @@ public class UITypeDemo01 implements GLEventListener {
pmv.glScalef(txt_scale, txt_scale, 1f);
pmv.glTranslatef(-txt_box_em.getWidth(), 0f, 0f);
if( null != glyph.getShape() ) {
- final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null);
+ final GLRegion region = GLRegion.create(gl.getGLProfile(), renderModes, null, glyph.getShape());
region.addOutlineShape(glyph.getShape(), null, fg_color);
region.draw(gl, renderer, sampleCount);
region.destroy(gl);
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 1272a3a94..313b23e45 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
@@ -30,6 +30,8 @@ package com.jogamp.opengl.demos.graph.ui.testshapes;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.geom.plane.Winding;
import com.jogamp.graph.ui.GraphShape;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLProfile;
/**
* GPU based resolution independent test object
@@ -44,7 +46,7 @@ public class Glyph01UbuntuLight_o extends GraphShape {
@SuppressWarnings("unused")
@Override
- protected void addShapeToRegion() {
+ protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
final OutlineShape shape = new OutlineShape();
// Ubuntu-Light, lower case 'o'
@@ -292,9 +294,11 @@ public class Glyph01UbuntuLight_o extends GraphShape {
shape.setIsQuadraticNurbs();
shape.setSharpness(oshapeSharpness);
- region.addOutlineShape(shape, null, rgbaColor);
+ updateGLRegion(glp, gl, null, shape);
+ region.addOutlineShape(shape, null, rgbaColor);
box.resize(shape.getBounds());
+ setRotationPivot( box.getCenter() );
}
@Override
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 e4604bf45..5e9cb910f 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
@@ -29,6 +29,8 @@ package com.jogamp.opengl.demos.graph.ui.testshapes;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.ui.GraphShape;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLProfile;
/**
* GPU based resolution independent test object
@@ -43,7 +45,7 @@ public class Glyph02UbuntuLight_ae extends GraphShape {
@SuppressWarnings("unused")
@Override
- protected void addShapeToRegion() {
+ protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
final OutlineShape shape = new OutlineShape();
// Ubuntu-Light, lower case 'æ'
@@ -628,9 +630,11 @@ public class Glyph02UbuntuLight_ae extends GraphShape {
shape.setIsQuadraticNurbs();
shape.setSharpness(oshapeSharpness);
- region.addOutlineShape(shape, null, rgbaColor);
+ updateGLRegion(glp, gl, null, shape);
+ region.addOutlineShape(shape, null, rgbaColor);
box.resize(shape.getBounds());
+ setRotationPivot( box.getCenter() );
}
@Override
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 877a72648..a4bc79720 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
@@ -29,6 +29,8 @@ package com.jogamp.opengl.demos.graph.ui.testshapes;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.ui.GraphShape;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLProfile;
/**
* GPU based resolution independent test object
@@ -43,7 +45,7 @@ public class Glyph03FreeMonoRegular_M extends GraphShape {
@SuppressWarnings("unused")
@Override
- protected void addShapeToRegion() {
+ protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
final OutlineShape shape = new OutlineShape();
if( false ) {
@@ -780,9 +782,11 @@ public class Glyph03FreeMonoRegular_M extends GraphShape {
shape.setIsQuadraticNurbs();
shape.setSharpness(oshapeSharpness);
- region.addOutlineShape(shape, null, rgbaColor);
+ updateGLRegion(glp, gl, null, shape);
+ region.addOutlineShape(shape, null, rgbaColor);
box.resize(shape.getBounds());
+ setRotationPivot( box.getCenter() );
}
@Override
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 13273488e..1880e42c7 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
@@ -29,6 +29,8 @@ package com.jogamp.opengl.demos.graph.ui.testshapes;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.ui.GraphShape;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLProfile;
/**
* GPU based resolution independent test object
@@ -42,7 +44,7 @@ public class Glyph04FreeSans_0 extends GraphShape {
}
@Override
- protected void addShapeToRegion() {
+ protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
final OutlineShape shape = new OutlineShape();
// Start TTF Shape for Glyph 19
@@ -126,9 +128,11 @@ public class Glyph04FreeSans_0 extends GraphShape {
shape.setIsQuadraticNurbs();
shape.setSharpness(oshapeSharpness);
- region.addOutlineShape(shape, null, rgbaColor);
+ updateGLRegion(glp, gl, null, shape);
+ region.addOutlineShape(shape, null, rgbaColor);
box.resize(shape.getBounds());
+ setRotationPivot( box.getCenter() );
}
@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 8e858be16..fe8d1440b 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
@@ -29,6 +29,8 @@ package com.jogamp.opengl.demos.graph.ui.testshapes;
import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.graph.ui.GraphShape;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLProfile;
/**
* GPU based resolution independent test object
@@ -42,7 +44,7 @@ public class Glyph05FreeSerifBoldItalic_ae extends GraphShape {
}
@Override
- protected void addShapeToRegion() {
+ protected void addShapeToRegion(final GLProfile glp, final GL2ES2 gl) {
final OutlineShape shape = new OutlineShape();
// Start TTF Shape for Glyph 168
@@ -263,9 +265,11 @@ public class Glyph05FreeSerifBoldItalic_ae extends GraphShape {
shape.setIsQuadraticNurbs();
shape.setSharpness(oshapeSharpness);
- region.addOutlineShape(shape, null, rgbaColor);
+ updateGLRegion(glp, gl, null, shape);
+ region.addOutlineShape(shape, null, rgbaColor);
box.resize(shape.getBounds());
+ setRotationPivot( box.getCenter() );
}
@Override