improve code readability

This commit is contained in:
faiface 2016-12-05 12:22:20 +01:00
parent 0b2b73ce4a
commit 30d301f4a0
3 changed files with 6 additions and 6 deletions

View File

@ -388,14 +388,14 @@ func (s *Shader) Do(sub func(Context)) {
sub(ctx.WithShader(s))
return
}
s.enabled = true
DoNoBlock(func() {
gl.UseProgram(s.program)
})
s.enabled = true
sub(ctx.WithShader(s))
s.enabled = false
DoNoBlock(func() {
gl.UseProgram(0)
})
s.enabled = false
})
}

View File

@ -68,14 +68,14 @@ func (t *Texture) Do(sub func(Context)) {
sub(ctx)
return
}
t.enabled = true
DoNoBlock(func() {
gl.BindTexture(gl.TEXTURE_2D, t.tex)
})
t.enabled = true
sub(ctx)
t.enabled = false
DoNoBlock(func() {
gl.BindTexture(gl.TEXTURE_2D, 0)
})
t.enabled = false
})
}

View File

@ -346,17 +346,17 @@ func (va *VertexArray) Do(sub func(Context)) {
sub(ctx)
return
}
va.enabled = true
DoNoBlock(func() {
gl.BindVertexArray(va.vao)
gl.BindBuffer(gl.ARRAY_BUFFER, va.vbo)
})
va.enabled = true
sub(ctx)
va.enabled = false
DoNoBlock(func() {
gl.DrawArrays(uint32(va.mode), 0, int32(va.count))
gl.BindBuffer(gl.ARRAY_BUFFER, 0)
gl.BindVertexArray(0)
})
va.enabled = false
})
}