Vertex data of type int is not supported, and an incorrect result occurs after forcing the support to be enabled

Rendering a square with vertex data from an Int32Array results in incorrect results.

But rendering the square with the vertex data of the Float32Array turns out to be correct

Clean webgl2 works fine with Int32Array
The attachment is a webgl2 example, double-click to view
webgl2.zip (1.7 KB)

I think you need to create the vertex buffer without the shortcut createVertexBuffer so you could pass the type in their constructor.

The createVertexBuffer function does not need to pass type. There is no type parameter

Can you give a proper demonstration? Thanks a lot

Here is the code used internally Babylon.js/buffer.ts at master · sebavan/Babylon.js · GitHub

You can see it is only a shortcut for the VertexBuffer construction which accept a type in its parameters. so you could try to replace with new BABYLON.VertexBuffer in your code where the type parameter would be BABYLON.VertexBuffer.INT

The code will automatically determine the correct type, no need to pass it.

ohhhh true, weird let me dig into it :slight_smile:

Thanks a lot. I really need data support of type Int32Array

offset and stride are incorrect

https://playground.babylonjs.com/#0Q3T9M#11 you did not use vertexAttribIPointer correctly, the normalized parameter shoud not be passed in I believe.

yes thanks a lot i found that too, just discovered … thank you very much

1 Like

It is recommended to update the source code so that babylonjs can support Int type data

Do you want to make a pull request for it ?