opengl: Unexport ProgramID

This commit is contained in:
Hajime Hoshi 2016-02-27 02:41:38 +09:00
parent 495d7ca0d1
commit 2bda89709f
4 changed files with 15 additions and 15 deletions

View File

@ -40,10 +40,10 @@ func (p Program) Equals(other Program) bool {
type UniformLocation int32
type AttribLocation int32
type ProgramID uint32
type programID uint32
func (p Program) ID() ProgramID {
return ProgramID(p)
func (p Program) id() programID {
return programID(p)
}
type context struct {

View File

@ -56,10 +56,10 @@ type UniformLocation struct {
type AttribLocation int
type ProgramID int
type programID int
func (p Program) ID() ProgramID {
return ProgramID(p.Get("__ebiten_programId").Int())
func (p Program) id() programID {
return programID(p.Get("__ebiten_programId").Int())
}
type context struct {
@ -264,7 +264,7 @@ func (c *Context) GlslHighpSupported() bool {
return gl.Call("getShaderPrecisionFormat", gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).Get("precision").Int() != 0
}
var lastProgramID ProgramID = 0
var lastProgramID programID = 0
func (c *Context) NewProgram(shaders []Shader) (Program, error) {
gl := c.gl

View File

@ -41,10 +41,10 @@ func (p Program) Equals(other Program) bool {
type UniformLocation mgl.Uniform
type AttribLocation mgl.Attrib
type ProgramID uint32
type programID uint32
func (p Program) ID() ProgramID {
return ProgramID(p.Value)
func (p Program) id() programID {
return programID(p.Value)
}
type context struct {

View File

@ -14,10 +14,10 @@
package opengl
// Since js.Object (Program) can't be keys of a map, use integers (ProgramID) instead.
// Since js.Object (Program) can't be keys of a map, use integers (programID) instead.
var uniformLocationCache = map[ProgramID]map[string]UniformLocation{}
var attribLocationCache = map[ProgramID]map[string]AttribLocation{}
var uniformLocationCache = map[programID]map[string]UniformLocation{}
var attribLocationCache = map[programID]map[string]AttribLocation{}
type UniformLocationGetter interface {
getUniformLocation(p Program, location string) UniformLocation
@ -26,7 +26,7 @@ type UniformLocationGetter interface {
// TODO: Rename these functions not to be confusing
func GetUniformLocation(g UniformLocationGetter, p Program, location string) UniformLocation {
id := p.ID()
id := p.id()
if _, ok := uniformLocationCache[id]; !ok {
uniformLocationCache[id] = map[string]UniformLocation{}
}
@ -43,7 +43,7 @@ type AttribLocationGetter interface {
}
func GetAttribLocation(g AttribLocationGetter, p Program, location string) AttribLocation {
id := p.ID()
id := p.id()
if _, ok := attribLocationCache[id]; !ok {
attribLocationCache[id] = map[string]AttribLocation{}
}