From f8584748e33aab56780eca5cf7009a5a0d11991d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 15 Mar 2023 03:37:44 +0100 Subject: Graph: Make RenderState a composition of RegionRenderer, which also creates and destroys it. Dropping this also from user (complexity). --- .../com/jogamp/graph/curve/opengl/GLRegion.java | 2 +- .../jogamp/graph/curve/opengl/RegionRenderer.java | 126 ++++++++++++++++++--- .../com/jogamp/graph/curve/opengl/RenderState.java | 25 ++-- 3 files changed, 120 insertions(+), 33 deletions(-) (limited to 'src/jogl/classes/com/jogamp') 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 c8e9a0113..2ffa68be6 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -243,7 +243,7 @@ public abstract class GLRegion extends Region { * The alpha component shall be set to zero. * Note: If {@link GL#GL_BLEND blending} is enabled, the * {@link RegionRenderer} might need to be - * {@link RegionRenderer#create(RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) created} + * {@link RegionRenderer#create(Vertex.Factory, RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) created} * with the appropriate {@link RegionRenderer.GLCallback callbacks}. *

* @param matrix current {@link PMVMatrix}. 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 54deb9e4b..43a322a2d 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -1,5 +1,5 @@ /** - * Copyright 2010 JogAmp Community. All rights reserved. + * Copyright 2010-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -47,6 +47,8 @@ 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 @@ -60,13 +62,13 @@ import com.jogamp.graph.curve.Region; * At its {@link #destroy(GL2ES2) destruction}, all {@link ShaderProgram}s and its {@link RenderState} * will be destroyed and released. */ -public class RegionRenderer { +public final class RegionRenderer { protected static final boolean DEBUG = Region.DEBUG; protected static final boolean DEBUG_INSTANCE = Region.DEBUG_INSTANCE; /** * May be passed to - * {@link RegionRenderer#create(RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) RegionRenderer ctor}, + * {@link RegionRenderer#create(Vertex.Factory, RenderState, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback) RegionRenderer ctor}, * e.g. *