BabylonJS / BabylonJS/BabylonNative

Napi ArrayBuffer constructor behaves inconsistently with undefined

Open
#1,118 1 comment 0 reactions 1 assignee Claimed by @bghgary View on GitHub
Dominant language
C++
Stars
919
Forks
162
Avg merge
1d 15h
Merged PRs (30d)
19

Description

While testing out the [BaseTexture::readPixels()](https://doc.babylonjs.com/typedoc/classes/BABYLON.BaseTexture#readPixels) function I found that the behavior of the Napi ArrayBuffer construction [at this line](https://github.com/BabylonJS/BabylonNative/blob/40628380c9494a9a4f6d59c02f39521f8a3bddd0/Plugins/NativeEngine/Source/NativeEngine.cpp#L1331) was behaving differently in Babylon Native vs Babylon React Native where the implementations of Napi differ.

In Babylon Native the ArrayBuffer construction works as expected and later on IsNull() on the buffer returns true. In Babylon React Native an exception is thrown at that line and the readPixels operation is aborted.

**To Reproduce**
Steps to reproduce the behavior:
1. In the Babylon React Native playground call readPixels() on a texture with no arguments

**Expected behavior**
The call to readPixels() succeeds

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Other**
Tested on React-Native Android

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.