Nakul Bharti
Nakul Bharti

Reputation: 111

what is the maximum limit of the grid we can draw with webgl

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.

https://github.com/knakul853/tvb-framework/blob/master/tvb/interfaces/web/templates/genshi/visualizers/connectivity/scripts/myconnectivityMatrix.js

I want to know that is there any limit for the drawing. if there is a limit can anyone explain a bit about it?enter image description here

Upvotes: 1

Views: 129

Answers (1)

indexoutofbounds
indexoutofbounds

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

Related Questions