I have around 500 vec4's that need to be available but only ~15 per object, and than changed to 15 others of those 500 for the next object to draw and so on.
At first I tried to store all at once in a "uniform vec4 lines[500]" this worked great on some devices but for instance on the Galaxy SII this results in an instant crash, with outOfMemory exception. Than I tried to copy those needed 15 for every object form CPU side to GPU using:
GLES20.glUniform4f(GLES20.glGetformLocation(programHandle, "lines["+i/4+"]"),
lines[i], lines[i+1], lines[i+2], lines[i+3]);
since there are quite some objects to be drawn this results in alot of vec4's to be passed to the GPU and for the Garbage Collector to be called every ~2 seconds.
"lines" is a float[4*lineCount], maybe one call that uploads the whole float[] will be faster & more memory efficient already, does anyone know how to do that?
I belive UBO's would be great for this problem but they can't be used on android right?
Does anyone know a better solution for this? Thanks a lot!
Galaxy SII users depend on you ^_^