Hello, I stumbled apon a really neat extension of Box2d developed by Google called LiquidFun. I was able to successfully swap out Box2d with LiquidFun. However, I am unsure of how to render the particles in a “particlesystem” with cocos2d-x from the physics engine. The programmers guide states the following:
Each type of particle property lives in a contiguous memory buffer. For example, all particles’ position data live next door to one another, all color data live next door to one another, and so forth. Table 1 provides a visual representation of this storage.
Table 1. Memory Map of Particle Buffers
Particle 1 Particle 2 Particle 3
Position x1,y1 x2,y2 x3,y3
Address 0x00001000 0x00001008 0x00001010
Color r1,g1,b1,a1 r2,g2,b2,a2 r3,g3,b3,a3
Address 0x00002000 0x00002004 0x00002008
OpenGL can use these buffers directly in rendering.
In this example, OpenGL 1.1 would use glVertexPointer and glColorPointer to get the values from memory. OpenGL 2.0 would use glVertexAttribPointer.
OpenGL can be used to render either individual particles or particle groups.
However, I have never worked directly with the OpenGL API and I have no idea how to integrate this with cocos2d-x’s rendering. Can someone please post an example of how to render a particle system?
I greatly appreciate this.