tecznotes

Michal Migurski's notebook, listening post, and soapbox. Subscribe to this blog. Check out the rest of my site as well.

Mar 19, 2012 1:00am

tinkering with webgl

With some help from Ryan and Tom, I’ve been wrapping my pea-sized brain around WebGL. I’m doing my usual start-from-the-bottom thing so it’s been a great exercise in understanding a programming paradigm built around static lists and buffers. I’ve worked like this before, but not extensively and not with a render output this smoking fast.

It’s all simple stuff so far, but I’m chasing two ideas: using WebGL for simple 2D output with an added speed bump, and driving it from SVG or the HTML DOM. None of the examples below will work unless you’re using a current WebGL-compliant browser, which for me was Chrome 17.

The elephant is me figuring out the basics of viewport transformations that match pixel positions, image textures, and simple animation passed via vertex buffers:

The monkey is a test to see how many things I can throw around on a screen without sacrificing framerate, as well as some sanity checks on coding style. Turns out, the answer is “lots”. Interesting things happen with this one when you switch to and from its tab; I’m using a basic timeout-based mechanism for the little face particles, and it clearly falls into a regular rhythm.

The unicode patterns (borrowed from Sarah Nahm) are governed by an invisible D3 force layout, and are a test of synchronization between multiple “programs” and driving a visual effect from a geometric layout. Also additive blending for punchiness. Try dragging the boxes:

These are some of the resources I’ve been using to get up to speed:

I’m still not totally comfortable with the programming approach of maintaining collections of static lists in preference to objects and other data structures, and I’ve been avoiding three.js until I can get comfortable with how WebGL works for simple, two-dimensional graphics. No lighting effects or spinny statues quite yet.

May 2013
Su M Tu W Th F Sa
   
 

Recent Entries

  1. week 1,851: week one
  2. tilestache 0.7% better
  3. south end of lake merritt construction
  4. network time machine backups
  5. week 1,846: ladders
  6. documentation for tiled vectors in mapnik
  7. the liberty of postgreslessness: tiled vectors in mapnik
  8. gl-solar, webGL rendering of OSM data
  9. webgl maps, stealth mountain edition
  10. one more (map of lake merritt)
  11. elephant-to-elephant: processing OSM data in hadoop
  12. beasts of the southern wild
  13. weeks 1,838/1,839: total protonic reversal
  14. week 1,837: typescripting
  15. week 1,836: back at shiny
  16. hands
  17. week 1,835: leaving stamen
  18. work in progress: green means go
  19. loading artifacts, google maps for iOS
  20. blog all oft-played tracks IV

Archives