mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
internal/graphicsdriver/opengl: refactoring: move consts to gl
This commit is contained in:
parent
00ed6f08fc
commit
8926a4213e
@ -26,52 +26,32 @@ import (
|
||||
|
||||
type blendFactor int
|
||||
|
||||
const (
|
||||
glDstAlpha blendFactor = 0x304
|
||||
glDstColor blendFactor = 0x306
|
||||
glOne blendFactor = 1
|
||||
glOneMinusDstAlpha blendFactor = 0x305
|
||||
glOneMinusDstColor blendFactor = 0x307
|
||||
glOneMinusSrcAlpha blendFactor = 0x303
|
||||
glOneMinusSrcColor blendFactor = 0x301
|
||||
glSrcAlpha blendFactor = 0x302
|
||||
glSrcAlphaSaturate blendFactor = 0x308
|
||||
glSrcColor blendFactor = 0x300
|
||||
glZero blendFactor = 0
|
||||
)
|
||||
|
||||
type blendOperation int
|
||||
|
||||
const (
|
||||
glFuncAdd blendOperation = 0x8006
|
||||
glFuncReverseSubtract blendOperation = 0x800b
|
||||
glFuncSubtract blendOperation = 0x800a
|
||||
)
|
||||
|
||||
func convertBlendFactor(f graphicsdriver.BlendFactor) blendFactor {
|
||||
switch f {
|
||||
case graphicsdriver.BlendFactorZero:
|
||||
return glZero
|
||||
return gl.ZERO
|
||||
case graphicsdriver.BlendFactorOne:
|
||||
return glOne
|
||||
return gl.ONE
|
||||
case graphicsdriver.BlendFactorSourceColor:
|
||||
return glSrcColor
|
||||
return gl.SRC_COLOR
|
||||
case graphicsdriver.BlendFactorOneMinusSourceColor:
|
||||
return glOneMinusSrcColor
|
||||
return gl.ONE_MINUS_SRC_COLOR
|
||||
case graphicsdriver.BlendFactorSourceAlpha:
|
||||
return glSrcAlpha
|
||||
return gl.SRC_ALPHA
|
||||
case graphicsdriver.BlendFactorOneMinusSourceAlpha:
|
||||
return glOneMinusSrcAlpha
|
||||
return gl.ONE_MINUS_SRC_ALPHA
|
||||
case graphicsdriver.BlendFactorDestinationColor:
|
||||
return glDstColor
|
||||
return gl.DST_COLOR
|
||||
case graphicsdriver.BlendFactorOneMinusDestinationColor:
|
||||
return glOneMinusDstColor
|
||||
return gl.ONE_MINUS_DST_COLOR
|
||||
case graphicsdriver.BlendFactorDestinationAlpha:
|
||||
return glDstAlpha
|
||||
return gl.DST_ALPHA
|
||||
case graphicsdriver.BlendFactorOneMinusDestinationAlpha:
|
||||
return glOneMinusDstAlpha
|
||||
return gl.ONE_MINUS_DST_ALPHA
|
||||
case graphicsdriver.BlendFactorSourceAlphaSaturated:
|
||||
return glSrcAlphaSaturate
|
||||
return gl.SRC_ALPHA_SATURATE
|
||||
default:
|
||||
panic(fmt.Sprintf("opengl: invalid blend factor %d", f))
|
||||
}
|
||||
@ -80,11 +60,11 @@ func convertBlendFactor(f graphicsdriver.BlendFactor) blendFactor {
|
||||
func convertBlendOperation(o graphicsdriver.BlendOperation) blendOperation {
|
||||
switch o {
|
||||
case graphicsdriver.BlendOperationAdd:
|
||||
return glFuncAdd
|
||||
return gl.FUNC_ADD
|
||||
case graphicsdriver.BlendOperationSubtract:
|
||||
return glFuncSubtract
|
||||
return gl.FUNC_SUBTRACT
|
||||
case graphicsdriver.BlendOperationReverseSubtract:
|
||||
return glFuncReverseSubtract
|
||||
return gl.FUNC_REVERSE_SUBTRACT
|
||||
default:
|
||||
panic(fmt.Sprintf("opengl: invalid blend operation %d", o))
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ const (
|
||||
COLOR_ATTACHMENT0 = 0x8CE0
|
||||
COMPILE_STATUS = 0x8B81
|
||||
DEPTH24_STENCIL8 = 0x88F0
|
||||
DST_ALPHA = 0x0304
|
||||
DST_COLOR = 0x0306
|
||||
DYNAMIC_DRAW = 0x88E8
|
||||
ELEMENT_ARRAY_BUFFER = 0x8893
|
||||
FALSE = 0
|
||||
@ -30,6 +32,9 @@ const (
|
||||
FRAMEBUFFER = 0x8D40
|
||||
FRAMEBUFFER_BINDING = 0x8CA6
|
||||
FRAMEBUFFER_COMPLETE = 0x8CD5
|
||||
FUNC_ADD = 0x8006
|
||||
FUNC_REVERSE_SUBTRACT = 0x800b
|
||||
FUNC_SUBTRACT = 0x800a
|
||||
HIGH_FLOAT = 0x8DF2
|
||||
INFO_LOG_LENGTH = 0x8B84
|
||||
INVERT = 0x150A
|
||||
@ -39,6 +44,11 @@ const (
|
||||
NEAREST = 0x2600
|
||||
NO_ERROR = 0
|
||||
NOTEQUAL = 0x0205
|
||||
ONE = 1
|
||||
ONE_MINUS_DST_ALPHA = 0x0305
|
||||
ONE_MINUS_DST_COLOR = 0x0307
|
||||
ONE_MINUS_SRC_ALPHA = 0x0303
|
||||
ONE_MINUS_SRC_COLOR = 0x0301
|
||||
PIXEL_PACK_BUFFER = 0x88EB
|
||||
PIXEL_UNPACK_BUFFER = 0x88EC
|
||||
READ_WRITE = 0x88BA
|
||||
@ -46,6 +56,9 @@ const (
|
||||
RGBA = 0x1908
|
||||
SCISSOR_TEST = 0x0C11
|
||||
SHORT = 0x1402
|
||||
SRC_ALPHA = 0x0302
|
||||
SRC_ALPHA_SATURATE = 0x0308
|
||||
SRC_COLOR = 0x0300
|
||||
STENCIL_ATTACHMENT = 0x8D20
|
||||
STENCIL_BUFFER_BIT = 0x0400
|
||||
STENCIL_INDEX8 = 0x8D48
|
||||
@ -64,4 +77,5 @@ const (
|
||||
UNSIGNED_SHORT = 0x1403
|
||||
VERTEX_SHADER = 0x8B31
|
||||
WRITE_ONLY = 0x88B9
|
||||
ZERO = 0
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user