Skip to content

GLDrawSink

ClassChartGuruChartGuru
public class GLDrawSink : IChartDrawSink

ChartGuru.IChartDrawSink that forwards to GL immediate mode, preserving the exact behaviour of the pre-sink renderer. Owns the two shared materials the renderer previously held itself (Hidden/Internal-Colored and Hidden/ChartGuru/GL_AA) so the production uGUI ChartGuru.ChartGraphic path and the Scene ChartGuru.ChartComponent path stay bit-identical after the draw-sink refactor.

Typical lifecycle inside the renderer:

using (sink.BeginFrame(rect, scale))
{
    sink.Begin(DrawTopology.Triangles);
    sink.Color(fill);
    sink.Vertex(x0, y0); sink.Vertex(x1, y1); sink.Vertex(x2, y2);
    sink.End();
}

public static Material SharedGLMaterial { get; }

Returns (and lazily creates) the shared solid GL material used by this sink.

Returns

UnityEngine.Material — No return description is available.

public static Material SharedGLAAMaterial { get; }

Returns (and lazily creates) the shared anti-aliased GL material used by this sink.

Returns

UnityEngine.Material — No return description is available.

public GLDrawSink.FrameScope BeginFrame(Rect rect, float scale = 1)

Opens a render frame: pushes a pixel-mapped ortho matrix matching rect and returns a disposable that pops it on System.IDisposable.Dispose.

Parameters

Name Type Description
rect UnityEngine.Rect
scale System.Single

Returns

ChartGuru.GLDrawSink.FrameScope — No return description is available.

public void Begin(DrawTopology topology, DrawMaterial material = DrawMaterial.Standard)

Begins a primitive batch with the given topology and material bucket. Must be balanced with ChartGuru.IChartDrawSink.End before another ChartGuru.IChartDrawSink.Begin(ChartGuru.DrawTopology%2cChartGuru.DrawMaterial).

Parameters

Name Type Description
topology ChartGuru.DrawTopology
material ChartGuru.DrawMaterial
public void Color(Color c)

Sets the current vertex color. Applies to all subsequently emitted vertices until overridden.

Parameters

Name Type Description
c UnityEngine.Color
public void Vertex(float x, float y)

Emits a vertex at the specified chart-space pixel coordinate (Y up, bottom-left origin).

Parameters

Name Type Description
x System.Single
y System.Single
public void End()

Closes the current primitive batch started by ChartGuru.IChartDrawSink.Begin(ChartGuru.DrawTopology%2cChartGuru.DrawMaterial).

public void SetScissor(Rect? clipRectPixels)

Sets an axis-aligned scissor rectangle in pixel coordinates, or clears it when null. Intended for morph and inset panels; the GL sink translates this to an SRP scissor, the UI Toolkit sink to a clipping descendant or manual CPU-side clipping.

Parameters

Name Type Description
clipRectPixels System.Nullable{UnityEngine.Rect}
public void PushTransform(Matrix4x4 m)

Pushes a transform onto the sink’s matrix stack. Subsequent ChartGuru.IChartDrawSink.Vertex(System.Single%2cSystem.Single) calls are effectively multiplied by the top-of-stack matrix. Matches GL.PushMatrix + GL.MultMatrix(m).

Parameters

Name Type Description
m UnityEngine.Matrix4x4
public void PopTransform()

Pops the top matrix from the sink’s transform stack. Matches GL.PopMatrix.

public void Dispose()

No description is available for this member.