opengl: Refactoring

This commit is contained in:
Hajime Hoshi 2018-11-04 18:49:22 +09:00
parent 7fbf9f652e
commit 95a925ec9a
2 changed files with 3 additions and 3 deletions

View File

@ -245,7 +245,7 @@ func (c *drawImageCommand) Exec(indexOffsetInBytes int) error {
proj := f.ProjectionMatrix() proj := f.ProjectionMatrix()
dw, dh := c.dst.Size() dw, dh := c.dst.Size()
sw, sh := c.src.Size() sw, sh := c.src.Size()
opengl.UseProgram(proj, c.src.image.Texture, dw, dh, sw, sh, c.color, c.filter) opengl.UseProgram(proj, c.src.image, dw, dh, sw, sh, c.color, c.filter)
opengl.GetContext().DrawElements(c.nindices, indexOffsetInBytes) opengl.GetContext().DrawElements(c.nindices, indexOffsetInBytes)
// glFlush() might be necessary at least on MacBook Pro (a smilar problem at #419), // glFlush() might be necessary at least on MacBook Pro (a smilar problem at #419),

View File

@ -266,8 +266,8 @@ func BufferSubData(vertices []float32, indices []uint16) {
c.elementArrayBufferSubData(indices) c.elementArrayBufferSubData(indices)
} }
func UseProgram(proj []float32, texture Texture, dstW, dstH, srcW, srcH int, colorM *affine.ColorM, filter graphics.Filter) { func UseProgram(proj []float32, src *Image, dstW, dstH, srcW, srcH int, colorM *affine.ColorM, filter graphics.Filter) {
theOpenGLState.useProgram(proj, texture, dstW, dstH, srcW, srcH, colorM, filter) theOpenGLState.useProgram(proj, src.Texture, dstW, dstH, srcW, srcH, colorM, filter)
} }
// useProgram uses the program (programTexture). // useProgram uses the program (programTexture).