Example #1
0
func (r *GoRect) Paint(p *qml.Painter) {
	obj := p.Object()

	width := gl.Float(obj.Int("width"))
	height := gl.Float(obj.Int("height"))

	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
	gl.Color4f(1.0, 1.0, 1.0, 0.8)
	gl.Begin(gl.QUADS)
	gl.Vertex2f(0, 0)
	gl.Vertex2f(width, 0)
	gl.Vertex2f(width, height)
	gl.Vertex2f(0, height)
	gl.End()

	gl.LineWidth(2.5)
	gl.Color4f(0.0, 0.0, 0.0, 1.0)
	gl.Begin(gl.LINES)
	gl.Vertex2f(0, 0)
	gl.Vertex2f(width, height)
	gl.Vertex2f(width, 0)
	gl.Vertex2f(0, height)
	gl.End()
}
Example #2
0
func (r *GoRect) Paint(p *qml.Painter) {
	r.PaintCount++

	obj := p.Object()

	width := gl.Float(obj.Int("width"))
	height := gl.Float(obj.Int("height"))

	gl.Color3f(1.0, 0.0, 0.0)
	gl.Begin(gl.QUADS)
	gl.Vertex2f(0, 0)
	gl.Vertex2f(width, 0)
	gl.Vertex2f(width, height)
	gl.Vertex2f(0, height)
	gl.End()
}