MCPcopy Create free account
hub / github.com/golang/mobile / onPaint

Function onPaint

example/basic/main.go:128–149  ·  view source on GitHub ↗
(glctx gl.Context, sz size.Event)

Source from the content-addressed store, hash-verified

126}
127
128func onPaint(glctx gl.Context, sz size.Event) {
129 glctx.ClearColor(1, 0, 0, 1)
130 glctx.Clear(gl.COLOR_BUFFER_BIT)
131
132 glctx.UseProgram(program)
133
134 green += 0.01
135 if green > 1 {
136 green = 0
137 }
138 glctx.Uniform4f(color, 0, green, 0, 1)
139
140 glctx.Uniform2f(offset, touchX/float32(sz.WidthPx), touchY/float32(sz.HeightPx))
141
142 glctx.BindBuffer(gl.ARRAY_BUFFER, buf)
143 glctx.EnableVertexAttribArray(position)
144 glctx.VertexAttribPointer(position, coordsPerVertex, gl.FLOAT, false, 0, 0)
145 glctx.DrawArrays(gl.TRIANGLES, 0, vertexCount)
146 glctx.DisableVertexAttribArray(position)
147
148 fps.Draw(sz)
149}
150
151var triangleData = f32.Bytes(binary.LittleEndian,
152 0.0, 0.4, 0.0, // top left

Callers 1

mainFunction · 0.70

Calls 11

ClearColorMethod · 0.65
ClearMethod · 0.65
UseProgramMethod · 0.65
Uniform4fMethod · 0.65
Uniform2fMethod · 0.65
BindBufferMethod · 0.65
VertexAttribPointerMethod · 0.65
DrawArraysMethod · 0.65
DrawMethod · 0.45

Tested by

no test coverage detected