Exemplo n.º 1
0
func onPaint() {
	if scene == nil {
		loadScene()
	}
	gl.ClearColor(1, 1, 1, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT)
	now := clock.Time(time.Since(startTime) * 60 / time.Second)
	eng.Render(scene, now, sz)
	debug.DrawFPS(sz)
}
Exemplo n.º 2
0
func onDraw(sz size.Event) {
	select {
	case <-determined:
		if ok {
			gl.ClearColor(0, 1, 0, 1)
		} else {
			gl.ClearColor(1, 0, 0, 1)
		}
	default:
		gl.ClearColor(0, 0, 0, 1)
	}
	gl.Clear(gl.COLOR_BUFFER_BIT)

	debug.DrawFPS(sz)
}
Exemplo n.º 3
0
func onPaint(sz size.Event) {
	gl.ClearColor(1, 0, 0, 1)
	gl.Clear(gl.COLOR_BUFFER_BIT)

	gl.UseProgram(program)

	green += 0.01
	if green > 1 {
		green = 0
	}
	gl.Uniform4f(color, 0, green, 0, 1)

	gl.Uniform2f(offset, touchX/float32(sz.WidthPx), touchY/float32(sz.HeightPx))

	gl.BindBuffer(gl.ARRAY_BUFFER, buf)
	gl.EnableVertexAttribArray(position)
	gl.VertexAttribPointer(position, coordsPerVertex, gl.FLOAT, false, 0, 0)
	gl.DrawArrays(gl.TRIANGLES, 0, vertexCount)
	gl.DisableVertexAttribArray(position)

	debug.DrawFPS(sz)
}