When I Render 5 boxes in webgl with 1 texture all of them, the app runs at 60 fps, nice. But when I render 70 boxes the performance dicrease to ~40fps but in the view volumes are still 5.
I have debugged the app and all 70 boxes are using per fragment shaders when there are no need because 65 of them are out of frustum. I thought that gl.viewport declaration clipped out of view polygons but not.
I would like to know if fustrum culling is the technique to avoid this?开发者_如何学运维 How can I activate fustrum culling? Is there any webgl command or I have to do it manually?
Thanks in advance,
You guessed it: you have to do it manually.
But this technique is at the object level.. Individual triangles that are outside the viewport should be culled by the hardware automatically.
Is it possible that your draw loop has other inefficiencies that may be slowing things down as the number of boxes increases? For example, are you binding the texture for each box? Or querying the shader with getAttribLocation or getUniformLocation? Or doing other WebGL queries (all of which will slow the pipeline dramatically)?
精彩评论