mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/graphicsdriver/opengl: refactoring
This commit is contained in:
parent
1d9f1474e9
commit
37c5f53890
@ -23,22 +23,32 @@ import (
|
||||
|
||||
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 {
|
||||
switch op {
|
||||
case graphicsdriver.BlendFactorZero:
|
||||
return zero
|
||||
return glZero
|
||||
case graphicsdriver.BlendFactorOne:
|
||||
return one
|
||||
return glOne
|
||||
case graphicsdriver.BlendFactorSourceAlpha:
|
||||
return srcAlpha
|
||||
return glSrcAlpha
|
||||
case graphicsdriver.BlendFactorDestinationAlpha:
|
||||
return dstAlpha
|
||||
return glDstAlpha
|
||||
case graphicsdriver.BlendFactorOneMinusSourceAlpha:
|
||||
return oneMinusSrcAlpha
|
||||
return glOneMinusSrcAlpha
|
||||
case graphicsdriver.BlendFactorOneMinusDestinationAlpha:
|
||||
return oneMinusDstAlpha
|
||||
return glOneMinusDstAlpha
|
||||
case graphicsdriver.BlendFactorDestinationColor:
|
||||
return dstColor
|
||||
return glDstColor
|
||||
default:
|
||||
panic(fmt.Sprintf("opengl: invalid blend factor %d at convertBlendFactor", op))
|
||||
}
|
||||
|
@ -82,16 +82,6 @@ func getProgramID(p program) programID {
|
||||
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 {
|
||||
init bool
|
||||
}
|
||||
|
@ -82,16 +82,6 @@ func getProgramID(p program) programID {
|
||||
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 {
|
||||
ctx gles.Context
|
||||
}
|
||||
|
@ -79,16 +79,6 @@ func getProgramID(p program) programID {
|
||||
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
|
||||
|
||||
const (
|
||||
|
@ -16,14 +16,6 @@
|
||||
package gl
|
||||
|
||||
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
|
||||
ARRAY_BUFFER = 0x8892
|
||||
BLEND = 0x0BE2
|
||||
|
@ -16,14 +16,6 @@
|
||||
package gles
|
||||
|
||||
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
|
||||
ARRAY_BUFFER = 0x8892
|
||||
BLEND = 0x0BE2
|
||||
|
Loading…
Reference in New Issue
Block a user