TextureLoadOptions+fix DT bug+remove SetAttribute

This commit is contained in:
bloeys
2022-07-02 21:38:48 +04:00
parent e1bf0697fc
commit 51057b8a0d
6 changed files with 45 additions and 39 deletions

View File

@ -3,7 +3,6 @@ package materials
import (
"github.com/bloeys/gglm/gglm"
"github.com/bloeys/nmage/asserts"
"github.com/bloeys/nmage/buffers"
"github.com/bloeys/nmage/logging"
"github.com/bloeys/nmage/shaders"
"github.com/go-gl/gl/v4.1-core/gl"
@ -61,23 +60,6 @@ func (m *Material) GetUnifLoc(uniformName string) int32 {
return loc
}
func (m *Material) SetAttribute(bufObj buffers.Buffer) {
bufObj.Bind()
//NOTE: VBOs are only bound at 'VertexAttribPointer', not BindBUffer, so we need to bind the buffer and vao here
gl.BindBuffer(gl.ARRAY_BUFFER, bufObj.BufID)
layout := bufObj.GetLayout()
for i := 0; i < len(layout); i++ {
gl.EnableVertexAttribArray(uint32(i))
gl.VertexAttribPointer(uint32(i), layout[i].ElementType.CompCount(), layout[i].ElementType.GLType(), false, bufObj.Stride, gl.PtrOffset(layout[i].Offset))
}
bufObj.UnBind()
gl.BindBuffer(gl.ARRAY_BUFFER, 0)
}
func (m *Material) EnableAttribute(attribName string) {
gl.EnableVertexAttribArray(uint32(m.GetAttribLoc(attribName)))
}