mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
opengl: Unexport (Element)ArrayBufferSubData
This commit is contained in:
parent
5be08cac19
commit
45017213a7
@ -172,8 +172,7 @@ func (q *commandQueue) Flush() {
|
|||||||
// Note that the vertices passed to BufferSubData is not under GC management
|
// Note that the vertices passed to BufferSubData is not under GC management
|
||||||
// in opengl package due to unsafe-way.
|
// in opengl package due to unsafe-way.
|
||||||
// See BufferSubData in context_mobile.go.
|
// See BufferSubData in context_mobile.go.
|
||||||
opengl.GetContext().ElementArrayBufferSubData(es[:ne])
|
opengl.BufferSubData(vs[:nv], es[:ne])
|
||||||
opengl.GetContext().ArrayBufferSubData(vs[:nv])
|
|
||||||
es = es[ne:]
|
es = es[ne:]
|
||||||
vs = vs[nv:]
|
vs = vs[nv:]
|
||||||
}
|
}
|
||||||
|
@ -478,14 +478,14 @@ func (c *Context) bindBuffer(bufferType bufferType, b buffer) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ArrayBufferSubData(data []float32) {
|
func (c *Context) arrayBufferSubData(data []float32) {
|
||||||
_ = c.runOnContextThread(func() error {
|
_ = c.runOnContextThread(func() error {
|
||||||
gl.BufferSubData(uint32(arrayBuffer), 0, len(data)*4, gl.Ptr(data))
|
gl.BufferSubData(uint32(arrayBuffer), 0, len(data)*4, gl.Ptr(data))
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ElementArrayBufferSubData(data []uint16) {
|
func (c *Context) elementArrayBufferSubData(data []uint16) {
|
||||||
_ = c.runOnContextThread(func() error {
|
_ = c.runOnContextThread(func() error {
|
||||||
gl.BufferSubData(uint32(elementArrayBuffer), 0, len(data)*2, gl.Ptr(data))
|
gl.BufferSubData(uint32(elementArrayBuffer), 0, len(data)*2, gl.Ptr(data))
|
||||||
return nil
|
return nil
|
||||||
|
@ -425,14 +425,14 @@ func (c *Context) bindBuffer(bufferType bufferType, b buffer) {
|
|||||||
gl.Call("bindBuffer", int(bufferType), js.Value(b))
|
gl.Call("bindBuffer", int(bufferType), js.Value(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ArrayBufferSubData(data []float32) {
|
func (c *Context) arrayBufferSubData(data []float32) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
arr := js.TypedArrayOf(data)
|
arr := js.TypedArrayOf(data)
|
||||||
gl.Call("bufferSubData", int(arrayBuffer), 0, arr)
|
gl.Call("bufferSubData", int(arrayBuffer), 0, arr)
|
||||||
arr.Release()
|
arr.Release()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ElementArrayBufferSubData(data []uint16) {
|
func (c *Context) elementArrayBufferSubData(data []uint16) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
arr := js.TypedArrayOf(data)
|
arr := js.TypedArrayOf(data)
|
||||||
gl.Call("bufferSubData", int(elementArrayBuffer), 0, arr)
|
gl.Call("bufferSubData", int(elementArrayBuffer), 0, arr)
|
||||||
|
@ -374,12 +374,12 @@ func (c *Context) bindBuffer(bufferType bufferType, b buffer) {
|
|||||||
gl.BindBuffer(mgl.Enum(bufferType), mgl.Buffer(b))
|
gl.BindBuffer(mgl.Enum(bufferType), mgl.Buffer(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ArrayBufferSubData(data []float32) {
|
func (c *Context) arrayBufferSubData(data []float32) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
gl.BufferSubData(mgl.Enum(arrayBuffer), 0, float32sToBytes(data))
|
gl.BufferSubData(mgl.Enum(arrayBuffer), 0, float32sToBytes(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ElementArrayBufferSubData(data []uint16) {
|
func (c *Context) elementArrayBufferSubData(data []uint16) {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
gl.BufferSubData(mgl.Enum(elementArrayBuffer), 0, uint16sToBytes(data))
|
gl.BufferSubData(mgl.Enum(elementArrayBuffer), 0, uint16sToBytes(data))
|
||||||
}
|
}
|
||||||
|
@ -260,6 +260,12 @@ func areSameFloat32Array(a, b []float32) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BufferSubData(vertices []float32, indices []uint16) {
|
||||||
|
c := GetContext()
|
||||||
|
c.arrayBufferSubData(vertices)
|
||||||
|
c.elementArrayBufferSubData(indices)
|
||||||
|
}
|
||||||
|
|
||||||
func UseProgram(proj []float32, texture Texture, dstW, dstH, srcW, srcH int, colorM *affine.ColorM, filter graphics.Filter) {
|
func UseProgram(proj []float32, texture Texture, dstW, dstH, srcW, srcH int, colorM *affine.ColorM, filter graphics.Filter) {
|
||||||
theOpenGLState.useProgram(proj, texture, dstW, dstH, srcW, srcH, colorM, filter)
|
theOpenGLState.useProgram(proj, texture, dstW, dstH, srcW, srcH, colorM, filter)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user