mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
Refactoring: gl bug fix
This commit is contained in:
parent
325e05259a
commit
4a07c6f0df
@ -16,7 +16,6 @@ package shader
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-gl/gl"
|
"github.com/go-gl/gl"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func glMatrix(m [4][4]float64) [16]float32 {
|
func glMatrix(m [4][4]float64) [16]float32 {
|
||||||
@ -87,11 +86,8 @@ func DrawTexture(native gl.Texture, projectionMatrix [4][4]float64, quads []Text
|
|||||||
vertexAttrLocation.DisableArray()
|
vertexAttrLocation.DisableArray()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// TODO: Fix this dirty hack after fixing https://github.com/go-gl/gl/issues/174
|
vertexAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, uintptr(short32Size*0))
|
||||||
v := (*int)(unsafe.Pointer(uintptr(short32Size * 0)))
|
texCoordAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, uintptr(short32Size*2))
|
||||||
t := (*int)(unsafe.Pointer(uintptr(short32Size * 2)))
|
|
||||||
vertexAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, v)
|
|
||||||
texCoordAttrLocation.AttribPointer(2, gl.FLOAT, false, stride, t)
|
|
||||||
|
|
||||||
vertices := []float32{}
|
vertices := []float32{}
|
||||||
for _, quad := range quads {
|
for _, quad := range quads {
|
||||||
@ -111,8 +107,7 @@ func DrawTexture(native gl.Texture, projectionMatrix [4][4]float64, quads []Text
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
gl.BufferSubData(gl.ARRAY_BUFFER, 0, short32Size*len(vertices), vertices)
|
gl.BufferSubData(gl.ARRAY_BUFFER, 0, short32Size*len(vertices), vertices)
|
||||||
// TODO: Pass 0 after fixing the gl bug
|
gl.DrawElements(gl.TRIANGLES, 6*len(quads), gl.UNSIGNED_SHORT, uintptr(0))
|
||||||
gl.DrawElements(gl.TRIANGLES, 6*len(quads), gl.UNSIGNED_SHORT, nil)
|
|
||||||
|
|
||||||
gl.Flush()
|
gl.Flush()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user