Forums > Jitter

OB3D Efficiency Question

March 24, 2012 | 12:53 am

Currently programming some javascript dealing with large arrays of jit.gl.gridshape. As all my objects are the same, is it more efficient to use jit.gl.sketch to draw multiple copies of one object, or store an array of objects?


March 24, 2012 | 5:06 am

There are many ways to do this. The most efficient way is to setup OpenGL state to match that of the object you want to draw, draw a bunch of geometry and pop the OpenGL state you setup. One way to do this is to use the jit.gl.material object to control shading and coloring and draw your object with the drawraw method. You can do this in JS, however there is an example in the jit.gl.lua helpfile. It should be pretty easy to translate to JS. When you open the helpfile, load the basic.draw.lua script.


Viewing 2 posts - 1 through 2 (of 2 total)