graphicsutil: Remove dependency on opengl

This commit is contained in:
Hajime Hoshi 2018-10-28 22:01:59 +09:00
parent ff54d3b681
commit fde9fd2d0e
2 changed files with 5 additions and 6 deletions

View File

@ -127,7 +127,7 @@ func (q *commandQueue) EnqueueDrawImageCommand(dst, src *Image, vertices []float
q.appendVertices(vertices)
q.appendIndices(indices, uint16(q.nextIndex))
q.nextIndex += len(vertices) * opengl.Float.SizeInBytes() / VertexSizeInBytes()
q.nextIndex += len(vertices) * opengl.Float.SizeInBytes() / theArrayBufferLayout.totalBytes()
q.tmpNumIndices += len(indices)
q.doEnqueueDrawImageCommand(dst, src, len(vertices), len(indices), color, mode, filter, split)
@ -225,9 +225,9 @@ type drawImageCommand struct {
filter graphics.Filter
}
// VertexSizeInBytes returns the size in bytes of one vertex.
func VertexSizeInBytes() int {
return theArrayBufferLayout.totalBytes()
// VertexFloatNum returns the number of floats for one vertex.
func VertexFloatNum() int {
return theArrayBufferLayout.totalBytes() / opengl.Float.SizeInBytes()
}
func (c *drawImageCommand) String() string {

View File

@ -16,7 +16,6 @@ package graphicsutil
import (
"github.com/hajimehoshi/ebiten/internal/graphicscommand"
"github.com/hajimehoshi/ebiten/internal/opengl"
)
var (
@ -30,7 +29,7 @@ type verticesBackend struct {
func (v *verticesBackend) sliceForOneQuad() []float32 {
const num = 256
size := 4 * graphicscommand.VertexSizeInBytes() / opengl.Float.SizeInBytes()
size := 4 * graphicscommand.VertexFloatNum()
if v.backend == nil {
v.backend = make([]float32, size*num)
}