private void InitializeParticles(int n) { var particles = new Particle[n]; for (var i = 0; i < particles.Length; i++) { // generate a flat random cube particles[i].Position.X = Rand(0.2f); particles[i].Position.Y = Rand(0.02f); particles[i].Position.Z = Rand(0.2f); // move particles outwards particles[i].Position += particles[i].Position.Normalized() * 0.8f; // calculate velocity perpendicular to the direction towards the gravity center and the y-axis particles[i].Velocity = Vector3.Cross(particles[i].Position, -Vector3.UnitY); } // upload data into the Ping buffer and initialize the pong buffer to the same size _buffers.Init(BufferTarget.ArrayBuffer, particles); }