Can you see the force?

I’ve been working on my Master’s Thesis lately and getting a headache from all the formal writing. So I just want to blog some informal shit real quick. Here are a bunch of screenshots I took playing with my 2D PyOpenCL implementation of SPH (It’s pretty much the exact same OpenCL code thats in my Blender Game Engine project). I’m playing with OpenGL 3.3 Geometry shaders to make the little red arrows. The arrows represent the force exerted on each particle from the SPH calculations. You can see the waves form as particles are repelled by high density areas and attracted to low density areas. The bigger the force the more red the particles get as well, with no force they are just blue.
I built in the ability to add particles with the mouse by clicking, which you can do while the simulation is paused. So I drew my name and then unpaused it:

Here are some fun looking screens I got by creating some crazy density profiles and letting it go: (click through to imgur to see the fullsize screenshots in 2560×1600 resolution)

So quick shout out to Mike Pan for his geometry shader post that got me started. Using Geometry shaders in PyOpenGL wasn’t the most straightforward thing, but I ended up piecing things together from various sources.
Technical note: For some reason I had to specify

        self.program = glCreateProgram()
        glProgramParameteriARB(self.program, GL_GEOMETRY_INPUT_TYPE_ARB, GL_POINTS)
        glProgramParameteriARB(self.program, GL_GEOMETRY_OUTPUT_TYPE_ARB, GL_POINTS) #not sure why this works
        glProgramParameteriARB(self.program, GL_GEOMETRY_VERTICES_OUT_ARB, 20)
        self.compileProgram( self.program, vshader, fshader, gshader)

Even though I’m doing this in the geometry shader

            #version 330
            layout(points) in;
            layout(triangle_strip) out;

Changing GL_POINTS to anything else gives me cryptic errors. Perhaps some OpenGL veterans wouldn’t mind explaining this? I should probably go read the spec, maybe when I’m done writing!
The code is burried deep in one of the 30 branches in my EnjaParticles github repository, its so experimental and mixed in with other crap that I’m not going to directly link to it. I’m planning to use this as a research platform for improving SPH since prototyping (OpenCL) in python is much easier so eventually it will get cleaned up and released.