mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +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
|
||||
// in opengl package due to unsafe-way.
|
||||
// See BufferSubData in context_mobile.go.
|
||||
opengl.GetContext().ElementArrayBufferSubData(es[:ne])
|
||||
opengl.GetContext().ArrayBufferSubData(vs[:nv])
|
||||
opengl.BufferSubData(vs[:nv], es[:ne])
|
||||
es = es[ne:]
|
||||
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 {
|
||||
gl.BufferSubData(uint32(arrayBuffer), 0, len(data)*4, gl.Ptr(data))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Context) ElementArrayBufferSubData(data []uint16) {
|
||||
func (c *Context) elementArrayBufferSubData(data []uint16) {
|
||||
_ = c.runOnContextThread(func() error {
|
||||
gl.BufferSubData(uint32(elementArrayBuffer), 0, len(data)*2, gl.Ptr(data))
|
||||
return nil
|
||||
|
@ -425,14 +425,14 @@ func (c *Context) bindBuffer(bufferType bufferType, b buffer) {
|
||||
gl.Call("bindBuffer", int(bufferType), js.Value(b))
|
||||
}
|
||||
|
||||
func (c *Context) ArrayBufferSubData(data []float32) {
|
||||
func (c *Context) arrayBufferSubData(data []float32) {
|
||||
gl := c.gl
|
||||
arr := js.TypedArrayOf(data)
|
||||
gl.Call("bufferSubData", int(arrayBuffer), 0, arr)
|
||||
arr.Release()
|
||||
}
|
||||
|
||||
func (c *Context) ElementArrayBufferSubData(data []uint16) {
|
||||
func (c *Context) elementArrayBufferSubData(data []uint16) {
|
||||
gl := c.gl
|
||||
arr := js.TypedArrayOf(data)
|
||||
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))
|
||||
}
|
||||
|
||||
func (c *Context) ArrayBufferSubData(data []float32) {
|
||||
func (c *Context) arrayBufferSubData(data []float32) {
|
||||
gl := c.gl
|
||||
gl.BufferSubData(mgl.Enum(arrayBuffer), 0, float32sToBytes(data))
|
||||
}
|
||||
|
||||
func (c *Context) ElementArrayBufferSubData(data []uint16) {
|
||||
func (c *Context) elementArrayBufferSubData(data []uint16) {
|
||||
gl := c.gl
|
||||
gl.BufferSubData(mgl.Enum(elementArrayBuffer), 0, uint16sToBytes(data))
|
||||
}
|
||||
|
@ -260,6 +260,12 @@ func areSameFloat32Array(a, b []float32) bool {
|
||||
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) {
|
||||
theOpenGLState.useProgram(proj, texture, dstW, dstH, srcW, srcH, colorM, filter)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user