From de4767e90f752cb9804403fa4ac775394bb45324 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 1 Aug 2023 18:57:41 +0200 Subject: Graph Add {GLRegion, GraphShape}.setTextureUnit(int): Allowing to set texture unit after ctor --- src/graphui/classes/com/jogamp/graph/ui/GraphShape.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/graphui/classes/com/jogamp/graph') diff --git a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java index 7dccd41a0..f0329ad3c 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/GraphShape.java @@ -53,6 +53,7 @@ import com.jogamp.opengl.util.texture.TextureSequence; */ public abstract class GraphShape extends Shape { protected final int renderModes; + protected int pass2TexUnit = GLRegion.DEFAULT_TWO_PASS_TEXTURE_UNIT; protected GLRegion region = null; protected float oshapeSharpness = OutlineShape.DEFAULT_SHARPNESS; private int regionQuality = Region.MAX_QUALITY; @@ -83,6 +84,15 @@ public abstract class GraphShape extends Shape { } return this; } + + /** Set the 2nd pass texture unit. */ + public void setTextureUnit(final int pass2TexUnit) { + this.pass2TexUnit = pass2TexUnit; + if( null != region ) { + region.setTextureUnit(pass2TexUnit); + } + } + /** * Return the shape's Graph {@link Region}'s quality parameter. * @see #setQuality(int) @@ -178,10 +188,10 @@ public abstract class GraphShape extends Shape { indexCount += 24; } if( null == region ) { - region = GLRegion.create(glp, renderModes, colorTexSeq, vertexCount, indexCount); + region = GLRegion.create(glp, renderModes, colorTexSeq, pass2TexUnit, vertexCount, indexCount); } else if( null == gl ) { dirtyRegions.add(region); - region = GLRegion.create(glp, renderModes, colorTexSeq, vertexCount, indexCount); + region = GLRegion.create(glp, renderModes, colorTexSeq, pass2TexUnit, vertexCount, indexCount); } else { region.clear(gl); region.setBufferCapacity(vertexCount, indexCount); -- cgit v1.2.3