mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
opengl: Remove type mode
This commit is contained in:
parent
b2b09ccec0
commit
99594fe732
@ -246,7 +246,7 @@ func (c *drawImageCommand) Exec(indexOffsetInBytes int) error {
|
||||
dw, dh := c.dst.Size()
|
||||
sw, sh := c.src.Size()
|
||||
opengl.UseProgram(proj, c.src.texture.native, dw, dh, sw, sh, c.color, c.filter)
|
||||
opengl.GetContext().DrawElements(opengl.Triangles, c.nindices, indexOffsetInBytes)
|
||||
opengl.GetContext().DrawElements(c.nindices, indexOffsetInBytes)
|
||||
|
||||
// glFlush() might be necessary at least on MacBook Pro (a smilar problem at #419),
|
||||
// but basically this pass the tests (esp. TestImageTooManyFill).
|
||||
|
@ -32,8 +32,6 @@ var (
|
||||
ElementArrayBuffer bufferType
|
||||
DynamicDraw bufferUsage
|
||||
StaticDraw bufferUsage
|
||||
Triangles mode
|
||||
Lines mode
|
||||
Short DataType
|
||||
Float DataType
|
||||
|
||||
|
@ -60,8 +60,6 @@ func init() {
|
||||
ArrayBuffer = gl.ARRAY_BUFFER
|
||||
ElementArrayBuffer = gl.ELEMENT_ARRAY_BUFFER
|
||||
DynamicDraw = gl.DYNAMIC_DRAW
|
||||
Triangles = gl.TRIANGLES
|
||||
Lines = gl.LINES
|
||||
Short = gl.SHORT
|
||||
Float = gl.FLOAT
|
||||
|
||||
@ -502,9 +500,9 @@ func (c *Context) deleteBuffer(b buffer) {
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Context) DrawElements(mode mode, len int, offsetInBytes int) {
|
||||
func (c *Context) DrawElements(len int, offsetInBytes int) {
|
||||
_ = c.runOnContextThread(func() error {
|
||||
gl.DrawElements(uint32(mode), int32(len), gl.UNSIGNED_SHORT, gl.PtrOffset(offsetInBytes))
|
||||
gl.DrawElements(gl.TRIANGLES, int32(len), gl.UNSIGNED_SHORT, gl.PtrOffset(offsetInBytes))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ var (
|
||||
textureMinFilter js.Value
|
||||
textureWrapS js.Value
|
||||
textureWrapT js.Value
|
||||
triangles js.Value
|
||||
rgba js.Value
|
||||
unpackAlignment js.Value
|
||||
unsignedByte js.Value
|
||||
@ -77,8 +78,6 @@ func init() {
|
||||
ArrayBuffer = bufferType(c.Get("ARRAY_BUFFER").Int())
|
||||
ElementArrayBuffer = bufferType(c.Get("ELEMENT_ARRAY_BUFFER").Int())
|
||||
DynamicDraw = bufferUsage(c.Get("DYNAMIC_DRAW").Int())
|
||||
Triangles = mode(c.Get("TRIANGLES").Int())
|
||||
Lines = mode(c.Get("LINES").Int())
|
||||
Short = DataType(c.Get("SHORT").Int())
|
||||
Float = DataType(c.Get("FLOAT").Int())
|
||||
|
||||
@ -106,6 +105,7 @@ func init() {
|
||||
textureMinFilter = c.Get("TEXTURE_MIN_FILTER")
|
||||
textureWrapS = c.Get("TEXTURE_WRAP_S")
|
||||
textureWrapT = c.Get("TEXTURE_WRAP_T")
|
||||
triangles = c.Get("TRIANGLES")
|
||||
unpackAlignment = c.Get("UNPACK_ALIGNMENT")
|
||||
unsignedByte = c.Get("UNSIGNED_BYTE")
|
||||
unsignedShort = c.Get("UNSIGNED_SHORT")
|
||||
@ -444,9 +444,9 @@ func (c *Context) deleteBuffer(b buffer) {
|
||||
gl.Call("deleteBuffer", js.Value(b))
|
||||
}
|
||||
|
||||
func (c *Context) DrawElements(mode mode, len int, offsetInBytes int) {
|
||||
func (c *Context) DrawElements(len int, offsetInBytes int) {
|
||||
gl := c.gl
|
||||
gl.Call("drawElements", int(mode), len, unsignedShort, offsetInBytes)
|
||||
gl.Call("drawElements", triangles, len, unsignedShort, offsetInBytes)
|
||||
}
|
||||
|
||||
func (c *Context) maxTextureSizeImpl() int {
|
||||
|
@ -57,8 +57,6 @@ func init() {
|
||||
ArrayBuffer = mgl.ARRAY_BUFFER
|
||||
ElementArrayBuffer = mgl.ELEMENT_ARRAY_BUFFER
|
||||
DynamicDraw = mgl.DYNAMIC_DRAW
|
||||
Triangles = mgl.TRIANGLES
|
||||
Lines = mgl.LINES
|
||||
Short = mgl.SHORT
|
||||
Float = mgl.FLOAT
|
||||
|
||||
@ -391,9 +389,9 @@ func (c *Context) deleteBuffer(b buffer) {
|
||||
gl.DeleteBuffer(mgl.Buffer(b))
|
||||
}
|
||||
|
||||
func (c *Context) DrawElements(mode mode, len int, offsetInBytes int) {
|
||||
func (c *Context) DrawElements(len int, offsetInBytes int) {
|
||||
gl := c.gl
|
||||
gl.DrawElements(mgl.Enum(mode), len, mgl.UNSIGNED_SHORT, offsetInBytes)
|
||||
gl.DrawElements(mgl.TRIANGLES, len, mgl.UNSIGNED_SHORT, offsetInBytes)
|
||||
}
|
||||
|
||||
func (c *Context) maxTextureSizeImpl() int {
|
||||
|
@ -18,7 +18,6 @@ type (
|
||||
shaderType int
|
||||
bufferType int
|
||||
bufferUsage int
|
||||
mode int
|
||||
operation int
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user