mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
opengl: Rename some functions not to be exported
This commit is contained in:
parent
ce9f957cd8
commit
3d79e086a9
@ -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 {
|
||||||
|
|
||||||
func (c *Context) GetUniformLocation(p Program, location string) UniformLocation {
|
|
||||||
// This is called only from Context method.
|
|
||||||
uniform := UniformLocation(gl.GetUniformLocation(uint32(p), gl.Str(location+"\x00")))
|
uniform := UniformLocation(gl.GetUniformLocation(uint32(p), gl.Str(location+"\x00")))
|
||||||
if uniform == -1 {
|
if uniform == -1 {
|
||||||
panic("opengl: invalid uniform location: " + location)
|
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 {
|
||||||
|
|
||||||
func (c *Context) GetAttribLocation(p Program, location string) AttribLocation {
|
|
||||||
// This is called only from Context method.
|
|
||||||
attrib := AttribLocation(gl.GetAttribLocation(uint32(p), gl.Str(location+"\x00")))
|
attrib := AttribLocation(gl.GetAttribLocation(uint32(p), gl.Str(location+"\x00")))
|
||||||
if attrib == -1 {
|
if attrib == -1 {
|
||||||
panic("invalid attrib location: " + location)
|
panic("invalid attrib location: " + location)
|
||||||
|
@ -290,7 +290,7 @@ func (c *Context) UseProgram(p Program) {
|
|||||||
gl.UseProgram(p.Object)
|
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
|
gl := c.gl
|
||||||
return UniformLocation{gl.GetUniformLocation(p.Object, location)}
|
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
|
gl := c.gl
|
||||||
return AttribLocation(gl.GetAttribLocation(p.Object, location))
|
return AttribLocation(gl.GetAttribLocation(p.Object, location))
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ func (c *Context) UseProgram(p Program) {
|
|||||||
gl.UseProgram(mgl.Program(p))
|
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))
|
u := UniformLocation(gl.GetUniformLocation(mgl.Program(p), location))
|
||||||
if u.Value == -1 {
|
if u.Value == -1 {
|
||||||
panic("invalid uniform location: " + location)
|
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))
|
a := AttribLocation(gl.GetAttribLocation(mgl.Program(p), location))
|
||||||
if a.Value == ^uint(0) {
|
if a.Value == ^uint(0) {
|
||||||
panic("invalid attrib location: " + location)
|
panic("invalid attrib location: " + location)
|
||||||
|
@ -20,7 +20,7 @@ var uniformLocationCache = map[ProgramID]map[string]UniformLocation{}
|
|||||||
var attribLocationCache = map[ProgramID]map[string]AttribLocation{}
|
var attribLocationCache = map[ProgramID]map[string]AttribLocation{}
|
||||||
|
|
||||||
type UniformLocationGetter interface {
|
type UniformLocationGetter interface {
|
||||||
GetUniformLocation(p Program, location string) UniformLocation
|
getUniformLocation(p Program, location string) UniformLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Rename these functions not to be confusing
|
// 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]
|
l, ok := uniformLocationCache[id][location]
|
||||||
if !ok {
|
if !ok {
|
||||||
l = g.GetUniformLocation(p, location)
|
l = g.getUniformLocation(p, location)
|
||||||
uniformLocationCache[id][location] = l
|
uniformLocationCache[id][location] = l
|
||||||
}
|
}
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
type AttribLocationGetter interface {
|
type AttribLocationGetter interface {
|
||||||
GetAttribLocation(p Program, location string) AttribLocation
|
getAttribLocation(p Program, location string) AttribLocation
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAttribLocation(g AttribLocationGetter, 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]
|
l, ok := attribLocationCache[id][location]
|
||||||
if !ok {
|
if !ok {
|
||||||
l = g.GetAttribLocation(p, location)
|
l = g.getAttribLocation(p, location)
|
||||||
attribLocationCache[id][location] = l
|
attribLocationCache[id][location] = l
|
||||||
}
|
}
|
||||||
return l
|
return l
|
||||||
|
Loading…
Reference in New Issue
Block a user