From c3e5e4fdb25c720207f6d8d6093b327512d08f11 Mon Sep 17 00:00:00 2001 From: Allen Ray <allentray125@gmail.com> Date: Sun, 21 Jun 2020 22:54:23 -0400 Subject: [PATCH] Moved triangle clipping to the proper location --- pixelgl/canvas.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pixelgl/canvas.go b/pixelgl/canvas.go index 5bc8437..ff60479 100644 --- a/pixelgl/canvas.go +++ b/pixelgl/canvas.go @@ -315,6 +315,10 @@ func (ct *canvasTriangles) draw(tex *glhf.Texture, bounds pixel.Rect) { ct.dst.shader.s.SetUniformAttr(loc, u.Value()) } + if clip, has := ct.ClipRect(); has { + gl.Scissor(int32(clip.Min.X), int32(clip.Min.Y), int32(clip.W()), int32(clip.H())) + } + if tex == nil { ct.vs.Begin() ct.vs.Draw() @@ -327,9 +331,6 @@ func (ct *canvasTriangles) draw(tex *glhf.Texture, bounds pixel.Rect) { } ct.vs.Begin() - if clip, has := ct.ClipRect(); has { - gl.Scissor(int32(clip.Min.X), int32(clip.Min.Y), int32(clip.W()), int32(clip.H())) - } ct.vs.Draw() ct.vs.End() -- GitLab