mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
opengl: Fix argument order of VertexAttribPointer
This commit is contained in:
parent
80e3a3497c
commit
e5e9b178ae
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user