mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver/opengl: refactoring
This commit is contained in:
parent
1d9f1474e9
commit
37c5f53890
@ -23,22 +23,32 @@ import (
|
|||||||
|
|
||||||
type blendFactor int
|
type blendFactor int
|
||||||
|
|
||||||
|
const (
|
||||||
|
glDstAlpha blendFactor = 0x0304
|
||||||
|
glDstColor blendFactor = 0x0306
|
||||||
|
glOne blendFactor = 1
|
||||||
|
glOneMinusDstAlpha blendFactor = 0x0305
|
||||||
|
glOneMinusSrcAlpha blendFactor = 0x0303
|
||||||
|
glSrcAlpha blendFactor = 0x0302
|
||||||
|
glZero blendFactor = 0
|
||||||
|
)
|
||||||
|
|
||||||
func convertBlendFactor(op graphicsdriver.BlendFactor) blendFactor {
|
func convertBlendFactor(op graphicsdriver.BlendFactor) blendFactor {
|
||||||
switch op {
|
switch op {
|
||||||
case graphicsdriver.BlendFactorZero:
|
case graphicsdriver.BlendFactorZero:
|
||||||
return zero
|
return glZero
|
||||||
case graphicsdriver.BlendFactorOne:
|
case graphicsdriver.BlendFactorOne:
|
||||||
return one
|
return glOne
|
||||||
case graphicsdriver.BlendFactorSourceAlpha:
|
case graphicsdriver.BlendFactorSourceAlpha:
|
||||||
return srcAlpha
|
return glSrcAlpha
|
||||||
case graphicsdriver.BlendFactorDestinationAlpha:
|
case graphicsdriver.BlendFactorDestinationAlpha:
|
||||||
return dstAlpha
|
return glDstAlpha
|
||||||
case graphicsdriver.BlendFactorOneMinusSourceAlpha:
|
case graphicsdriver.BlendFactorOneMinusSourceAlpha:
|
||||||
return oneMinusSrcAlpha
|
return glOneMinusSrcAlpha
|
||||||
case graphicsdriver.BlendFactorOneMinusDestinationAlpha:
|
case graphicsdriver.BlendFactorOneMinusDestinationAlpha:
|
||||||
return oneMinusDstAlpha
|
return glOneMinusDstAlpha
|
||||||
case graphicsdriver.BlendFactorDestinationColor:
|
case graphicsdriver.BlendFactorDestinationColor:
|
||||||
return dstColor
|
return glDstColor
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("opengl: invalid blend factor %d at convertBlendFactor", op))
|
panic(fmt.Sprintf("opengl: invalid blend factor %d at convertBlendFactor", op))
|
||||||
}
|
}
|
||||||
|
@ -82,16 +82,6 @@ func getProgramID(p program) programID {
|
|||||||
return programID(p)
|
return programID(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
zero = blendFactor(gl.ZERO)
|
|
||||||
one = blendFactor(gl.ONE)
|
|
||||||
srcAlpha = blendFactor(gl.SRC_ALPHA)
|
|
||||||
dstAlpha = blendFactor(gl.DST_ALPHA)
|
|
||||||
oneMinusSrcAlpha = blendFactor(gl.ONE_MINUS_SRC_ALPHA)
|
|
||||||
oneMinusDstAlpha = blendFactor(gl.ONE_MINUS_DST_ALPHA)
|
|
||||||
dstColor = blendFactor(gl.DST_COLOR)
|
|
||||||
)
|
|
||||||
|
|
||||||
type contextImpl struct {
|
type contextImpl struct {
|
||||||
init bool
|
init bool
|
||||||
}
|
}
|
||||||
|
@ -82,16 +82,6 @@ func getProgramID(p program) programID {
|
|||||||
return programID(p)
|
return programID(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
zero = blendFactor(gles.ZERO)
|
|
||||||
one = blendFactor(gles.ONE)
|
|
||||||
srcAlpha = blendFactor(gles.SRC_ALPHA)
|
|
||||||
dstAlpha = blendFactor(gles.DST_ALPHA)
|
|
||||||
oneMinusSrcAlpha = blendFactor(gles.ONE_MINUS_SRC_ALPHA)
|
|
||||||
oneMinusDstAlpha = blendFactor(gles.ONE_MINUS_DST_ALPHA)
|
|
||||||
dstColor = blendFactor(gles.DST_COLOR)
|
|
||||||
)
|
|
||||||
|
|
||||||
type contextImpl struct {
|
type contextImpl struct {
|
||||||
ctx gles.Context
|
ctx gles.Context
|
||||||
}
|
}
|
||||||
|
@ -79,16 +79,6 @@ func getProgramID(p program) programID {
|
|||||||
return p.id
|
return p.id
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
zero = blendFactor(gles.ZERO)
|
|
||||||
one = blendFactor(gles.ONE)
|
|
||||||
srcAlpha = blendFactor(gles.SRC_ALPHA)
|
|
||||||
dstAlpha = blendFactor(gles.DST_ALPHA)
|
|
||||||
oneMinusSrcAlpha = blendFactor(gles.ONE_MINUS_SRC_ALPHA)
|
|
||||||
oneMinusDstAlpha = blendFactor(gles.ONE_MINUS_DST_ALPHA)
|
|
||||||
dstColor = blendFactor(gles.DST_COLOR)
|
|
||||||
)
|
|
||||||
|
|
||||||
type webGLVersion int
|
type webGLVersion int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -16,14 +16,6 @@
|
|||||||
package gl
|
package gl
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ZERO = 0
|
|
||||||
ONE = 1
|
|
||||||
SRC_ALPHA = 0x0302
|
|
||||||
DST_ALPHA = 0x0304
|
|
||||||
ONE_MINUS_SRC_ALPHA = 0x0303
|
|
||||||
ONE_MINUS_DST_ALPHA = 0x0305
|
|
||||||
DST_COLOR = 0x0306
|
|
||||||
|
|
||||||
ALWAYS = 0x0207
|
ALWAYS = 0x0207
|
||||||
ARRAY_BUFFER = 0x8892
|
ARRAY_BUFFER = 0x8892
|
||||||
BLEND = 0x0BE2
|
BLEND = 0x0BE2
|
||||||
|
@ -16,14 +16,6 @@
|
|||||||
package gles
|
package gles
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ZERO = 0
|
|
||||||
ONE = 1
|
|
||||||
SRC_ALPHA = 0x0302
|
|
||||||
DST_ALPHA = 0x0304
|
|
||||||
ONE_MINUS_SRC_ALPHA = 0x0303
|
|
||||||
ONE_MINUS_DST_ALPHA = 0x0305
|
|
||||||
DST_COLOR = 0x0306
|
|
||||||
|
|
||||||
ALWAYS = 0x0207
|
ALWAYS = 0x0207
|
||||||
ARRAY_BUFFER = 0x8892
|
ARRAY_BUFFER = 0x8892
|
||||||
BLEND = 0x0BE2
|
BLEND = 0x0BE2
|
||||||
|
Loading…
Reference in New Issue
Block a user