Esempio n. 1
0
func (this *Image) VertexData() *Opengl.OpenGLVertexInfo {
	v := Opengl.OpenGLVertexInfo{}

	w := float32(this.Bounds().Dx())
	h := float32(this.Bounds().Dy())

	// first tri
	idx := v.NewVertex(-0.5*w, -0.5*h, 1.0)
	v.SetUV(idx, this.uvs[0], this.uvs[1])
	v.SetAggregateId(idx, this.aggrId)

	idx = v.NewVertex(0.5*w, -0.5*h, 1.0)
	v.SetUV(idx, this.uvs[2], this.uvs[3])
	v.SetAggregateId(idx, this.aggrId)

	idx = v.NewVertex(-0.5*w, 0.5*h, 1.0)
	v.SetUV(idx, this.uvs[6], this.uvs[7])
	v.SetAggregateId(idx, this.aggrId)

	// second tri
	idx = v.NewVertex(-0.5*w, 0.5*h, 1.0)
	v.SetUV(idx, this.uvs[6], this.uvs[7])
	v.SetAggregateId(idx, this.aggrId)

	idx = v.NewVertex(0.5*w, -0.5*h, 1.0)
	v.SetUV(idx, this.uvs[2], this.uvs[3])
	v.SetAggregateId(idx, this.aggrId)

	idx = v.NewVertex(0.5*w, 0.5*h, 1.0)
	v.SetUV(idx, this.uvs[4], this.uvs[5])
	v.SetAggregateId(idx, this.aggrId)

	return &v
}