mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
graphicsdriver/opengl: Bug fix: getBufferSubData did not work correctly on JS
This commit is contained in:
parent
dd15927710
commit
b7abde7f00
@ -590,7 +590,7 @@ func (c *context) replacePixelsWithPBO(buffer buffer, t textureNative, width, he
|
|||||||
|
|
||||||
func (c *context) getBufferSubData(buffer buffer, width, height int) []byte {
|
func (c *context) getBufferSubData(buffer buffer, width, height int) []byte {
|
||||||
gl := c.gl
|
gl := c.gl
|
||||||
gl.Call("bindBuffer", gles.PIXEL_UNPACK_BUFFER, buffer)
|
gl.Call("bindBuffer", gles.PIXEL_UNPACK_BUFFER, js.Value(buffer))
|
||||||
l := 4 * width * height
|
l := 4 * width * height
|
||||||
arr := jsutil.TemporaryUint8Array(l, nil)
|
arr := jsutil.TemporaryUint8Array(l, nil)
|
||||||
if isWebGL2Available {
|
if isWebGL2Available {
|
||||||
@ -598,6 +598,6 @@ func (c *context) getBufferSubData(buffer buffer, width, height int) []byte {
|
|||||||
} else {
|
} else {
|
||||||
gl.Call("getBufferSubData", gles.PIXEL_UNPACK_BUFFER, 0, arr.Call("subarray", 0, l))
|
gl.Call("getBufferSubData", gles.PIXEL_UNPACK_BUFFER, 0, arr.Call("subarray", 0, l))
|
||||||
}
|
}
|
||||||
gl.Call("bindBuffer", gles.PIXEL_UNPACK_BUFFER, 0)
|
gl.Call("bindBuffer", gles.PIXEL_UNPACK_BUFFER, nil)
|
||||||
return jsutil.Uint8ArrayToSlice(arr, l)
|
return jsutil.Uint8ArrayToSlice(arr, l)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user