Quantum Mechanic

Content from 2013-07

Moving Again

posted on 2013-07-25 05:00:00

Hopefully, a week from now I'll get up at my Aunt and Uncle's in East Lansing, Michigan and start out to the border with Canada. Hopefully, later that day, Sarah and I will move into an apartment in Kitchener and start setting up a new life there for a few years.

Chicago has been a rough nine months. I pushed for moving here because it seemed like I was going nowhere in New York. I had gotten work at two colleges there as a lab assistant in shitty conditions with decent pay and then with great coworkers and very little pay. I was at the end of my rope and thought there was nothing more for me there, that I could never afford to live there and would be back in a parents house or living off of Sarah forever. Then I moved to Chicago, where nobody was interested in hiring me for anything more than one tutoring gig that lasted about two months.

Financially, it would seem, I moved to Chicago to burn money.

Luckily, though, there were a number of upsides. I got to meet a lot of nice people mostly Northwestern students but a bunch of great people from Roger's Park community organizations like Food not Bombs, who are doing awesome things in kitchens and gardens and on the streets!

It's given me some hope that I can still make new friends and try new things, and I'm hoping to bring those feelings with me to Kitchener and my new job and my new school.

Here's hoping I see everyone again soon.

Cooking with shaders

posted on 2013-07-08 10:33:06

Anyone who has bothered reading here will have some idea that I've been learning about making games lately.  I haven't written in a bit, because it's a lot of learning and I have very little that's finished enough to show off.  Yesterday, I got bored of working on my networking code, and decided to learn what these things called shaders were.  Luckily, I already knew about the CLinch framework, which had some shader support built in, so I could dive in without having to worry about linking and compiling them myself.

I played around a bit and made a spinning cube with some shading working, but man, having to work with C syntax again was frustrating.  Even more so was having to define the variables for the shader programs both in their explicit code and twice in the lisp that managed them as well.  That sort of work duplication is the sort of thing I think Lisp is well-suited to avoid, so I decided there needed to be yet another library for parsing lisp syntax into a lower-level language, so I started cl-glsl.

It's 5:30 am now, and it can already turn this:
(defun main ()
(let ((intensity :float)
(color :vec4)
(tex-color :vec4 (texture2D texture01 v-texture-coord)))
(setf intensity (dot light-dir (normalize normal)))

((> intensity 0.95)
(setf color (* tex-color (vec4 1.0 1.0 1.0 1.0))))
((> intensity 0.5)
(setf color (* tex-color (vec4 0.6 0.6 0.6 0.6))))
((> intensity 0.25)
(setf color (* tex-color (vec4 0.4 0.4 0.4 0.4))))
(setf color (* tex-color (vec4 0.2 0.2 0.2 0.2)))))

(setf gl_frag-color color))))

into this:
void main () {
float intensity;
vec4 color;
vec4 texColor = texture2d(texture01, vTextureCoord);

intensity = dot(lightDir, normalize(normal));
if (intensity > 0.95) {
color = (texColor * vec4(1.0, 1.0, 1.0, 1.0));
} else if (intensity > 0.5) {
color = (texColor * vec4(0.6, 0.6, 0.6, 0.6));
} else if (intensity > 0.25) {
color = (texColor * vec4(0.4, 0.4, 0.4, 0.4));
} else {
color = (texColor * vec4(0.2, 0.2, 0.2, 0.2));
gl_FragColor = color;


Which I'm going to call a resounding success and maybe go lie down now. Links to cl-glsl will appear here when and if it proves useful at all.

Good night!