mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
graphics: Check the number of vertices
This commit is contained in:
parent
1ccdfd9a35
commit
aa83167e56
@ -49,10 +49,12 @@ func (q *commandQueue) Flush(context *opengl.Context) error {
|
|||||||
vertices = append(vertices, c.vertices...)
|
vertices = append(vertices, c.vertices...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Check if len(vertices) is too big
|
|
||||||
if 0 < len(vertices) {
|
if 0 < len(vertices) {
|
||||||
context.BufferSubData(context.ArrayBuffer, vertices)
|
context.BufferSubData(context.ArrayBuffer, vertices)
|
||||||
}
|
}
|
||||||
|
if MaxQuads < len(vertices)/16 {
|
||||||
|
return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", MaxQuads))
|
||||||
|
}
|
||||||
for _, c := range q.commands {
|
for _, c := range q.commands {
|
||||||
if err := c.Exec(context); err != nil {
|
if err := c.Exec(context); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -101,9 +103,6 @@ func (c *drawImageCommand) Exec(context *opengl.Context) error {
|
|||||||
if n == 0 {
|
if n == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if MaxQuads < n/16 {
|
|
||||||
return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", MaxQuads))
|
|
||||||
}
|
|
||||||
|
|
||||||
p := programContext{
|
p := programContext{
|
||||||
state: &theOpenGLState,
|
state: &theOpenGLState,
|
||||||
|
Loading…
Reference in New Issue
Block a user