diff --git a/internal/graphics/opengl/context_desktop.go b/internal/graphics/opengl/context_desktop.go index 88ae0140c..66783ca6e 100644 --- a/internal/graphics/opengl/context_desktop.go +++ b/internal/graphics/opengl/context_desktop.go @@ -312,10 +312,7 @@ func (c *Context) UseProgram(p Program) { }) } -// TODO: This should be unexported method. - -func (c *Context) GetUniformLocation(p Program, location string) UniformLocation { - // This is called only from Context method. +func (c *Context) getUniformLocation(p Program, location string) UniformLocation { uniform := UniformLocation(gl.GetUniformLocation(uint32(p), gl.Str(location+"\x00"))) if uniform == -1 { panic("opengl: invalid uniform location: " + location) @@ -344,10 +341,7 @@ func (c *Context) UniformFloats(p Program, location string, v []float32) { }) } -// TODO: This should be unexported method. - -func (c *Context) GetAttribLocation(p Program, location string) AttribLocation { - // This is called only from Context method. +func (c *Context) getAttribLocation(p Program, location string) AttribLocation { attrib := AttribLocation(gl.GetAttribLocation(uint32(p), gl.Str(location+"\x00"))) if attrib == -1 { panic("invalid attrib location: " + location) diff --git a/internal/graphics/opengl/context_js.go b/internal/graphics/opengl/context_js.go index b2d9daba4..0283021bb 100644 --- a/internal/graphics/opengl/context_js.go +++ b/internal/graphics/opengl/context_js.go @@ -290,7 +290,7 @@ func (c *Context) UseProgram(p Program) { gl.UseProgram(p.Object) } -func (c *Context) GetUniformLocation(p Program, location string) UniformLocation { +func (c *Context) getUniformLocation(p Program, location string) UniformLocation { gl := c.gl return UniformLocation{gl.GetUniformLocation(p.Object, location)} } @@ -314,7 +314,7 @@ func (c *Context) UniformFloats(p Program, location string, v []float32) { } } -func (c *Context) GetAttribLocation(p Program, location string) AttribLocation { +func (c *Context) getAttribLocation(p Program, location string) AttribLocation { gl := c.gl return AttribLocation(gl.GetAttribLocation(p.Object, location)) } diff --git a/internal/graphics/opengl/context_mobile.go b/internal/graphics/opengl/context_mobile.go index 35cf304c4..ebcd485bb 100644 --- a/internal/graphics/opengl/context_mobile.go +++ b/internal/graphics/opengl/context_mobile.go @@ -250,7 +250,7 @@ func (c *Context) UseProgram(p Program) { gl.UseProgram(mgl.Program(p)) } -func (c *Context) GetUniformLocation(p Program, location string) UniformLocation { +func (c *Context) getUniformLocation(p Program, location string) UniformLocation { u := UniformLocation(gl.GetUniformLocation(mgl.Program(p), location)) if u.Value == -1 { panic("invalid uniform location: " + location) @@ -274,7 +274,7 @@ func (c *Context) UniformFloats(p Program, location string, v []float32) { } } -func (c *Context) GetAttribLocation(p Program, location string) AttribLocation { +func (c *Context) getAttribLocation(p Program, location string) AttribLocation { a := AttribLocation(gl.GetAttribLocation(mgl.Program(p), location)) if a.Value == ^uint(0) { panic("invalid attrib location: " + location) diff --git a/internal/graphics/opengl/locationcache.go b/internal/graphics/opengl/locationcache.go index f553b27e0..758203650 100644 --- a/internal/graphics/opengl/locationcache.go +++ b/internal/graphics/opengl/locationcache.go @@ -20,7 +20,7 @@ var uniformLocationCache = map[ProgramID]map[string]UniformLocation{} var attribLocationCache = map[ProgramID]map[string]AttribLocation{} type UniformLocationGetter interface { - GetUniformLocation(p Program, location string) UniformLocation + getUniformLocation(p Program, location string) UniformLocation } // TODO: Rename these functions not to be confusing @@ -32,14 +32,14 @@ func GetUniformLocation(g UniformLocationGetter, p Program, location string) Uni } l, ok := uniformLocationCache[id][location] if !ok { - l = g.GetUniformLocation(p, location) + l = g.getUniformLocation(p, location) uniformLocationCache[id][location] = l } return l } type AttribLocationGetter interface { - GetAttribLocation(p Program, location string) AttribLocation + getAttribLocation(p Program, location string) AttribLocation } func GetAttribLocation(g AttribLocationGetter, p Program, location string) AttribLocation { @@ -49,7 +49,7 @@ func GetAttribLocation(g AttribLocationGetter, p Program, location string) Attri } l, ok := attribLocationCache[id][location] if !ok { - l = g.GetAttribLocation(p, location) + l = g.getAttribLocation(p, location) attribLocationCache[id][location] = l } return l