diff --git a/internal/painter/gl/draw.go b/internal/painter/gl/draw.go index 43a890221b..f0ebd5e0fd 100644 --- a/internal/painter/gl/draw.go +++ b/internal/painter/gl/draw.go @@ -235,15 +235,15 @@ func (p *painter) drawSingleChannelTexture(o fyne.CanvasObject, creator func(can } points := p.rectCoords(size, pos, frame, canvas.ImageFillStretch, 0, pad) - p.ctx.UseProgram(p.grayProgram) + p.ctx.UseProgram(p.singleChannelProgram) vbo := p.createBuffer(points) - p.defineVertexArray(p.grayProgram, "vert", 3, 5, 0) - p.defineVertexArray(p.grayProgram, "vertTexCoord", 2, 5, 3) + p.defineVertexArray(p.singleChannelProgram, "vert", 3, 5, 0) + p.defineVertexArray(p.singleChannelProgram, "vertTexCoord", 2, 5, 3) p.ctx.BlendFunc(srcAlpha, oneMinusSrcAlpha) p.logError() - shaderColor := p.ctx.GetUniformLocation(p.grayProgram, "color") + shaderColor := p.ctx.GetUniformLocation(p.singleChannelProgram, "color") r, g, b, a := getFragmentColor(c) p.ctx.Uniform4f(shaderColor, r, g, b, a) diff --git a/internal/painter/gl/gl_core.go b/internal/painter/gl/gl_core.go index 9c8b18eb50..443892fdf4 100644 --- a/internal/painter/gl/gl_core.go +++ b/internal/painter/gl/gl_core.go @@ -74,7 +74,7 @@ func (p *painter) Init() { gl.Enable(gl.BLEND) p.logError() p.program = p.createProgram("simple") - p.grayProgram = p.createProgram("gray") + p.singleChannelProgram = p.createProgram("single_channel") p.lineProgram = p.createProgram("line") p.rectangleProgram = p.createProgram("rectangle") p.roundRectangleProgram = p.createProgram("round_rectangle") diff --git a/internal/painter/gl/gl_es.go b/internal/painter/gl/gl_es.go index f6072d47ef..1c5df0ad4d 100644 --- a/internal/painter/gl/gl_es.go +++ b/internal/painter/gl/gl_es.go @@ -81,7 +81,7 @@ func (p *painter) Init() { gl.Enable(gl.BLEND) p.logError() p.program = p.createProgram("simple_es") - p.grayProgram = p.createProgram("gray_es") + p.singleChannelProgram = p.createProgram("single_channel_es") p.lineProgram = p.createProgram("line_es") p.rectangleProgram = p.createProgram("rectangle_es") p.roundRectangleProgram = p.createProgram("round_rectangle_es") diff --git a/internal/painter/gl/gl_gomobile.go b/internal/painter/gl/gl_gomobile.go index d2ac00d1df..74b1d740f8 100644 --- a/internal/painter/gl/gl_gomobile.go +++ b/internal/painter/gl/gl_gomobile.go @@ -71,7 +71,7 @@ func (p *painter) Init() { p.glctx().Disable(gl.DepthTest) p.glctx().Enable(gl.Blend) p.program = p.createProgram("simple_es") - p.grayProgram = p.createProgram("gray_es") + p.singleChannelProgram = p.createProgram("single_channel_es") p.lineProgram = p.createProgram("line_es") p.rectangleProgram = p.createProgram("rectangle_es") p.roundRectangleProgram = p.createProgram("round_rectangle_es") diff --git a/internal/painter/gl/gl_goxjs.go b/internal/painter/gl/gl_goxjs.go index 6647272cd3..7fbd9b2052 100644 --- a/internal/painter/gl/gl_goxjs.go +++ b/internal/painter/gl/gl_goxjs.go @@ -66,7 +66,7 @@ func (p *painter) Init() { gl.Enable(gl.BLEND) p.logError() p.program = p.createProgram("simple_es") - p.grayProgram = p.createProgram("gray_es") + p.singleChannelProgram = p.createProgram("single_channel_es") p.lineProgram = p.createProgram("line_es") p.rectangleProgram = p.createProgram("rectangle_es") p.roundRectangleProgram = p.createProgram("round_rectangle_es") diff --git a/internal/painter/gl/painter.go b/internal/painter/gl/painter.go index e95c6880dd..0de1245850 100644 --- a/internal/painter/gl/painter.go +++ b/internal/painter/gl/painter.go @@ -20,10 +20,10 @@ func shaderSourceNamed(name string) ([]byte, []byte) { return shaderSimpleVert.StaticContent, shaderSimpleFrag.StaticContent case "simple_es": return shaderSimpleesVert.StaticContent, shaderSimpleesFrag.StaticContent - case "gray": - return shaderSimpleVert.StaticContent, shaderGrayFrag.StaticContent - case "gray_es": - return shaderSimpleesVert.StaticContent, shaderGrayesFrag.StaticContent + case "single_channel": + return shaderSimpleVert.StaticContent, shaderSinglechannelFrag.StaticContent + case "single_channel_es": + return shaderSimpleesVert.StaticContent, shaderSinglechannelesFrag.StaticContent case "rectangle": return shaderRectangleVert.StaticContent, shaderRectangleFrag.StaticContent case "round_rectangle": @@ -71,7 +71,7 @@ type painter struct { ctx context contextProvider driver.WithContext program Program - grayProgram Program + singleChannelProgram Program lineProgram Program rectangleProgram Program roundRectangleProgram Program diff --git a/internal/painter/gl/shaders.go b/internal/painter/gl/shaders.go index de1afdfd41..d4b6bfb427 100644 --- a/internal/painter/gl/shaders.go +++ b/internal/painter/gl/shaders.go @@ -5,16 +5,6 @@ package gl import "fyne.io/fyne/v2" -var shaderGrayFrag = &fyne.StaticResource{ - StaticName: "gray.frag", - StaticContent: []byte( - "#version 110\n\nuniform vec4 color;\n\nuniform sampler2D tex;\nvarying vec2 fragTexCoord;\n\nvoid main()\n{\n gl_FragColor = vec4(color.r, color.g, color.b, texture2D(tex, fragTexCoord).r*color.a);\n}\n"), -} -var shaderGrayesFrag = &fyne.StaticResource{ - StaticName: "gray_es.frag", - StaticContent: []byte( - "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nuniform vec4 color;\n\nuniform sampler2D tex;\nvarying vec2 fragTexCoord;\n\nvoid main()\n{\n gl_FragColor = vec4(color.r, color.g, color.b, texture2D(tex, fragTexCoord).r*color.a);\n}\n"), -} var shaderLineFrag = &fyne.StaticResource{ StaticName: "line.frag", StaticContent: []byte( @@ -85,3 +75,13 @@ var shaderSimpleesVert = &fyne.StaticResource{ StaticContent: []byte( "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nattribute vec3 vert;\nattribute vec2 vertTexCoord;\nvarying vec2 fragTexCoord;\n\nvoid main() {\n fragTexCoord = vertTexCoord;\n\n gl_Position = vec4(vert, 1);\n}"), } +var shaderSinglechannelFrag = &fyne.StaticResource{ + StaticName: "single_channel.frag", + StaticContent: []byte( + "#version 110\n\nuniform vec4 color;\n\nuniform sampler2D tex;\nvarying vec2 fragTexCoord;\n\nvoid main()\n{\n gl_FragColor = vec4(color.r, color.g, color.b, texture2D(tex, fragTexCoord).r*color.a);\n}\n"), +} +var shaderSinglechannelesFrag = &fyne.StaticResource{ + StaticName: "single_channel_es.frag", + StaticContent: []byte( + "#version 100\n\n#ifdef GL_ES\n# ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n# else\nprecision mediump float;\n#endif\nprecision mediump int;\nprecision lowp sampler2D;\n#endif\n\nuniform vec4 color;\n\nuniform sampler2D tex;\nvarying vec2 fragTexCoord;\n\nvoid main()\n{\n gl_FragColor = vec4(color.r, color.g, color.b, texture2D(tex, fragTexCoord).r*color.a);\n}\n"), +} diff --git a/internal/painter/gl/shaders/gray.frag b/internal/painter/gl/shaders/single_channel.frag similarity index 100% rename from internal/painter/gl/shaders/gray.frag rename to internal/painter/gl/shaders/single_channel.frag diff --git a/internal/painter/gl/shaders/gray_es.frag b/internal/painter/gl/shaders/single_channel_es.frag similarity index 100% rename from internal/painter/gl/shaders/gray_es.frag rename to internal/painter/gl/shaders/single_channel_es.frag