Reputation: 438
I'm currently designing a simple opengl es 1.1 animation on the Android platform, where the mesh triangles of a specific object explode in different directions during a collision event. As all of the triangles will require their own unique transform as they explode away from each other, I've come to the relatively uninformed conclusion that I have one of two options:
a) Use fixed vertex buffer data, and change the opengl transform matrix for each triangle during the rendering cycle. Whilst this eliminates the need to manually transform the vertex data via the CPU, it requires the use of many explicit 'gl' transform/draw commands per frame.
b) Use two dynamically generated vertex buffers, and employ an additional thread to calculate the next set of vertices whilst the current frame is generating. Whilst the additional thread is capable of performing its tasks parallel to the GPU/Blanking wait events which occur on the rendering thread, all transformations will have to be performed via Java code as opengl transforms apply to the rendering cycle only.
As I say, this is a relatively uninformed conclusion, so I would be grateful for any advice regarding the implementation of this program.
Upvotes: 1
Views: 156
Reputation: 13348
Setting up a transformation matrix per triangle is going to be horribly slow, so your plan b sounds a lot better. Another option could be to move to GLES 2.0, and try to compute the new vertex positions in the vertex shader.
Upvotes: 1