opengl: Fix argument order of VertexAttribPointer

This commit is contained in:
Hajime Hoshi 2016-10-22 14:00:45 +09:00
parent 80e3a3497c
commit e5e9b178ae
4 changed files with 6 additions and 7 deletions

View File

@ -432,7 +432,7 @@ func (c *Context) getAttribLocationImpl(p Program, location string) attribLocati
return attrib
}
func (c *Context) VertexAttribPointer(p Program, location string, normalize bool, stride int, size int, offset int) {
func (c *Context) VertexAttribPointer(p Program, location string, size int, normalize bool, stride int, offset int) {
_ = c.runOnContextThread(func() error {
l := c.locationCache.GetAttribLocation(c, p, location)
gl.VertexAttribPointer(uint32(l), int32(size), gl.SHORT, normalize, int32(stride), gl.PtrOffset(offset))

View File

@ -354,7 +354,7 @@ func (c *Context) getAttribLocationImpl(p Program, location string) attribLocati
return attribLocation(gl.GetAttribLocation(p.Object, location))
}
func (c *Context) VertexAttribPointer(p Program, location string, normalize bool, stride int, size int, offset int) {
func (c *Context) VertexAttribPointer(p Program, location string, size int, normalize bool, stride int, offset int) {
gl := c.gl
l := c.locationCache.GetAttribLocation(c, p, location)
gl.VertexAttribPointer(int(l), size, gl.SHORT, normalize, stride, offset)

View File

@ -336,7 +336,7 @@ func (c *Context) getAttribLocationImpl(p Program, location string) attribLocati
return a
}
func (c *Context) VertexAttribPointer(p Program, location string, normalize bool, stride int, size int, offset int) {
func (c *Context) VertexAttribPointer(p Program, location string, size int, normalize bool, stride int, offset int) {
gl := c.gl
l := c.locationCache.GetAttribLocation(c, p, location)
gl.VertexAttribPointer(mgl.Attrib(l), size, mgl.SHORT, normalize, stride, offset)

View File

@ -49,10 +49,9 @@ func (a *arrayBufferLayout) enable(c *opengl.Context, program opengl.Program) {
}
offset := 0
for _, p := range a.parts {
b := p.unit * p.num
// TODO: Argument order doesn't match with glVertexAttribPointer: Fix them.
c.VertexAttribPointer(program, p.name, p.normalize, total, b, offset)
offset += b
size := p.unit * p.num
c.VertexAttribPointer(program, p.name, size, p.normalize, total, offset)
offset += size
}
}