mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Hide MaxQuads
This commit is contained in:
parent
bc43614c25
commit
7a96f31b1f
@ -77,8 +77,8 @@ func (q *commandQueue) Flush(context *opengl.Context) error {
|
||||
}
|
||||
// NOTE: WebGL doesn't seem to have Check gl.MAX_ELEMENTS_VERTICES or gl.MAX_ELEMENTS_INDICES so far.
|
||||
// Let's use them to compare to len(quads) in the future.
|
||||
if MaxQuads < len(vertices)/16 {
|
||||
return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", MaxQuads))
|
||||
if maxQuads < len(vertices)/16 {
|
||||
return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", maxQuads))
|
||||
}
|
||||
numc := len(q.commands)
|
||||
for _, c := range q.commands {
|
||||
|
@ -42,7 +42,7 @@ var (
|
||||
|
||||
const (
|
||||
indicesNum = 1 << 16
|
||||
MaxQuads = indicesNum / 6
|
||||
maxQuads = indicesNum / 6
|
||||
)
|
||||
|
||||
// unsafe.SizeOf can't be used because unsafe doesn't work with GopherJS.
|
||||
@ -94,10 +94,10 @@ func (s *openGLState) reset(context *opengl.Context) error {
|
||||
}
|
||||
|
||||
const stride = 8 // (2 [vertices] + 2 [texels]) * 2 [sizeof(int16)/bytes]
|
||||
s.arrayBuffer = context.NewBuffer(opengl.ArrayBuffer, 4*stride*MaxQuads, opengl.DynamicDraw)
|
||||
s.arrayBuffer = context.NewBuffer(opengl.ArrayBuffer, 4*stride*maxQuads, opengl.DynamicDraw)
|
||||
|
||||
indices := make([]uint16, 6*MaxQuads)
|
||||
for i := uint16(0); i < MaxQuads; i++ {
|
||||
indices := make([]uint16, 6*maxQuads)
|
||||
for i := uint16(0); i < maxQuads; i++ {
|
||||
indices[6*i+0] = 4*i + 0
|
||||
indices[6*i+1] = 4*i + 1
|
||||
indices[6*i+2] = 4*i + 2
|
||||
|
Loading…
Reference in New Issue
Block a user