Reputation: 111
Currently, I'm working on a project where I need to draw a grid with the size of N * N. here N can be of a size 998.I've successfully drawn the matrix of dimension 108 * 108. But when I tried to draw with size 216 * 216 it shows only half of the matrix. The result can be seen in the given image
I tried to debug but I'm pretty sure everything is correct in my code.
Here is my implementation.
I want to know that is there any limit for the drawing. if there is a limit can anyone explain a bit about it?
Upvotes: 1
Views: 129
Reputation: 803
I have not entirely read your code, but I had similar problems when I used Uint16Array
for storing indices. Meaning that the amount of vertices you are using, will need you to use a 32 bit indices buffer.
Try changing your code to:
var indices = new Uint32Array(nrElems * nrElems * 2 * 3);
var linesIndices = new Uint32Array(nrElems * nrElems * 2 * 4);
Also for your gl.drawElements
call use gl.UNSIGNED_INT
instead of gl.UNSIGNED_SHORT
.
According to gman's comment you also have to to check for an enable the OES_element_index_uint extension, otherwise you'll get an error
You also might be interested in this answer
Upvotes: 1