gpu_particle_burst_06.py Diff#

gpu_particle_burst_06.py#
--- /home/docs/checkouts/readthedocs.org/user_builds/arcade-library/checkouts/development/doc/tutorials/gpu_particle_burst/gpu_particle_burst_05.py
+++ /home/docs/checkouts/readthedocs.org/user_builds/arcade-library/checkouts/development/doc/tutorials/gpu_particle_burst/gpu_particle_burst_06.py
@@ -33,7 +33,7 @@
 
         # Program to visualize the points
         self.program = self.ctx.load_program(
-            vertex_shader="vertex_shader_v2.glsl",
+            vertex_shader="vertex_shader_v3.glsl",
             fragment_shader="fragment_shader.glsl",
         )
 
@@ -69,10 +69,16 @@
                 speed = abs(random.gauss(0, 1)) * .5
                 dx = math.sin(angle) * speed
                 dy = math.cos(angle) * speed
+                red = random.uniform(0.5, 1.0)
+                green = random.uniform(0, red)
+                blue = 0
                 yield initial_x
                 yield initial_y
                 yield dx
                 yield dy
+                yield red
+                yield green
+                yield blue
 
         # Recalculate the coordinates from pixels to the OpenGL system with
         # 0, 0 at the center.
@@ -88,8 +94,8 @@
         # Create a buffer description specifying the buffer's data format
         buffer_description = arcade.gl.BufferDescription(
             buffer,
-            '2f 2f',
-            ['in_pos', 'in_vel'])
+            '2f 2f 3f',
+            ['in_pos', 'in_vel', 'in_color'])
 
         # Create our Vertex Attribute Object
         vao = self.ctx.geometry([buffer_description])