minor change
This commit is contained in:
parent
8ec1bdfadf
commit
71e26e12a6
32
window.go
32
window.go
|
@ -395,6 +395,22 @@ func (wt *windowTriangles) Draw() {
|
|||
})
|
||||
}
|
||||
|
||||
func (wt *windowTriangles) resize(len int) {
|
||||
if len > wt.Len() {
|
||||
newData := make([]pixelgl.VertexData, len-wt.Len())
|
||||
// default values
|
||||
for i := range newData {
|
||||
newData[i] = make(pixelgl.VertexData)
|
||||
newData[i][colorVec4] = mgl32.Vec4{1, 1, 1, 1}
|
||||
newData[i][textureVec2] = mgl32.Vec2{-1, -1}
|
||||
}
|
||||
wt.data = append(wt.data, newData...)
|
||||
}
|
||||
if len < wt.Len() {
|
||||
wt.data = wt.data[:len]
|
||||
}
|
||||
}
|
||||
|
||||
func (wt *windowTriangles) updateData(offset int, t Triangles) {
|
||||
if t, ok := t.(TrianglesPosition); ok {
|
||||
for i := offset; i < offset+t.Len(); i++ {
|
||||
|
@ -427,22 +443,6 @@ func (wt *windowTriangles) updateData(offset int, t Triangles) {
|
|||
}
|
||||
}
|
||||
|
||||
func (wt *windowTriangles) resize(len int) {
|
||||
if len > wt.Len() {
|
||||
newData := make([]pixelgl.VertexData, len-wt.Len())
|
||||
// default values
|
||||
for i := range newData {
|
||||
newData[i] = make(pixelgl.VertexData)
|
||||
newData[i][colorVec4] = mgl32.Vec4{1, 1, 1, 1}
|
||||
newData[i][textureVec2] = mgl32.Vec2{-1, -1}
|
||||
}
|
||||
wt.data = append(wt.data, newData...)
|
||||
}
|
||||
if len < wt.Len() {
|
||||
wt.data = wt.data[:len]
|
||||
}
|
||||
}
|
||||
|
||||
func (wt *windowTriangles) submitData() {
|
||||
data := wt.data // avoid race condition
|
||||
pixelgl.DoNoBlock(func() {
|
||||
|
|
Loading…
Reference in New Issue