Drawing many textured particles quickly in OpenGL ES 1.1

為{幸葍}努か 提交于 2019-12-11 08:57:58

问题


I'm trying to render some particle effects in Android using OpenGL. Each particle will be a billboarded textured quad and each particle is rendered with a rotation (i.e. around the z axis). I'm restricted to using OpenGL ES 1.1 so point sprites and pixel shaders aren't an option. What is a fast way of rendering and updating the positions of many particles (e.g. 100 to 5000)?

I know that using an OpenGL draw call for each particle is going to be very slow but I'm confused at how to use things like VBOs when I need to update my particle positions each frame.


回答1:


Random idea. May or may not work well. Use one draw call, or at least batch particles together into groups (say, 32 per group). You can construct every group per frame on the CPU and then send it down. Just construct one big array with GL_TRIANGLE_FAN (IIRC you an "terminate" fan by adding the same vertex twice).

One of the challenges, I believe, is to create this buffer. Is this Java or JNI? Are you using a java.nio buffer? From what I read in the forums, modifying those buffers in Java can be terribly slow. (Btw - I'm not that familiar with the internal buffer handling on Android, you may or may not need to double-buffer them.)



来源:https://stackoverflow.com/questions/4404762/drawing-many-textured-particles-quickly-in-opengl-es-1-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!