Day7: ImGUI interaction+OpenGL 4.1+Bugs+ambient color control

This commit is contained in:
bloeys
2021-11-20 21:39:49 +04:00
parent 3164e4bba4
commit 616daaf97d
10 changed files with 171 additions and 51 deletions

View File

@ -4,7 +4,7 @@ import (
"github.com/bloeys/gglm/gglm"
"github.com/bloeys/go-sdl-engine/buffers"
"github.com/bloeys/go-sdl-engine/logging"
"github.com/go-gl/gl/v4.6-core/gl"
"github.com/go-gl/gl/v4.1-core/gl"
)
type ShaderProgram struct {
@ -70,6 +70,11 @@ func (sp *ShaderProgram) DisableAttribute(attribName string) {
gl.DisableVertexAttribArray(uint32(sp.GetAttribLoc(attribName)))
}
func (sp *ShaderProgram) SetUnifFloat32(uniformName string, val float32) {
loc := gl.GetUniformLocation(sp.ID, gl.Str(uniformName+"\x00"))
gl.ProgramUniform1f(sp.ID, loc, val)
}
func (sp *ShaderProgram) SetUnifVec2(uniformName string, vec2 *gglm.Vec2) {
loc := gl.GetUniformLocation(sp.ID, gl.Str(uniformName+"\x00"))
gl.ProgramUniform2fv(sp.ID, loc, 1, &vec2.Data[0])