gpu/gl: fix offset calculation in DrawElements

The offset argument to DrawElements is in 16-bit shorts, while the
underlying DrawElements use byte offsets.

No users of DrawElements use a non-zero offset, so nothing changed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-20 20:50:01 +01:00
parent 646a767665
commit 5ba7854656
+3 -1
View File
@@ -274,7 +274,9 @@ func (b *Backend) SetBlend(enable bool) {
func (b *Backend) DrawElements(mode gpu.DrawMode, off, count int) {
b.prepareDraw()
b.funcs.DrawElements(toGLDrawMode(mode), count, UNSIGNED_SHORT, off)
// off is in 16-bit indices, but DrawElements take a byte offset.
byteOff := off * 2
b.funcs.DrawElements(toGLDrawMode(mode), count, UNSIGNED_SHORT, byteOff)
}
func (b *Backend) DrawArrays(mode gpu.DrawMode, off, count int) {