mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
Bug fix (#85): The limit of the size of vertices was wrong
This commit is contained in:
parent
f27ba0ea03
commit
cb26342b3d
@ -92,7 +92,7 @@ func (s Sprites) Src(i int) (x0, y0, x1, y1 int) {
|
||||
return s[i].Src()
|
||||
}
|
||||
|
||||
var sprites = make(Sprites, 2500)
|
||||
var sprites = make(Sprites, 10000)
|
||||
|
||||
func update(screen *ebiten.Image) error {
|
||||
sprites.Update()
|
||||
|
@ -58,9 +58,7 @@ func DrawTexture(c *opengl.Context, texture opengl.Texture, projectionMatrix *[4
|
||||
if quads.Len() == 0 {
|
||||
return nil
|
||||
}
|
||||
// TODO: Change this panic if image.DrawImage allows more than quadsMaxNum parts.
|
||||
// TODO: Kinder message
|
||||
if quadsMaxNum < 4*quads.Len() {
|
||||
if quadsMaxNum < quads.Len() {
|
||||
return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", quadsMaxNum))
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ var (
|
||||
programRect opengl.Program
|
||||
)
|
||||
|
||||
const quadsMaxNum = 10000
|
||||
const quadsMaxNum = 65536 / 6
|
||||
|
||||
func initialize(c *opengl.Context) error {
|
||||
const uint16Size = 2
|
||||
@ -63,7 +63,8 @@ func initialize(c *opengl.Context) error {
|
||||
}
|
||||
|
||||
const stride = 4 * 4
|
||||
c.NewBuffer(c.ArrayBuffer, stride*quadsMaxNum, c.DynamicDraw)
|
||||
const float32Size = 4
|
||||
c.NewBuffer(c.ArrayBuffer, float32Size*stride*quadsMaxNum, c.DynamicDraw)
|
||||
|
||||
indices := make([]uint16, 6*quadsMaxNum)
|
||||
for i := uint16(0); i < quadsMaxNum; i++ {
|
||||
|
@ -267,7 +267,6 @@ func (c *Context) NewBuffer(bufferType BufferType, v interface{}, bufferUsageTyp
|
||||
|
||||
func (c *Context) BufferSubData(bufferType BufferType, data []float32) {
|
||||
gl := c.gl
|
||||
const float32Size = 4
|
||||
gl.BufferSubData(int(bufferType), 0, data)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user