Playing with bits
2 hours ago
A collection of my smaller thoughts. Check out Adrian Boeing's webpage.
One of my favourite programming tasks is to create a program in under 4k. This is something the Demoscene excel at (see scene.org awards).
I entered the 2010 Perth Game Jam again this year, but only had about 6 hours to put together an entry. Simon Wittber did a great job of organizing it again this year.SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);before the call to "SDL_SetVideoMode".
glEnable(GL_MULTISAMPLE);as well.
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST ); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST ); glEnable(GL_LINE_SMOOTH); glEnable(GL_POLYGON_SMOOTH);All done, you should see smoothed edges (as in the picture above, left is antialiased, right has jaggy edges)
// Compute vectors v0 = C - A v1 = B - A v2 = P - A // Compute dot products dot00 = dot(v0, v0) dot01 = dot(v0, v1) dot02 = dot(v0, v2) dot11 = dot(v1, v1) dot12 = dot(v1, v2) // Compute barycentric coordinates invDenom = 1 / (dot00 * dot11 - dot01 * dot01) u = (dot11 * dot02 - dot01 * dot12) * invDenom v = (dot00 * dot12 - dot01 * dot02) * invDenom // Check if point is in triangle return (u >= 0) && (v >= 0) && (u + v <= 1)