mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-27 04:08:53 +01:00
opengl: Unexport BlendFunc
This commit is contained in:
parent
c9f49efd41
commit
57c8c089e9
@ -233,7 +233,6 @@ func (c *drawImageCommand) Exec(indexOffsetInBytes int) error {
|
|||||||
if err := c.dst.image.SetViewport(); err != nil {
|
if err := c.dst.image.SetViewport(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
opengl.GetContext().BlendFunc(c.mode)
|
|
||||||
|
|
||||||
if c.nindices == 0 {
|
if c.nindices == 0 {
|
||||||
return nil
|
return nil
|
||||||
@ -241,7 +240,7 @@ func (c *drawImageCommand) Exec(indexOffsetInBytes int) error {
|
|||||||
proj := c.dst.image.ProjectionMatrix()
|
proj := c.dst.image.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, dw, dh, sw, sh, c.color, c.filter)
|
opengl.UseProgram(c.mode, 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),
|
||||||
|
@ -102,7 +102,7 @@ func (c *Context) reset() error {
|
|||||||
gl.Enable(gl.BLEND)
|
gl.Enable(gl.BLEND)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
c.BlendFunc(graphics.CompositeModeSourceOver)
|
c.blendFunc(graphics.CompositeModeSourceOver)
|
||||||
_ = mainthread.Run(func() error {
|
_ = mainthread.Run(func() error {
|
||||||
f := int32(0)
|
f := int32(0)
|
||||||
gl.GetIntegerv(gl.FRAMEBUFFER_BINDING, &f)
|
gl.GetIntegerv(gl.FRAMEBUFFER_BINDING, &f)
|
||||||
@ -112,7 +112,7 @@ func (c *Context) reset() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) BlendFunc(mode graphics.CompositeMode) {
|
func (c *Context) blendFunc(mode graphics.CompositeMode) {
|
||||||
_ = mainthread.Run(func() error {
|
_ = mainthread.Run(func() error {
|
||||||
if c.lastCompositeMode == mode {
|
if c.lastCompositeMode == mode {
|
||||||
return nil
|
return nil
|
||||||
|
@ -158,13 +158,13 @@ func (c *Context) reset() error {
|
|||||||
c.ensureGL()
|
c.ensureGL()
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
gl.Call("enable", blend)
|
gl.Call("enable", blend)
|
||||||
c.BlendFunc(graphics.CompositeModeSourceOver)
|
c.blendFunc(graphics.CompositeModeSourceOver)
|
||||||
f := gl.Call("getParameter", framebufferBinding)
|
f := gl.Call("getParameter", framebufferBinding)
|
||||||
c.screenFramebuffer = framebufferNative(f)
|
c.screenFramebuffer = framebufferNative(f)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) BlendFunc(mode graphics.CompositeMode) {
|
func (c *Context) blendFunc(mode graphics.CompositeMode) {
|
||||||
if c.lastCompositeMode == mode {
|
if c.lastCompositeMode == mode {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -111,14 +111,14 @@ func (c *Context) reset() error {
|
|||||||
c.lastViewportHeight = 0
|
c.lastViewportHeight = 0
|
||||||
c.lastCompositeMode = graphics.CompositeModeUnknown
|
c.lastCompositeMode = graphics.CompositeModeUnknown
|
||||||
c.gl.Enable(mgl.BLEND)
|
c.gl.Enable(mgl.BLEND)
|
||||||
c.BlendFunc(graphics.CompositeModeSourceOver)
|
c.blendFunc(graphics.CompositeModeSourceOver)
|
||||||
f := c.gl.GetInteger(mgl.FRAMEBUFFER_BINDING)
|
f := c.gl.GetInteger(mgl.FRAMEBUFFER_BINDING)
|
||||||
c.screenFramebuffer = framebufferNative(mgl.Framebuffer{uint32(f)})
|
c.screenFramebuffer = framebufferNative(mgl.Framebuffer{uint32(f)})
|
||||||
// TODO: Need to update screenFramebufferWidth/Height?
|
// TODO: Need to update screenFramebufferWidth/Height?
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) BlendFunc(mode graphics.CompositeMode) {
|
func (c *Context) blendFunc(mode graphics.CompositeMode) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
if c.lastCompositeMode == mode {
|
if c.lastCompositeMode == mode {
|
||||||
return
|
return
|
||||||
|
@ -265,7 +265,8 @@ func BufferSubData(vertices []float32, indices []uint16) {
|
|||||||
c.elementArrayBufferSubData(indices)
|
c.elementArrayBufferSubData(indices)
|
||||||
}
|
}
|
||||||
|
|
||||||
func UseProgram(proj []float32, src *Image, dstW, dstH, srcW, srcH int, colorM *affine.ColorM, filter graphics.Filter) {
|
func UseProgram(mode graphics.CompositeMode, proj []float32, src *Image, dstW, dstH, srcW, srcH int, colorM *affine.ColorM, filter graphics.Filter) {
|
||||||
|
GetContext().blendFunc(mode)
|
||||||
theOpenGLState.useProgram(proj, src.textureNative, dstW, dstH, srcW, srcH, colorM, filter)
|
theOpenGLState.useProgram(proj, src.textureNative, dstW, dstH, srcW, srcH, colorM, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user