Fix issue#8, fold data into different rows when its size is more than MAX_TEXTURE_SIZE #17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.