A problem about webgl performance optimization (color data compression under large data volume)

first of all, let"s talk about my requirements:

draw dots and edges in a web page (the number of edges is much larger than points, for example, there are 10,000 dots, hundreds of thousands of edges)

is drawn using webgl. After a series of optimizations, other aspects have been relatively fast and can be drawn as a whole, but now the bottleneck lies in the generation of Float32Array:

Float32Array(Int8Array)API

Float32Array:


200ms400000:

you can look at the points passed in Float32Array, and I found that

*  gl.drawArrays 
* 

so now I need to figure out a way to compress the colors. At first, I want to use an array indexed, but shader does not support passing in dynamic arrays of sizes (there is no way to determine how many colors to use at first)

later, I want to combine the values of RBGA into one, but this will either lose precision or may cross the boundary, so it doesn"t feel very good.

so all kinds of gods, how do you think this situation should be compressed and optimized?

Mar.04,2021

if the color is regular and repeated in a loop, you can use gl_VertexID in the vertex shader to automatically generate the color from the vertex ID. In this way, you don't even have to pass the color array

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e97c28-47462.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e97c28-47462.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?