Here is a simple case scenario: http://jsfiddle.net/headchem/r28mm/10/
Is there a way to avoid calling this line for every single triangle I want to make?
gl.drawArrays(gl.TRIANGLES, 0, numItems);
As a training exercise, I am trying to create a 2D game from simple colored triangles. I would like to place several hundred moving triangles on the screen of each frame, but my frame rates are very slow with my current attempts. I suspect that due to hundreds of drawArrays () calls, I am making every frame.
I read a little about Vertex Buffer Objects, and this question sounds promising , but it's hard for me to put together all the parts in my demonstration of the violin above. Is it possible to create hundreds of unique two-dimensional triangular shapes + different colors + transparency in one callback with good performance?
, VBO, , , , , , . , . , , , , , , . , 0, - (3*3 + 3*4), (number_of_vertices * number_of_floats_per_point + number_of_vertices * number_of_floats_per_color). .
0
(3*3 + 3*4)
(number_of_vertices * number_of_floats_per_point + number_of_vertices * number_of_floats_per_color)
, / , .
VBO, , , VBO, " ". , ( ), VBO, . , 1 .
, per-vertex .
Source: https://habr.com/ru/post/1547469/More articles:What is the best way to implement K-nearest neighbors in C # for a large number of dimensions? - optimizationUnexpected bad results for delegates in C # - performanceConfiguring OAuth 1.0 with 0 Legs in Spring Download - javaIs updating the entire VBO on every frame the most efficient way to draw many changing unique triangles? - opengl-esMKMapView and memory management in iOS - memory-managementPublishing a website, excluding a link from an aspnet_compiler - msbuildHow to clear mkmapview cache - iosКак реализовать систему управления вызовами для линий PRI - c#Storing nuget packages in an alternate location on the build server - .netmultiple return syntax - groovyAll Articles