stardustjs / stardust

The primary repository for the Stardust visualization library.
98 stars 8 forks source link

Fix issue#8, fold data into different rows when its size is more than MAX_TEXTURE_SIZE #17

Open JackieAnxis opened 2 years ago

JackieAnxis commented 2 years ago

For the graph example, when visualizing a graph with more than MAX_TEXTURE_SIZE (it may be 2^14 or 2^15), webGL will report that: WebGL: INVALID_VALUE: texImage2D: width or height out of range. Now, the data is bound to texture with one row (newData.width = data.length; newData.height = 1), when the length of data exceeds the MAX_TEXTURE_SIZE, it will not be visualized. I fold the data into several rows in the texture (newData.width = data.length > MAX_TEXTURE_SIZE ? MAX_TEXTURE_SIZE : data.length; newData.height = Math.ceil(data.length / MAX_TEXTURE_SIZE)), so that its length will not exceed the MAX_TEXTURE_SIZE.

JackieAnxis commented 2 years ago

For the graph example, when visualizing a graph with more than MAX_TEXTURE_SIZE (it may be 2^14 or 2^15), webGL will report that: WebGL: INVALID_VALUE: texImage2D: width or height out of range. Now, the data is bound to texture with one row (newData.width = data.length; newData.height = 1), when the length of data exceeds the MAX_TEXTURE_SIZE, it will not be visualized. I fold the data into several rows in the texture (newData.width = data.length > MAX_TEXTURE_SIZE ? MAX_TEXTURE_SIZE : data.length; newData.height = Math.ceil(data.length / MAX_TEXTURE_SIZE)), so that its length will not exceed the MAX_TEXTURE_SIZE.

This PR will fix #8