diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 162: *: Merge cleanup branch part 1.

Message ID 20111102152303.4526.94697.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org Nov. 2, 2011, 3:23 p.m. UTC
Merge authors:
  Alexandros Frantzis (afrantzis)
  Jesse Barker (jesse-barker)
------------------------------------------------------------
revno: 162 [merge]
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Wed 2011-11-02 16:56:58 +0200
message:
  *: Merge cleanup branch part 1.
modified:
  android/AndroidManifest.xml
  android/src/org/linaro/glmark2/Glmark2Activity.java
  android/src/org/linaro/glmark2/Glmark2SurfaceView.java
  data/shaders/bump-normals.frag
  data/shaders/light-phong.vert
  src/benchmark.cpp
  src/benchmark.h
  src/canvas-android.cpp
  src/canvas-android.h
  src/canvas-x11-egl.cpp
  src/canvas-x11-egl.h
  src/canvas-x11-glx.cpp
  src/canvas-x11-glx.h
  src/canvas-x11.cpp
  src/canvas-x11.h
  src/canvas.h
  src/gl-headers.h
  src/main.cpp
  src/mesh.cpp
  src/mesh.h
  src/model.cpp
  src/model.h
  src/options.cpp
  src/scene-buffer.cpp
  src/scene-build.cpp
  src/scene-bump.cpp
  src/scene-conditionals.cpp
  src/scene-default-options.cpp
  src/scene-desktop.cpp
  src/scene-effect-2d.cpp
  src/scene-function.cpp
  src/scene-grid.cpp
  src/scene-loop.cpp
  src/scene-pulsar.cpp
  src/scene-shading.cpp
  src/scene-texture.cpp
  src/scene.cpp
  src/scene.h
  src/shader-source.cpp
  src/shader-source.h
  src/util.cpp
  src/util.h


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'android/AndroidManifest.xml'
--- android/AndroidManifest.xml	2011-10-18 13:40:39 +0000
+++ android/AndroidManifest.xml	2011-10-26 11:12:19 +0000
@@ -17,4 +17,4 @@ 
     <uses-permission android:name="android.permission.WAKE_LOCK" />
     <uses-feature android:glEsVersion="0x00020000"/>
     <uses-sdk android:minSdkVersion="9"/>
-</manifest> 
+</manifest>

=== modified file 'android/src/org/linaro/glmark2/Glmark2Activity.java'
--- android/src/org/linaro/glmark2/Glmark2Activity.java	2011-10-13 12:43:55 +0000
+++ android/src/org/linaro/glmark2/Glmark2Activity.java	2011-10-26 11:12:19 +0000
@@ -57,7 +57,7 @@ 
                     new DialogInterface.OnClickListener() {
                         public void onClick(DialogInterface dialog, int id) {
                             Glmark2Activity.this.finish();
-                            /* 
+                            /*
                              * Force process shutdown. There is no safer way to
                              * do this, as we have open threads we can't close
                              * when we fail to get an EGLConfig

=== modified file 'android/src/org/linaro/glmark2/Glmark2SurfaceView.java'
--- android/src/org/linaro/glmark2/Glmark2SurfaceView.java	2011-09-28 15:48:47 +0000
+++ android/src/org/linaro/glmark2/Glmark2SurfaceView.java	2011-10-26 11:12:19 +0000
@@ -18,7 +18,7 @@ 
         mActivity = activity;
 
         setEGLContextClientVersion(2);
-        
+
         // Uncomment the commands below to get an RGBA8888 surface and config.
         //this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
         //setEGLConfigChooser(new Glmark2ConfigChooser(8, 8, 8, 8, 16, 0));
@@ -96,7 +96,7 @@ 
                 throw new IllegalArgumentException("eglChooseConfig#2 failed");
             }
 
-            /* 
+            /*
              * Try to find a config that matches exactly the RGBA size
              * specified by the user and is >= for depth and stencil.
              */

=== modified file 'data/shaders/bump-normals.frag'
--- data/shaders/bump-normals.frag	2011-10-11 09:51:17 +0000
+++ data/shaders/bump-normals.frag	2011-10-26 11:12:19 +0000
@@ -17,7 +17,7 @@ 
     vec3 normal_raw = texture2D(NormalMap, TextureCoord).xyz;
     // Map "color" range [0, 1.0] to normal range [-1.0, 1.0]
     vec3 normal_scaled = normal_raw * 2.0 - 1.0;
-                                
+
     // Convert the normal to eye coordinates. Note that the normal map
     // we are using is using object coordinates (not tangent!) for the
     // normals, so we can multiply by the NormalMatrix as usual.

=== modified file 'data/shaders/light-phong.vert'
--- data/shaders/light-phong.vert	2011-10-11 09:51:17 +0000
+++ data/shaders/light-phong.vert	2011-10-26 11:12:19 +0000
@@ -9,7 +9,7 @@ 
 varying vec4 vertex_position;
 
 void main(void)
-{			
+{
     vec4 current_position = vec4(position, 1.0);
 
     // Transform the normal to eye coordinates

=== modified file 'src/benchmark.cpp'
--- src/benchmark.cpp	2011-08-16 07:53:59 +0000
+++ src/benchmark.cpp	2011-10-26 11:12:19 +0000
@@ -28,7 +28,7 @@ 
 using std::vector;
 using std::map;
 
-std::map<string, Scene *> Benchmark::mSceneMap;
+std::map<string, Scene *> Benchmark::sceneMap_;
 
 static Scene &
 get_scene_from_description(const string &s)
@@ -37,7 +37,7 @@ 
 
     Util::split(s, ':', elems);
 
-    const string &name = !elems.empty() ? elems[0] : ""; 
+    const string &name = !elems.empty() ? elems[0] : "";
 
     return Benchmark::get_scene_by_name(name);
 }
@@ -71,7 +71,7 @@ 
 void
 Benchmark::register_scene(Scene &scene)
 {
-    mSceneMap[scene.name()] = &scene;
+    sceneMap_[scene.name()] = &scene;
 }
 
 Scene &
@@ -79,55 +79,55 @@ 
 {
     map<string, Scene *>::const_iterator iter;
 
-    if ((iter = mSceneMap.find(name)) != mSceneMap.end())
+    if ((iter = sceneMap_.find(name)) != sceneMap_.end())
         return *(iter->second);
     else
         return Scene::dummy();
 }
 
 Benchmark::Benchmark(Scene &scene, const vector<OptionPair> &options) :
-    mScene(scene), mOptions(options)
+    scene_(scene), options_(options)
 {
 }
 
 Benchmark::Benchmark(const string &name, const vector<OptionPair> &options) :
-    mScene(Benchmark::get_scene_by_name(name)), mOptions(options)
+    scene_(Benchmark::get_scene_by_name(name)), options_(options)
 {
 }
 
 Benchmark::Benchmark(const string &s) :
-    mScene(get_scene_from_description(s)),
-    mOptions(get_options_from_description(s))
+    scene_(get_scene_from_description(s)),
+    options_(get_options_from_description(s))
 {
 }
 
 Scene &
 Benchmark::setup_scene()
 {
-    mScene.reset_options();
+    scene_.reset_options();
     load_options();
 
-    mScene.load();
-    mScene.setup();
+    scene_.load();
+    scene_.setup();
 
-    return mScene;
+    return scene_;
 }
 
 void
 Benchmark::teardown_scene()
 {
-    mScene.teardown();
-    mScene.unload();
+    scene_.teardown();
+    scene_.unload();
 }
 
 void
 Benchmark::load_options()
 {
-    for (vector<OptionPair>::iterator iter = mOptions.begin();
-         iter != mOptions.end();
+    for (vector<OptionPair>::iterator iter = options_.begin();
+         iter != options_.end();
          iter++)
     {
-        mScene.set_option(iter->first, iter->second);
+        scene_.set_option(iter->first, iter->second);
     }
 }
 

=== modified file 'src/benchmark.h'
--- src/benchmark.h	2011-06-09 14:07:23 +0000
+++ src/benchmark.h	2011-10-25 20:18:30 +0000
@@ -44,15 +44,15 @@ 
 
     static void register_scene(Scene &scene);
     static Scene &get_scene_by_name(const std::string &name);
-    static const std::map<std::string, Scene *> &scenes() { return mSceneMap; }
+    static const std::map<std::string, Scene *> &scenes() { return sceneMap_; }
 
 private:
-    Scene &mScene;
-    std::vector<OptionPair> mOptions;
+    Scene &scene_;
+    std::vector<OptionPair> options_;
 
     void load_options();
 
-    static std::map<std::string, Scene *> mSceneMap;
+    static std::map<std::string, Scene *> sceneMap_;
 };
 
 #endif

=== modified file 'src/canvas-android.cpp'
--- src/canvas-android.cpp	2011-10-10 11:00:36 +0000
+++ src/canvas-android.cpp	2011-10-28 10:51:19 +0000
@@ -18,6 +18,7 @@ 
  *
  * Authors:
  *  Alexandros Frantzis (glmark2)
+ *  Jesse Barker
  */
 #include "canvas-android.h"
 #include "log.h"
@@ -28,10 +29,14 @@ 
 #include <fstream>
 #include <sstream>
 
+/******************
+ * Public methods *
+ ******************/
+
 bool
 CanvasAndroid::init()
 {
-    resize(mWidth, mHeight);
+    resize(width_, height_);
 
     if (!eglSwapInterval(eglGetCurrentDisplay(), 0))
         Log::info("** Failed to set swap interval. Results may be bounded above by refresh rate.\n");
@@ -51,7 +56,7 @@ 
 void
 CanvasAndroid::visible(bool visible)
 {
-    (void)visible;
+    static_cast<void>(visible);
 }
 
 void
@@ -93,15 +98,15 @@ 
 void
 CanvasAndroid::write_to_file(std::string &filename)
 {
-    char *pixels = new char[mWidth * mHeight * 4];
+    char *pixels = new char[width_ * height_ * 4];
 
-    for (int i = 0; i < mHeight; i++) {
-        glReadPixels(0, i, mWidth, 1, GL_RGBA, GL_UNSIGNED_BYTE,
-                     &pixels[(mHeight - i - 1) * mWidth * 4]);
+    for (int i = 0; i < height_; i++) {
+        glReadPixels(0, i, width_, 1, GL_RGBA, GL_UNSIGNED_BYTE,
+                     &pixels[(height_ - i - 1) * width_ * 4]);
     }
 
     std::ofstream output (filename.c_str(), std::ios::out | std::ios::binary);
-    output.write(pixels, 4 * mWidth * mHeight);
+    output.write(pixels, 4 * width_ * height_);
 
     delete [] pixels;
 }
@@ -115,14 +120,18 @@ 
 void
 CanvasAndroid::resize(int width, int height)
 {
-    mWidth = width;
-    mHeight = height;
+    width_ = width;
+    height_ = height;
 
-    glViewport(0, 0, mWidth, mHeight);
-    mProjection = LibMatrix::Mat4::perspective(60.0, mWidth / (float)mHeight,
+    glViewport(0, 0, width_, height_);
+    projection_ = LibMatrix::Mat4::perspective(60.0, width_ / static_cast<float>(height_),
                                                1.0, 1024.0);
 }
 
+/*******************
+ * Private methods *
+ *******************/
+
 void
 CanvasAndroid::init_gl_extensions()
 {
@@ -138,9 +147,9 @@ 
     }
 
     if (extString.find("GL_OES_mapbuffer") != std::string::npos) {
-        GLExtensions::MapBuffer = 
+        GLExtensions::MapBuffer =
             reinterpret_cast<PFNGLMAPBUFFEROESPROC>(eglGetProcAddress("glMapBufferOES"));
-        GLExtensions::UnmapBuffer = 
+        GLExtensions::UnmapBuffer =
             reinterpret_cast<PFNGLUNMAPBUFFEROESPROC>(eglGetProcAddress("glUnmapBufferOES"));
     }
 }

=== modified file 'src/canvas-android.h'
--- src/canvas-android.h	2011-10-10 11:00:36 +0000
+++ src/canvas-android.h	2011-11-01 16:49:42 +0000
@@ -24,6 +24,13 @@ 
 
 #include "canvas.h"
 
+/**
+ * Canvas for rendering to Android surfaces.
+ *
+ * This class doesn't perform any GLES2.0 surface and context management
+ * (contrary to the CanvasX11* classes); these are handled in the Java
+ * Android code.
+ */
 class CanvasAndroid : public Canvas
 {
 public:

=== modified file 'src/canvas-x11-egl.cpp'
--- src/canvas-x11-egl.cpp	2011-10-28 14:25:15 +0000
+++ src/canvas-x11-egl.cpp	2011-11-02 14:56:58 +0000
@@ -61,6 +61,28 @@ 
     return vis_info;
 }
 
+bool
+CanvasX11EGL::make_current()
+{
+    if (!ensure_egl_surface())
+        return false;
+
+    if (egl_context_ == eglGetCurrentContext())
+        return true;
+
+    if (!eglMakeCurrent(egl_display_, egl_surface_, egl_surface_, egl_context_)) {
+        Log::error("Error: eglMakeCurrent failed with error %d\n", eglGetError());
+        return false;
+    }
+
+    if (!eglSwapInterval(egl_display_, 0))
+        Log::info("** Failed to set swap interval. Results may be bounded above by refresh rate.\n");
+
+    init_gl_extensions();
+
+    return true;
+}
+
 /*******************
  * Private methods *
  *******************/
@@ -210,9 +232,9 @@ 
     }
 
     if (extString.find("GL_OES_mapbuffer") != std::string::npos) {
-        GLExtensions::MapBuffer = 
+        GLExtensions::MapBuffer =
             reinterpret_cast<PFNGLMAPBUFFEROESPROC>(eglGetProcAddress("glMapBufferOES"));
-        GLExtensions::UnmapBuffer = 
+        GLExtensions::UnmapBuffer =
             reinterpret_cast<PFNGLUNMAPBUFFEROESPROC>(eglGetProcAddress("glUnmapBufferOES"));
     }
 #elif USE_GL
@@ -220,25 +242,3 @@ 
     GLExtensions::UnmapBuffer = glUnmapBuffer;
 #endif
 }
-
-bool
-CanvasX11EGL::make_current()
-{
-    if (!ensure_egl_surface())
-        return false;
-
-    if (egl_context_ == eglGetCurrentContext())
-        return true;
-
-    if (!eglMakeCurrent(egl_display_, egl_surface_, egl_surface_, egl_context_)) {
-        Log::error("eglMakeCurrent failed with error %d\n", eglGetError());
-        return false;
-    }
-
-    if (!eglSwapInterval(egl_display_, 0))
-        Log::info("** Failed to set swap interval. Results may be bounded above by refresh rate.\n");
-
-    init_gl_extensions();
-
-    return true;
-}

=== modified file 'src/canvas-x11-egl.h'
--- src/canvas-x11-egl.h	2011-10-10 11:00:36 +0000
+++ src/canvas-x11-egl.h	2011-11-01 16:49:42 +0000
@@ -26,6 +26,9 @@ 
 
 #include <EGL/egl.h>
 
+/**
+ * Canvas for rendering to an X11 window using EGL.
+ */
 class CanvasX11EGL : public CanvasX11
 {
 public:

=== modified file 'src/canvas-x11-glx.cpp'
--- src/canvas-x11-glx.cpp	2011-10-28 14:25:15 +0000
+++ src/canvas-x11-glx.cpp	2011-11-02 14:56:58 +0000
@@ -102,7 +102,7 @@ 
         extString = exts;
     }
 
-    /* 
+    /*
      * GLX_EXT_swap_control or GL_MESA_swap_control. Note that
      * GLX_SGI_swap_control is not enough because it doesn't allow 0 as a valid
      * value (i.e. you can't turn off VSync).

=== modified file 'src/canvas-x11-glx.h'
--- src/canvas-x11-glx.h	2011-10-10 11:00:36 +0000
+++ src/canvas-x11-glx.h	2011-11-01 16:49:42 +0000
@@ -28,6 +28,9 @@ 
 #include <GL/glx.h>
 #include <GL/glxext.h>
 
+/**
+ * Canvas for rendering to an X11 window using GLX.
+ */
 class CanvasX11GLX : public CanvasX11
 {
 public:

=== modified file 'src/canvas-x11.cpp'
--- src/canvas-x11.cpp	2011-09-29 13:05:21 +0000
+++ src/canvas-x11.cpp	2011-11-01 16:46:08 +0000
@@ -18,6 +18,7 @@ 
  *
  * Authors:
  *  Alexandros Frantzis (glmark2)
+ *  Jesse Barker
  */
 #include "canvas-x11.h"
 #include "log.h"
@@ -28,47 +29,9 @@ 
 #include <fstream>
 #include <sstream>
 
-static Window
-create_canvas_x_window(Display *xdpy, const char *name, int width, int height,
-                       const XVisualInfo *vis_info)
-{
-    XSetWindowAttributes attr;
-    unsigned long mask;
-    Window win = 0;
-    Window root = RootWindow(xdpy, DefaultScreen(xdpy));
-
-    Log::debug("Creating XWindow W: %d H: %d VisualID: 0x%x\n",
-               width, height, (int)vis_info->visualid);
-    /* window attributes */
-    attr.background_pixel = 0;
-    attr.border_pixel = 0;
-    attr.colormap = XCreateColormap(xdpy, root, vis_info->visual, AllocNone);
-    attr.event_mask = KeyPressMask;
-    mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
-    win = XCreateWindow(xdpy, root, 0, 0, width, height,
-                        0, vis_info->depth, InputOutput,
-                        vis_info->visual, mask, &attr);
-
-    /* set hints and properties */
-    {
-        XSizeHints sizehints;
-        sizehints.min_width  = width;
-        sizehints.min_height = height;
-        sizehints.max_width  = width;
-        sizehints.max_height = height;
-        sizehints.flags = PMaxSize | PMinSize;
-        XSetNormalHints(xdpy, win, &sizehints);
-        XSetStandardProperties(xdpy, win, name, name,
-                               None, NULL, 0, &sizehints);
-    }
-
-    /* Gracefully handle Window Delete event from window manager */
-    Atom wmDelete = XInternAtom(xdpy, "WM_DELETE_WINDOW", True);
-    XSetWMProtocols(xdpy, win, &wmDelete, 1);
-
-    return win;
-}
+/******************
+ * Public methods *
+ ******************/
 
 bool
 CanvasX11::init()
@@ -77,7 +40,7 @@ 
     if (!xdpy_)
         return false;
 
-    resize(mWidth, mHeight);
+    resize(width_, height_);
 
     if (!xwin_)
         return false;
@@ -158,22 +121,22 @@ 
 void
 CanvasX11::write_to_file(std::string &filename)
 {
-    char *pixels = new char[mWidth * mHeight * 4];
+    char *pixels = new char[width_ * height_ * 4];
 
-    for (int i = 0; i < mHeight; i++) {
-        glReadPixels(0, i, mWidth, 1, GL_RGBA, GL_UNSIGNED_BYTE,
-                     &pixels[(mHeight - i - 1) * mWidth * 4]);
+    for (int i = 0; i < height_; i++) {
+        glReadPixels(0, i, width_, 1, GL_RGBA, GL_UNSIGNED_BYTE,
+                     &pixels[(height_ - i - 1) * width_ * 4]);
     }
 
     std::ofstream output (filename.c_str(), std::ios::out | std::ios::binary);
-    output.write(pixels, 4 * mWidth * mHeight);
+    output.write(pixels, 4 * width_ * height_);
 
     delete [] pixels;
 }
 
 bool
 CanvasX11::should_quit()
-{ 
+{
     XEvent event;
 
     if (!XPending(xdpy_))
@@ -198,7 +161,7 @@ 
 {
     /* Recreate an existing window only if it has actually been resized */
     if (xwin_) {
-        if (mWidth != width || mHeight != height) {
+        if (width_ != width || height_ != height) {
             XDestroyWindow(xdpy_, xwin_);
             xwin_ = 0;
         }
@@ -207,23 +170,20 @@ 
         }
     }
 
-    mWidth = width;
-    mHeight = height;
-
-    XVisualInfo *visinfo = get_xvisualinfo();
-
-    xwin_ = create_canvas_x_window(xdpy_, "glmark2 "GLMARK_VERSION, mWidth, mHeight, visinfo);
-
-    XFree(visinfo);
-
-    glViewport(0, 0, mWidth, mHeight);
-    mProjection = LibMatrix::Mat4::perspective(60.0, mWidth / (float)mHeight,
+    width_ = width;
+    height_ = height;
+
+    if (!ensure_x_window())
+        Log::error("Error: Couldn't create X Window!\n");
+
+    glViewport(0, 0, width_, height_);
+    projection_ = LibMatrix::Mat4::perspective(60.0, width_ / static_cast<float>(height_),
                                                1.0, 1024.0);
 }
 
 bool
 CanvasX11::supports_gl2()
-{ 
+{
     std::string gl_version_str(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
     int gl_major(0);
 
@@ -238,10 +198,78 @@ 
         else
             start_pos++;
 
-        std::stringstream ss;
-        ss << gl_version_str.substr(start_pos, point_pos - start_pos + 1);
-        ss >> gl_major;
+        gl_major = Util::fromString<int>(
+                gl_version_str.substr(start_pos, point_pos - start_pos + 1)
+                );
     }
 
     return gl_major >= 2;
 }
+
+/*******************
+ * Private methods *
+ *******************/
+
+bool
+CanvasX11::ensure_x_window()
+{
+    if (xwin_)
+        return true;
+
+    if (!xdpy_) {
+        Log::error("Error: X11 Display has not been initialized!\n");
+        return false;
+    }
+
+    XVisualInfo *vis_info = get_xvisualinfo();
+    if (!vis_info) {
+        Log::error("Error: Could not get a valid XVisualInfo!\n");
+        return false;
+    }
+
+    Log::debug("Creating XWindow W: %d H: %d VisualID: 0x%x\n",
+               width_, height_, vis_info->visualid);
+
+    /* window attributes */
+    XSetWindowAttributes attr;
+    unsigned long mask;
+    Window root = RootWindow(xdpy_, DefaultScreen(xdpy_));
+
+    attr.background_pixel = 0;
+    attr.border_pixel = 0;
+    attr.colormap = XCreateColormap(xdpy_, root, vis_info->visual, AllocNone);
+    attr.event_mask = KeyPressMask;
+    mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+    xwin_ = XCreateWindow(xdpy_, root, 0, 0, width_, height_,
+                          0, vis_info->depth, InputOutput,
+                          vis_info->visual, mask, &attr);
+
+    XFree(vis_info);
+
+    if (!xwin_) {
+        Log::error("Error: XCreateWindow() failed!\n");
+        return false;
+    }
+
+    /* set hints and properties */
+    {
+        static const char *name("glmark2 "GLMARK_VERSION);
+        XSizeHints sizehints;
+        sizehints.min_width  = width_;
+        sizehints.min_height = height_;
+        sizehints.max_width  = width_;
+        sizehints.max_height = height_;
+        sizehints.flags = PMaxSize | PMinSize;
+        XSetNormalHints(xdpy_, xwin_, &sizehints);
+        XSetStandardProperties(xdpy_, xwin_, name, name,
+                               None, NULL, 0, &sizehints);
+    }
+
+    /* Gracefully handle Window Delete event from window manager */
+    Atom wmDelete = XInternAtom(xdpy_, "WM_DELETE_WINDOW", True);
+    XSetWMProtocols(xdpy_, xwin_, &wmDelete, 1);
+
+    return true;
+}
+

=== modified file 'src/canvas-x11.h'
--- src/canvas-x11.h	2011-09-29 13:05:21 +0000
+++ src/canvas-x11.h	2011-11-01 16:49:42 +0000
@@ -26,6 +26,9 @@ 
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
+/**
+ * Canvas for rendering with GL to an X11 window.
+ */
 class CanvasX11 : public Canvas
 {
 public:
@@ -45,13 +48,50 @@ 
     CanvasX11(int width, int height) :
         Canvas(width, height), xwin_(0), xdpy_(0) {}
 
+    /**
+     * Gets the XVisualInfo to use for creating the X window with.
+     *
+     * The caller should XFree() the returned XVisualInfo when done.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @return the XVisualInfo
+     */
     virtual XVisualInfo *get_xvisualinfo() = 0;
+
+    /**
+     * Makes the canvas the current target for GL rendering.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @return whether the operation succeeded
+     */
     virtual bool make_current() = 0;
+
+    /**
+     * Swaps the GL buffers (assuming double buffering is used).
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @return whether the operation succeeded
+     */
     virtual void swap_buffers() = 0;
+
+    /**
+     * Whether the current implementation supports GL(ES) 2.0.
+     *
+     * @return true if it supports GL(ES) 2.0, false otherwise
+     */
     bool supports_gl2();
 
+
+    /** The X window associated with this canvas. */
     Window xwin_;
+    /** The X display associated with this canvas. */
     Display *xdpy_;
+
+private:
+    bool ensure_x_window();
 };
 
 #endif

=== modified file 'src/canvas.h'
--- src/canvas.h	2011-08-16 07:37:52 +0000
+++ src/canvas.h	2011-11-01 16:49:42 +0000
@@ -20,6 +20,7 @@ 
  * Authors:
  *  Ben Smith (original glmark benchmark)
  *  Alexandros Frantzis (glmark2)
+ *  Jesse Barker
  */
 #ifndef GLMARK2_CANVAS_H_
 #define GLMARK2_CANVAS_H_
@@ -31,16 +32,27 @@ 
 #include <string>
 #include <stdio.h>
 
+/**
+ * Abstraction for a GL rendering target.
+ */
 class Canvas
 {
 public:
     virtual ~Canvas() {}
 
+    /**
+     * A pixel value.
+     */
     struct Pixel {
         Pixel():
             r(0), g(0), b(0), a(0) {}
         Pixel(uint8_t r, uint8_t g, uint8_t b, uint8_t a):
             r(r), g(g), b(b), a(a) {}
+        /**
+         * Gets the pixel value as a 32-bit integer in 0xAABBGGRR format.
+         *
+         * @return the pixel value
+         */
         uint32_t to_le32()
         {
             return static_cast<uint32_t>(r) +
@@ -55,37 +67,140 @@ 
         uint8_t a;
     };
 
+    /**
+     * Initializes the canvas and makes it the target of GL operations.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @return whether initialization succeeded
+     */
     virtual bool init() { return false; }
-    virtual void visible(bool visible) { (void)visible; }
+
+    /**
+     * Changes the visibility of the canvas.
+     *
+     * The canvas is initially not visible.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @param visible true to make the Canvas visible, false otherwise
+     */
+    virtual void visible(bool visible) { static_cast<void>(visible); }
+
+    /**
+     * Clears the canvas.
+     * This method should be implemented in derived classes.
+     */
     virtual void clear() {}
+
+    /**
+     * Ensures that the canvas on-screen representation gets updated
+     * with the latest canvas contents.
+     *
+     * This method should be implemented in derived classes.
+     */
     virtual void update() {}
+
+    /**
+     * Prints information about the canvas.
+     *
+     * This method should be implemented in derived classes.
+     */
     virtual void print_info() {}
+
+    /**
+     * Reads a pixel from the canvas.
+     *
+     * The (0, 0) point is the lower left corner. The X and Y coordinates
+     * increase towards the right and top, respectively.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @param x the X coordinate
+     * @param y the Y coordinate
+     *
+     * @return the pixel
+     */
     virtual Pixel read_pixel(int x, int y)
     {
-        (void)x;
-        (void)y;
+        static_cast<void>(x);
+        static_cast<void>(y);
         return Pixel();
     }
-    virtual void write_to_file(std::string &filename) { (void)filename; }
+
+    /**
+     * Writes the canvas contents to a file.
+     *
+     * The pixel save order is  upper left to lower right. Each pixel value
+     * is stored as four consecutive bytes R,G,B,A.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @param filename the name of the file to write to
+     */
+    virtual void write_to_file(std::string &filename) { static_cast<void>(filename); }
+
+    /**
+     * Whether we should quit the application.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @return true if we should quit, false otherwise
+     */
     virtual bool should_quit() { return false; }
-    virtual void resize(int width, int height) { (void)width; (void)height; }
-
+
+    /**
+     * Resizes the canvas.
+     *
+     * This method should be implemented in derived classes.
+     *
+     * @param width the new width in pixels
+     * @param height the new height in pixels
+     *
+     * @return true if we should quit, false otherwise
+     */
+    virtual void resize(int width, int height) { static_cast<void>(width); static_cast<void>(height); }
+
+    /**
+     * Gets a dummy canvas object.
+     *
+     * @return the dummy canvas
+     */
     static Canvas &dummy()
     {
         static Canvas dummy_canvas(0, 0);
         return dummy_canvas;
     }
 
-    int width() { return mWidth; }
-    int height() { return mHeight; }
-    const LibMatrix::mat4 &projection() { return mProjection; }
+    /**
+     * Gets the width of the canvas.
+     *
+     * @return the width in pixels
+     */
+    int width() { return width_; }
+
+    /**
+     * Gets the height of the canvas.
+     *
+     * @return the height in pixels
+     */
+    int height() { return height_; }
+
+    /**
+     * Gets the projection matrix recommended for use with the canvas.
+     *
+     * It's not mandatory to use this projection matrix.
+     *
+     * @return the projection matrix
+     */
+    const LibMatrix::mat4 &projection() { return projection_; }
 
 protected:
-    Canvas(int width, int height) : mWidth(width), mHeight(height) {}
+    Canvas(int width, int height) : width_(width), height_(height) {}
 
-    int mWidth;
-    int mHeight;
-    LibMatrix::mat4 mProjection;
+    int width_;
+    int height_;
+    LibMatrix::mat4 projection_;
 };
 
 #endif

=== modified file 'src/gl-headers.h'
--- src/gl-headers.h	2011-10-10 11:00:36 +0000
+++ src/gl-headers.h	2011-10-26 11:12:19 +0000
@@ -35,7 +35,7 @@ 
 #endif
 #endif
 
-/** 
+/**
  * Struct that holds pointers to functions that belong to extensions
  * in either GL2.0 or GLES2.0.
  */

=== modified file 'src/main.cpp'
--- src/main.cpp	2011-11-02 14:43:36 +0000
+++ src/main.cpp	2011-11-02 14:56:58 +0000
@@ -162,7 +162,7 @@ 
             Log::info("  [Option] %s\n"
                       "    Description  : %s\n"
                       "    Default Value: %s\n",
-                      opt.name.c_str(), 
+                      opt.name.c_str(),
                       opt.description.c_str(),
                       opt.default_value.c_str());
         }
@@ -258,7 +258,8 @@ 
     }
 }
 
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
 {
 
     if (!Options::parse_args(argc, argv))

=== modified file 'src/mesh.cpp'
--- src/mesh.cpp	2011-10-10 14:06:22 +0000
+++ src/mesh.cpp	2011-10-27 17:40:51 +0000
@@ -80,14 +80,14 @@ 
 
 
 bool
-Mesh::check_attrib(int pos, int size)
+Mesh::check_attrib(unsigned int pos, int dim)
 {
-    if (pos > (int)vertex_format_.size()) {
+    if (pos > vertex_format_.size()) {
         Log::error("Trying to set non-existent attribute\n");
         return false;
     }
 
-    if (vertex_format_[pos].first != size) {
+    if (vertex_format_[pos].first != dim) {
         Log::error("Trying to set attribute with value of invalid type\n");
         return false;
     }
@@ -114,7 +114,7 @@ 
  * etc
  */
 void
-Mesh::set_attrib(int pos, const LibMatrix::vec2 &v, std::vector<float> *vertex)
+Mesh::set_attrib(unsigned int pos, const LibMatrix::vec2 &v, std::vector<float> *vertex)
 {
     if (!check_attrib(pos, 2))
         return;
@@ -128,7 +128,7 @@ 
 }
 
 void
-Mesh::set_attrib(int pos, const LibMatrix::vec3 &v, std::vector<float> *vertex)
+Mesh::set_attrib(unsigned int pos, const LibMatrix::vec3 &v, std::vector<float> *vertex)
 {
     if (!check_attrib(pos, 3))
         return;
@@ -143,7 +143,7 @@ 
 }
 
 void
-Mesh::set_attrib(int pos, const LibMatrix::vec4 &v, std::vector<float> *vertex)
+Mesh::set_attrib(unsigned int pos, const LibMatrix::vec4 &v, std::vector<float> *vertex)
 {
     if (!check_attrib(pos, 4))
         return;
@@ -206,7 +206,7 @@ 
     vbo_usage_ = usage;
 }
 
-/** 
+/**
  * Sets the vertex attribute interleaving mode.
  *
  * If true the vertex attributes are going to be interleaved in a single
@@ -215,7 +215,7 @@ 
  *
  * Interleaving mode takes effect in the next call to ::build_array() or
  * ::build_vbo().
- * 
+ *
  * @param interleave whether to interleave
  */
 void

=== modified file 'src/mesh.h'
--- src/mesh.h	2011-10-10 13:55:46 +0000
+++ src/mesh.h	2011-10-27 17:40:51 +0000
@@ -40,9 +40,9 @@ 
     void set_vertex_format(const std::vector<int> &format);
     void set_attrib_locations(const std::vector<int> &locations);
 
-    void set_attrib(int pos, const LibMatrix::vec2 &v, std::vector<float> *vertex = 0);
-    void set_attrib(int pos, const LibMatrix::vec3 &v, std::vector<float> *vertex = 0);
-    void set_attrib(int pos, const LibMatrix::vec4 &v, std::vector<float> *vertex = 0);
+    void set_attrib(unsigned int pos, const LibMatrix::vec2 &v, std::vector<float> *vertex = 0);
+    void set_attrib(unsigned int pos, const LibMatrix::vec3 &v, std::vector<float> *vertex = 0);
+    void set_attrib(unsigned int pos, const LibMatrix::vec4 &v, std::vector<float> *vertex = 0);
     void next_vertex();
     std::vector<std::vector<float> >& vertices();
 
@@ -81,13 +81,25 @@ 
                    double spacing, grid_configuration_func conf_func = 0);
 
 private:
-    bool check_attrib(int pos, int size);
+    // check_attrib ensures that the attribute at the specified position is of
+    // the correct dimensionality (see the description of vertex_format_ below).
+    bool check_attrib(unsigned int pos, int dim);
     std::vector<float> &ensure_vertex();
     void update_single_array(const std::vector<std::pair<size_t, size_t> >& ranges,
                              size_t n, size_t nfloats, size_t offset);
     void update_single_vbo(const std::vector<std::pair<size_t, size_t> >& ranges,
                            size_t n, size_t nfloats);
 
+    //
+    // vertex_format_ is a vector of pairs describing the attribute data.
+    // pair.first is the dimension of the attribute (vec2, vec3, vec4) and
+    // pair.second is the number of float values into the vertex data of that
+    // attribute.  So, for example, if there are 3 attributes, a vec3 position
+    // a vec3 normal and a vec2 texture coordinate, you would have a
+    // vertex_format_ with 3 elements as follows: {<3, 0>, <3, 3>, <2, 6>} and
+    // the total size of each vertex would be the sum of the dimensions times
+    // the size of a float, or: 8 * sizeof(float) == 32 bytes
+    //
     std::vector<std::pair<int, int> > vertex_format_;
     std::vector<int> attrib_locations_;
     int vertex_size_;

=== modified file 'src/model.cpp'
--- src/model.cpp	2011-10-13 13:56:26 +0000
+++ src/model.cpp	2011-11-01 16:55:51 +0000
@@ -21,6 +21,7 @@ 
  *  Ben Smith (original glmark benchmark)
  *  Alexandros Frantzis (glmark2)
  */
+#include "mesh.h"
 #include "model.h"
 #include "vec.h"
 #include "log.h"
@@ -376,15 +377,6 @@ 
     return true;
 }
 
-template<typename T> T
-fromString(const string& asString)
-{
-    std::stringstream ss(asString);
-    T retVal;
-    ss >> retVal;
-    return retVal;
-}
-
 void
 get_values(const string& source, vec3& v)
 {
@@ -406,7 +398,7 @@ 
     }
     string::size_type numChars(endPos - startPos);
     string xs(source, startPos, numChars);
-    float x = fromString<float>(xs);
+    float x = Util::fromString<float>(xs);
     // Then the second value...
     startPos = endPos + 1;
     endPos = source.find(" ", startPos);
@@ -417,7 +409,7 @@ 
     }
     numChars = endPos - startPos;
     string ys(source, startPos, numChars);
-    float y = fromString<float>(ys);
+    float y = Util::fromString<float>(ys);
     // And the third value (there might be a fourth, but we don't care)...
     startPos = endPos + 1;
     endPos = source.find(" ", startPos);
@@ -430,10 +422,10 @@ 
         numChars = endPos - startPos;
     }
     string zs(source, startPos, endPos - startPos);
-    float z = fromString<float>(zs);
+    float z = Util::fromString<float>(zs);
     v.x(x);
     v.y(y);
-    v.z(z);    
+    v.z(z);
 }
 
 void
@@ -457,7 +449,7 @@ 
     }
     string::size_type numChars(endPos - startPos);
     string xs(source, startPos, numChars);
-    float x = fromString<float>(xs);
+    float x = Util::fromString<float>(xs);
     // Then the second value (there might be a third, but we don't care)...
     startPos = endPos + 1;
     endPos = source.find(" ", startPos);
@@ -470,7 +462,7 @@ 
         numChars = endPos - startPos;
     }
     string ys(source, startPos, numChars);
-    float y = fromString<float>(ys);
+    float y = Util::fromString<float>(ys);
     v.x(x);
     v.y(y);
 }
@@ -496,7 +488,7 @@ 
     }
     string::size_type numChars(endPos - startPos);
     string xs(source, startPos, numChars);
-    unsigned int x = fromString<unsigned int>(xs);
+    unsigned int x = Util::fromString<unsigned int>(xs);
     // Then the second value...
     startPos = endPos+1;
     endPos = source.find(" ", startPos);
@@ -507,7 +499,7 @@ 
     }
     numChars = endPos - startPos;
     string ys(source, startPos, numChars);
-    unsigned int y = fromString<unsigned int>(ys);
+    unsigned int y = Util::fromString<unsigned int>(ys);
     // And the third value (there might be a fourth, but we don't care)...
     startPos = endPos + 1;
     endPos = source.find(" ", startPos);
@@ -520,10 +512,10 @@ 
         numChars = endPos - startPos;
     }
     string zs(source, startPos, numChars);
-    unsigned int z = fromString<unsigned int>(zs);
+    unsigned int z = Util::fromString<unsigned int>(zs);
     v.x(x);
     v.y(y);
-    v.z(z);    
+    v.z(z);
 }
 
 bool

=== modified file 'src/model.h'
--- src/model.h	2011-10-07 18:39:57 +0000
+++ src/model.h	2011-11-01 16:55:51 +0000
@@ -24,13 +24,13 @@ 
 #ifndef GLMARK2_MODEL_H_
 #define GLMARK2_MODEL_H_
 
-#include "mesh.h"
-
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <string>
 #include <vector>
 #include <map>
+#include "vec.h"
+
+// Forward declare the mesh object.  We don't need the whole header here.
+class Mesh;
 
 enum ModelFormat
 {
@@ -46,7 +46,7 @@ 
     ModelFormat format_;
     ModelDescriptor();
 public:
-    ModelDescriptor(const std::string& name, ModelFormat format, 
+    ModelDescriptor(const std::string& name, ModelFormat format,
                     const std::string& pathname) :
         name_(name),
         pathname_(pathname),
@@ -78,7 +78,7 @@ 
 
     void calculate_normals();
     void convert_to_mesh(Mesh &mesh);
-    void convert_to_mesh(Mesh &mesh, 
+    void convert_to_mesh(Mesh &mesh,
                          const std::vector<std::pair<AttribType, int> > &attribs);
     const LibMatrix::vec3& minVec() const { return minVec_; }
     const LibMatrix::vec3& maxVec() const { return maxVec_; }

=== modified file 'src/options.cpp'
--- src/options.cpp	2011-09-21 14:10:37 +0000
+++ src/options.cpp	2011-11-01 16:46:08 +0000
@@ -54,11 +54,11 @@ 
     {0, 0, 0, 0}
 };
 
-/** 
+/**
  * Parses a size string of the form WxH
- * 
+ *
  * @param str the string to parse
- * @param size the parsed size (width, height) 
+ * @param size the parsed size (width, height)
  */
 static void
 parse_size(const std::string &str, std::pair<int,int> &size)
@@ -66,19 +66,15 @@ 
     std::vector<std::string> d;
     Util::split(str, 'x', d);
 
-    std::stringstream ss(d[0]);
-    ss >> size.first;
+    size.first = Util::fromString<int>(d[0]);
 
     /*
      * Parse the second element (height). If there is none, use the value
      * of the first element for the second (width = height)
      */
-    if (d.size() > 1) {
-        ss.clear();
-        ss.str(d[1]);
-        ss >> size.second;
-    }
-    else 
+    if (d.size() > 1)
+        size.second = Util::fromString<int>(d[1]);
+    else
         size.second = size.first;
 }
 

=== modified file 'src/scene-buffer.cpp'
--- src/scene-buffer.cpp	2011-10-11 08:52:12 +0000
+++ src/scene-buffer.cpp	2011-11-01 16:46:08 +0000
@@ -18,6 +18,7 @@ 
  *
  * Authors:
  *  Alexandros Frantzis (glmark2)
+ *  Jesse Barker
  */
 #include "scene.h"
 #include "log.h"
@@ -32,7 +33,7 @@ 
  * Wave implementation *
  ***********************/
 
-/** 
+/**
  * A callback used to set up the grid by the Wave class.
  * It is called for each "quad" of the grid.
  */
@@ -43,9 +44,14 @@ 
                LibMatrix::vec3 &ur,
                LibMatrix::vec3 &lr)
 {
-    (void)x; (void)y; (void)n_x; (void)n_y;
+    // These parameters are unused in this instance of a virtual callback
+    // function.
+    static_cast<void>(x);
+    static_cast<void>(y);
+    static_cast<void>(n_x);
+    static_cast<void>(n_y);
 
-    /* 
+    /*
      * Order matters here, so that Wave::vertex_length_index() can work.
      * Vertices of the triangles at index i that belong to length index i
      * are even, those that belong to i + 1 are odd.
@@ -56,7 +62,7 @@ 
 
     for (int i = 0; i < 6; i++) {
         mesh.next_vertex();
-        /* 
+        /*
          * Set the vertex position and the three vertex positions
          * of the triangle this vertex belongs to.
          */
@@ -67,15 +73,15 @@ 
     }
 }
 
-/** 
+/**
  * Renders a grid mesh modulated by a sine wave
  */
 class WaveMesh
 {
 public:
-    /** 
+    /**
      * Creates a wave mesh.
-     * 
+     *
      * @param length the total length of the grid (in model coordinates)
      * @param width the total width of the grid (in model coordinates)
      * @param nlength the number of length-wise grid subdivisions
@@ -98,9 +104,9 @@ 
 
     ~WaveMesh() { reset(); }
 
-    /** 
+    /**
      * Updates the state of a wave mesh.
-     * 
+     *
      * @param elapsed the time elapsed since the beginning of the rendering
      */
     void update(double elapsed)
@@ -134,7 +140,7 @@ 
         {
             /* First vertex of length index range */
             size_t vstart(iter->first * nwidth_ * 6 + (iter->first % 2));
-            /* 
+            /*
              * First vertex not included in the range. We should also update all
              * vertices of triangles touching index i.
              */
@@ -182,7 +188,7 @@ 
 
     std::vector<double> displacement_;
 
-    /** 
+    /**
      * Calculates the length index of a vertex.
      */
     size_t vertex_length_index(size_t v)
@@ -190,11 +196,11 @@ 
         return v / (6 * nwidth_) + (v % 2);
     }
 
-    /** 
+    /**
      * The sine wave function with duty-cycle.
      *
      * @param x the space coordinate
-     * 
+     *
      * @return the operation error code
      */
     double wave_func(double x)
@@ -203,10 +209,10 @@ 
         if (r < 0)
             r += wave_full_period_;
 
-        /* 
+        /*
          * Return either the sine value or 0.0, depending on the
          * wave duty cycle.
-         */ 
+         */
         if (r > wave_period_)
         {
             return 0;
@@ -217,12 +223,12 @@ 
         }
     }
 
-    /** 
+    /**
      * Calculates the displacement of the wave.
-     * 
+     *
      * @param n the length index
      * @param elapsed the time elapsed since the beginning of the rendering
-     * 
+     *
      * @return the displacement at point n at time elapsed
      */
     double displacement(size_t n, double elapsed)
@@ -232,7 +238,7 @@ 
         return wave_func(x - wave_velocity_ * elapsed);
     }
 
-    /** 
+    /**
      * Creates the GL shader program.
      */
     void create_program()
@@ -253,12 +259,12 @@ 
         }
     }
 
-    /** 
+    /**
      * Creates the grid mesh.
      */
     void create_mesh()
     {
-        /* 
+        /*
          * We need to pass the positions of all vertex of the triangle
          * in order to draw the wireframe.
          */
@@ -295,19 +301,19 @@ 
     Scene(pCanvas, "buffer")
 {
     priv_ = new SceneBufferPrivate();
-    mOptions["interleave"] = Scene::Option("interleave", "false",
+    options_["interleave"] = Scene::Option("interleave", "false",
                                            "Whether to interleave vertex attribute data [true,false]");
-    mOptions["update-method"] = Scene::Option("update-method", "map",
+    options_["update-method"] = Scene::Option("update-method", "map",
                                               "[map,subdata]");
-    mOptions["update-fraction"] = Scene::Option("update-fraction", "1.0",
+    options_["update-fraction"] = Scene::Option("update-fraction", "1.0",
                                                 "The fraction of the mesh length that is updated at every iteration (0.0-1.0)");
-    mOptions["update-dispersion"] = Scene::Option("update-dispersion", "0.0",
+    options_["update-dispersion"] = Scene::Option("update-dispersion", "0.0",
                                                   "How dispersed the updates are [0.0 - 1.0]");
-    mOptions["columns"] = Scene::Option("columns", "100",
+    options_["columns"] = Scene::Option("columns", "100",
                                        "The number of mesh subdivisions length-wise");
-    mOptions["rows"] = Scene::Option("rows", "20",
+    options_["rows"] = Scene::Option("rows", "20",
                                       "The number of mesh subdisivisions width-wise");
-    mOptions["buffer-usage"] = Scene::Option("buffer-usage", "static",
+    options_["buffer-usage"] = Scene::Option("buffer-usage", "static",
                                       "How the buffer will be used [static,stream,dynamic]");
 }
 
@@ -319,7 +325,7 @@ 
 int
 SceneBuffer::load()
 {
-    mRunning = false;
+    running_ = false;
 
     return 1;
 }
@@ -336,7 +342,7 @@ 
 
     Scene::setup();
 
-    bool interleave = (mOptions["interleave"].value == "true");
+    bool interleave = (options_["interleave"].value == "true");
     Mesh::VBOUpdateMethod update_method;
     Mesh::VBOUsage usage;
     double update_fraction;
@@ -344,32 +350,24 @@ 
     size_t nlength;
     size_t nwidth;
 
-    if (mOptions["update-method"].value == "map")
+    if (options_["update-method"].value == "map")
         update_method = Mesh::VBOUpdateMethodMap;
-    else if (mOptions["update-method"].value == "subdata")
+    else if (options_["update-method"].value == "subdata")
         update_method = Mesh::VBOUpdateMethodSubData;
     else
         update_method = Mesh::VBOUpdateMethodMap;
 
-    if (mOptions["buffer-usage"].value == "static")
+    if (options_["buffer-usage"].value == "static")
         usage = Mesh::VBOUsageStatic;
-    else if (mOptions["buffer-usage"].value == "stream")
+    else if (options_["buffer-usage"].value == "stream")
         usage = Mesh::VBOUsageStream;
     else
         usage = Mesh::VBOUsageDynamic;
 
-    std::stringstream ss;
-    ss << mOptions["update-fraction"].value;
-    ss >> update_fraction;
-    ss.clear();
-    ss << mOptions["update-dispersion"].value;
-    ss >> update_dispersion;
-    ss.clear();
-    ss << mOptions["columns"].value;
-    ss >> nlength;
-    ss.clear();
-    ss << mOptions["rows"].value;
-    ss >> nwidth;
+    update_fraction = Util::fromString<double>(options_["update-fraction"].value);
+    update_dispersion = Util::fromString<double>(options_["update-dispersion"].value);
+    nlength = Util::fromString<size_t>(options_["columns"].value);
+    nwidth = Util::fromString<size_t>(options_["rows"].value);
 
     if (update_method == Mesh::VBOUpdateMethodMap &&
         (GLExtensions::MapBuffer == 0 || GLExtensions::UnmapBuffer == 0))
@@ -389,14 +387,14 @@ 
     priv_->wave->mesh().build_vbo();
 
     priv_->wave->program().start();
-    priv_->wave->program()["Viewport"] = LibMatrix::vec2(mCanvas.width(), mCanvas.height());
+    priv_->wave->program()["Viewport"] = LibMatrix::vec2(canvas_.width(), canvas_.height());
 
     glDisable(GL_CULL_FACE);
 
-    mCurrentFrame = 0;
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    currentFrame_ = 0;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
 void
@@ -414,18 +412,18 @@ 
 SceneBuffer::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
     priv_->wave->update(elapsed_time);
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
 void
@@ -434,7 +432,7 @@ 
     LibMatrix::Stack4 model_view;
 
     // Load the ModelViewProjectionMatrix uniform in the shader
-    LibMatrix::mat4 model_view_proj(mCanvas.projection());
+    LibMatrix::mat4 model_view_proj(canvas_.projection());
     model_view.translate(0.0, 0.0, -4.0);
     model_view.rotate(45.0, -1.0, 0.0, 0.0);
     model_view_proj *= model_view.getCurrent();

=== modified file 'src/scene-build.cpp'
--- src/scene-build.cpp	2011-10-18 13:40:12 +0000
+++ src/scene-build.cpp	2011-10-26 14:09:17 +0000
@@ -30,7 +30,7 @@ 
 
 SceneBuild::SceneBuild(Canvas &pCanvas) :
     Scene(pCanvas, "build"),
-    mOrientModel(false)
+    orientModel_(false)
 {
     const ModelMap& modelMap = Model::find_models();
     std::string optionDesc("Which model to use [");
@@ -48,11 +48,11 @@ 
         doSeparator = true;
     }
     optionDesc += "]";
-    mOptions["use-vbo"] = Scene::Option("use-vbo", "true",
+    options_["use-vbo"] = Scene::Option("use-vbo", "true",
                                         "Whether to use VBOs for rendering [true,false]");
-    mOptions["interleave"] = Scene::Option("interleave", "false",
+    options_["interleave"] = Scene::Option("interleave", "false",
                                            "Whether to interleave vertex attribute data [true,false]");
-    mOptions["model"] = Scene::Option("model", "horse",
+    options_["model"] = Scene::Option("model", "horse",
                                       optionDesc);
 }
 
@@ -60,22 +60,24 @@ 
 {
 }
 
-int SceneBuild::load()
+int
+SceneBuild::load()
 {
-    mRotationSpeed = 36.0f;
+    rotationSpeed_ = 36.0f;
 
-    mRunning = false;
+    running_ = false;
 
     return 1;
 }
 
-void SceneBuild::unload()
+void
+SceneBuild::unload()
 {
-    mMesh.reset();
-
+    mesh_.reset();
 }
 
-void SceneBuild::setup()
+void
+SceneBuild::setup()
 {
     using LibMatrix::vec3;
 
@@ -93,14 +95,14 @@ 
     vtx_source.add_const("LightSourcePosition", lightPosition);
     vtx_source.add_const("MaterialDiffuse", materialDiffuse);
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_source.str(),
+    if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
         return;
     }
 
     Model model;
-    const std::string& whichModel(mOptions["model"].value);
+    const std::string& whichModel(options_["model"].value);
     bool modelLoaded = model.load(whichModel);
 
     if(!modelLoaded)
@@ -123,9 +125,9 @@ 
     // Horse rotates around the Y axis
     if (whichModel == "buddha" || whichModel == "dragon")
     {
-        mOrientModel = true;
-        mOrientationAngle = -90.0;
-        mOrientationVec = vec3(1.0, 0.0, 0.0);
+        orientModel_ = true;
+        orientationAngle_ = -90.0;
+        orientationVec_ = vec3(1.0, 0.0, 0.0);
     }
 
     model.calculate_normals();
@@ -135,104 +137,106 @@ 
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypePosition, 3));
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypeNormal, 3));
 
-    model.convert_to_mesh(mMesh, attribs);
+    model.convert_to_mesh(mesh_, attribs);
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    attrib_locations.push_back(mProgram["normal"].location());
-    mMesh.set_attrib_locations(attrib_locations);
-
-    mUseVbo = (mOptions["use-vbo"].value == "true");
-    bool interleave = (mOptions["interleave"].value == "true");
-
-    mMesh.vbo_update_method(Mesh::VBOUpdateMethodMap);
-    mMesh.interleave(interleave);
-
-    if (mUseVbo)
-        mMesh.build_vbo();
+    attrib_locations.push_back(program_["position"].location());
+    attrib_locations.push_back(program_["normal"].location());
+    mesh_.set_attrib_locations(attrib_locations);
+
+    useVbo_ = (options_["use-vbo"].value == "true");
+    bool interleave = (options_["interleave"].value == "true");
+
+    mesh_.vbo_update_method(Mesh::VBOUpdateMethodMap);
+    mesh_.interleave(interleave);
+
+    if (useVbo_)
+        mesh_.build_vbo();
     else
-        mMesh.build_array();
+        mesh_.build_array();
 
     /* Calculate a projection matrix that is a good fit for the model */
     vec3 maxVec = model.maxVec();
     vec3 minVec = model.minVec();
     vec3 diffVec = maxVec - minVec;
-    mCenterVec = maxVec + minVec;
-    mCenterVec /= 2.0;
+    centerVec_ = maxVec + minVec;
+    centerVec_ /= 2.0;
     float diameter = diffVec.length();
-    mRadius = diameter / 2;
-    float fovy = 2.0 * atanf(mRadius / (2.0 + mRadius));
+    radius_ = diameter / 2;
+    float fovy = 2.0 * atanf(radius_ / (2.0 + radius_));
     fovy /= M_PI;
     fovy *= 180.0;
-    float aspect(static_cast<float>(mCanvas.width())/static_cast<float>(mCanvas.height()));
-    mPerspective.setIdentity();
-    mPerspective *= LibMatrix::Mat4::perspective(fovy, aspect, 2.0, 2.0 + diameter); 
-
-    mProgram.start();
-
-    mCurrentFrame = 0;
-    mRotation = 0.0;
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    float aspect(static_cast<float>(canvas_.width())/static_cast<float>(canvas_.height()));
+    perspective_.setIdentity();
+    perspective_ *= LibMatrix::Mat4::perspective(fovy, aspect, 2.0, 2.0 + diameter);
+
+    program_.start();
+
+    currentFrame_ = 0;
+    rotation_ = 0.0;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
 void
 SceneBuild::teardown()
 {
-    mProgram.stop();
-    mProgram.release();
+    program_.stop();
+    program_.release();
 
-    mMesh.reset();
+    mesh_.reset();
 
     Scene::teardown();
 }
 
-void SceneBuild::update()
+void
+SceneBuild::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double dt = current_time - mLastUpdateTime;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    double dt = current_time - lastUpdateTime_;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
-    mRotation += mRotationSpeed * dt;
+    rotation_ += rotationSpeed_ * dt;
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
-void SceneBuild::draw()
+void
+SceneBuild::draw()
 {
     LibMatrix::Stack4 model_view;
 
     // Load the ModelViewProjectionMatrix uniform in the shader
-    LibMatrix::mat4 model_view_proj(mPerspective);
-    model_view.translate(-mCenterVec.x(), -mCenterVec.y(), -(mCenterVec.z() + 2.0 + mRadius));
-    model_view.rotate(mRotation, 0.0f, 1.0f, 0.0f);
-    if (mOrientModel)
+    LibMatrix::mat4 model_view_proj(perspective_);
+    model_view.translate(-centerVec_.x(), -centerVec_.y(), -(centerVec_.z() + 2.0 + radius_));
+    model_view.rotate(rotation_, 0.0f, 1.0f, 0.0f);
+    if (orientModel_)
     {
-        model_view.rotate(mOrientationAngle, mOrientationVec.x(), mOrientationVec.y(), mOrientationVec.z());
+        model_view.rotate(orientationAngle_, orientationVec_.x(), orientationVec_.y(), orientationVec_.z());
     }
     model_view_proj *= model_view.getCurrent();
 
-    mProgram["ModelViewProjectionMatrix"] = model_view_proj;
+    program_["ModelViewProjectionMatrix"] = model_view_proj;
 
     // Load the NormalMatrix uniform in the shader. The NormalMatrix is the
     // inverse transpose of the model view matrix.
     LibMatrix::mat4 normal_matrix(model_view.getCurrent());
     normal_matrix.inverse().transpose();
-    mProgram["NormalMatrix"] = normal_matrix;
+    program_["NormalMatrix"] = normal_matrix;
 
-    if (mUseVbo) {
-        mMesh.render_vbo();
+    if (useVbo_) {
+        mesh_.render_vbo();
     }
     else {
-        mMesh.render_array();
+        mesh_.render_array();
     }
 }
 
@@ -241,12 +245,12 @@ 
 {
     static const double radius_3d(std::sqrt(3.0));
 
-    if (mRotation != 0)
+    if (rotation_ != 0)
         return Scene::ValidationUnknown;
 
     Canvas::Pixel ref(0xa7, 0xa7, 0xa7, 0xff);
-    Canvas::Pixel pixel = mCanvas.read_pixel(mCanvas.width() / 2,
-                                             mCanvas.height() / 2);
+    Canvas::Pixel pixel = canvas_.read_pixel(canvas_.width() / 2,
+                                             canvas_.height() / 2);
 
     double dist = pixel_value_distance(pixel, ref);
     if (dist < radius_3d + 0.01) {

=== modified file 'src/scene-bump.cpp'
--- src/scene-bump.cpp	2011-10-07 18:35:47 +0000
+++ src/scene-bump.cpp	2011-10-26 14:09:17 +0000
@@ -28,9 +28,9 @@ 
 
 SceneBump::SceneBump(Canvas &pCanvas) :
     Scene(pCanvas, "bump"),
-    mTexture(0), mRotation(0.0f), mRotationSpeed(0.0f)
+    texture_(0), rotation_(0.0f), rotationSpeed_(0.0f)
 {
-    mOptions["bump-render"] = Scene::Option("bump-render", "off",
+    options_["bump-render"] = Scene::Option("bump-render", "off",
                                             "How to render bumps [off, normals, high-poly]");
 }
 
@@ -38,16 +38,18 @@ 
 {
 }
 
-int SceneBump::load()
+int
+SceneBump::load()
 {
-    mRotationSpeed = 36.0f;
+    rotationSpeed_ = 36.0f;
 
-    mRunning = false;
+    running_ = false;
 
     return 1;
 }
 
-void SceneBump::unload()
+void
+SceneBump::unload()
 {
 }
 
@@ -80,7 +82,7 @@ 
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypePosition, 3));
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypeNormal, 3));
 
-    model.convert_to_mesh(mMesh, attribs);
+    model.convert_to_mesh(mesh_, attribs);
 
     /* Load shaders */
     ShaderSource vtx_source(vtx_shader_filename);
@@ -90,16 +92,16 @@ 
     frg_source.add_const("LightSourcePosition", lightPosition);
     frg_source.add_const("LightSourceHalfVector", halfVector);
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_source.str(),
+    if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
         return;
     }
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    attrib_locations.push_back(mProgram["normal"].location());
-    mMesh.set_attrib_locations(attrib_locations);
+    attrib_locations.push_back(program_["position"].location());
+    attrib_locations.push_back(program_["normal"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 }
 
 void
@@ -119,7 +121,7 @@ 
     halfVector += LibMatrix::vec3(0.0, 0.0, 1.0);
     halfVector.normalize();
 
-    /* 
+    /*
      * We don't care about the vertex normals. We are using a per-fragment
      * normal map (in object space coordinates).
      */
@@ -127,7 +129,7 @@ 
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypePosition, 3));
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypeTexcoord, 2));
 
-    model.convert_to_mesh(mMesh, attribs);
+    model.convert_to_mesh(mesh_, attribs);
 
     /* Load shaders */
     ShaderSource vtx_source(vtx_shader_filename);
@@ -137,26 +139,27 @@ 
     frg_source.add_const("LightSourcePosition", lightPosition);
     frg_source.add_const("LightSourceHalfVector", halfVector);
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_source.str(),
+    if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
         return;
     }
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    attrib_locations.push_back(mProgram["texcoord"].location());
-    mMesh.set_attrib_locations(attrib_locations);
+    attrib_locations.push_back(program_["position"].location());
+    attrib_locations.push_back(program_["texcoord"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 
-    Texture::load(GLMARK_DATA_PATH"/textures/asteroid-normal-map.png", &mTexture,
+    Texture::load(GLMARK_DATA_PATH"/textures/asteroid-normal-map.png", &texture_,
                   GL_NEAREST, GL_NEAREST, 0);
 }
 
-void SceneBump::setup()
+void
+SceneBump::setup()
 {
     Scene::setup();
 
-    const std::string &bump_render = mOptions["bump-render"].value;
+    const std::string &bump_render = options_["bump-render"].value;
 
     Model::find_models();
     if (bump_render == "normals")
@@ -165,72 +168,74 @@ 
         setup_model_plain(bump_render);
 
 
-    mMesh.build_vbo();
+    mesh_.build_vbo();
 
-    mProgram.start();
+    program_.start();
 
     // Load texture sampler value
-    mProgram["NormalMap"] = 0;
+    program_["NormalMap"] = 0;
 
-    mCurrentFrame = 0;
-    mRotation = 0.0;
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    currentFrame_ = 0;
+    rotation_ = 0.0;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
 void
 SceneBump::teardown()
 {
-    mMesh.reset();
-
-    mProgram.stop();
-    mProgram.release();
-
-    glDeleteTextures(1, &mTexture);
-    mTexture = 0;
+    mesh_.reset();
+
+    program_.stop();
+    program_.release();
+
+    glDeleteTextures(1, &texture_);
+    texture_ = 0;
 
     Scene::teardown();
 }
 
-void SceneBump::update()
+void
+SceneBump::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double dt = current_time - mLastUpdateTime;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    double dt = current_time - lastUpdateTime_;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
-    mRotation += mRotationSpeed * dt;
+    rotation_ += rotationSpeed_ * dt;
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
-void SceneBump::draw()
+void
+SceneBump::draw()
 {
     LibMatrix::Stack4 model_view;
 
     // Load the ModelViewProjectionMatrix uniform in the shader
-    LibMatrix::mat4 model_view_proj(mCanvas.projection());
+    LibMatrix::mat4 model_view_proj(canvas_.projection());
 
     model_view.translate(0.0f, 0.0f, -3.5f);
-    model_view.rotate(mRotation, 0.0f, 1.0f, 0.0f);
+    model_view.rotate(rotation_, 0.0f, 1.0f, 0.0f);
     model_view_proj *= model_view.getCurrent();
 
-    mProgram["ModelViewProjectionMatrix"] = model_view_proj;
+    program_["ModelViewProjectionMatrix"] = model_view_proj;
 
     // Load the NormalMatrix uniform in the shader. The NormalMatrix is the
     // inverse transpose of the model view matrix.
     LibMatrix::mat4 normal_matrix(model_view.getCurrent());
     normal_matrix.inverse().transpose();
-    mProgram["NormalMatrix"] = normal_matrix;
+    program_["NormalMatrix"] = normal_matrix;
 
-    mMesh.render_vbo();
+    mesh_.render_vbo();
 }
 
 Scene::ValidationResult
@@ -238,15 +243,15 @@ 
 {
     static const double radius_3d(std::sqrt(3.0));
 
-    if (mRotation != 0) 
+    if (rotation_ != 0)
         return Scene::ValidationUnknown;
 
     Canvas::Pixel ref;
 
-    Canvas::Pixel pixel = mCanvas.read_pixel(mCanvas.width() / 2,
-                                             mCanvas.height() / 2);
+    Canvas::Pixel pixel = canvas_.read_pixel(canvas_.width() / 2,
+                                             canvas_.height() / 2);
 
-    const std::string &bump_render = mOptions["bump-render"].value;
+    const std::string &bump_render = options_["bump-render"].value;
 
     if (bump_render == "off")
         ref = Canvas::Pixel(0x81, 0x81, 0x81, 0xff);

=== modified file 'src/scene-conditionals.cpp'
--- src/scene-conditionals.cpp	2011-08-31 21:22:27 +0000
+++ src/scene-conditionals.cpp	2011-11-01 16:46:08 +0000
@@ -25,9 +25,9 @@ 
 #include "vec.h"
 #include "log.h"
 #include "shader-source.h"
+#include "util.h"
 
 #include <cmath>
-#include <sstream>
 
 static const std::string shader_file_base(GLMARK_DATA_PATH"/shaders/conditionals");
 
@@ -39,13 +39,13 @@ 
 SceneConditionals::SceneConditionals(Canvas &pCanvas) :
     SceneGrid(pCanvas, "conditionals")
 {
-    mOptions["fragment-steps"] = Scene::Option("fragment-steps", "1",
+    options_["fragment-steps"] = Scene::Option("fragment-steps", "1",
             "The number of computational steps in the fragment shader");
-    mOptions["fragment-conditionals"] = Scene::Option("fragment-conditionals", "true",
+    options_["fragment-conditionals"] = Scene::Option("fragment-conditionals", "true",
             "Whether each computational step includes an if-else clause");
-    mOptions["vertex-steps"] = Scene::Option("vertex-steps", "1",
+    options_["vertex-steps"] = Scene::Option("vertex-steps", "1",
             "The number of computational steps in the vertex shader");
-    mOptions["vertex-conditionals"] = Scene::Option("vertex-conditionals", "true",
+    options_["vertex-conditionals"] = Scene::Option("vertex-conditionals", "true",
             "Whether each computational step includes an if-else clause");
 }
 
@@ -89,38 +89,30 @@ 
     return source.str();
 }
 
-void SceneConditionals::setup()
+void
+SceneConditionals::setup()
 {
     SceneGrid::setup();
 
     /* Parse options */
-    bool vtx_conditionals = mOptions["vertex-conditionals"].value == "true";
-    bool frg_conditionals = mOptions["fragment-conditionals"].value == "true";
-    int vtx_steps = 0;
-    int frg_steps = 0;
-
-    std::stringstream ss;
-
-    ss << mOptions["vertex-steps"].value;
-    ss >> vtx_steps;
-    ss.clear();
-    ss << mOptions["fragment-steps"].value;
-    ss >> frg_steps;
-
+    bool vtx_conditionals = options_["vertex-conditionals"].value == "true";
+    bool frg_conditionals = options_["fragment-conditionals"].value == "true";
+    int vtx_steps(Util::fromString<int>(options_["vertex-steps"].value));
+    int frg_steps(Util::fromString<int>(options_["fragment-steps"].value));
     /* Load shaders */
     std::string vtx_shader(get_vertex_shader_source(vtx_steps, vtx_conditionals));
     std::string frg_shader(get_fragment_shader_source(frg_steps, frg_conditionals));
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_shader, frg_shader))
+    if (!Scene::load_shaders_from_strings(program_, vtx_shader, frg_shader))
         return;
 
-    mProgram.start();
+    program_.start();
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    mMesh.set_attrib_locations(attrib_locations);
+    attrib_locations.push_back(program_["position"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }

=== modified file 'src/scene-default-options.cpp'
--- src/scene-default-options.cpp	2011-06-23 12:48:15 +0000
+++ src/scene-default-options.cpp	2011-10-26 14:09:17 +0000
@@ -22,12 +22,13 @@ 
 #include "scene.h"
 #include "benchmark.h"
 
-void SceneDefaultOptions::setup()
+void
+SceneDefaultOptions::setup()
 {
     const std::map<std::string, Scene *> &scenes = Benchmark::scenes();
 
-    for (std::list<std::pair<std::string, std::string> >::const_iterator iter = mDefaultOptions.begin();
-         iter != mDefaultOptions.end();
+    for (std::list<std::pair<std::string, std::string> >::const_iterator iter = defaultOptions_.begin();
+         iter != defaultOptions_.end();
          iter++)
     {
         for (std::map<std::string, Scene *>::const_iterator scene_iter = scenes.begin();
@@ -42,6 +43,6 @@ 
 bool
 SceneDefaultOptions::set_option(const std::string &opt, const std::string &val)
 {
-    mDefaultOptions.push_back(std::pair<std::string, std::string>(opt, val));
+    defaultOptions_.push_back(std::pair<std::string, std::string>(opt, val));
     return true;
 }

=== modified file 'src/scene-desktop.cpp'
--- src/scene-desktop.cpp	2011-10-13 12:20:03 +0000
+++ src/scene-desktop.cpp	2011-11-01 16:46:08 +0000
@@ -50,9 +50,9 @@ 
 
     unsigned int side = 2 * radius + 1;
 
-    for (size_t i = 0; i < radius + 1; i++) {
+    for (unsigned int i = 0; i < radius + 1; i++) {
         float s2 = 2.0 * sigma * sigma;
-        float k = 1.0 / std::sqrt(M_PI * s2) * std::exp( - ((float)i * i) / s2);
+        float k = 1.0 / std::sqrt(M_PI * s2) * std::exp( - (static_cast<float>(i) * i) / s2);
         std::stringstream ss_tmp;
         ss_tmp << "Kernel" << i;
         frg_source.add_const(ss_tmp.str(), k);
@@ -60,10 +60,10 @@ 
 
     std::stringstream ss;
     ss << "result = " << std::endl;
-   
+
     if (direction == BlurDirectionHorizontal) {
-        for (size_t i = 0; i < side; i++) {
-            int offset = (int)(i - radius);
+        for (unsigned int i = 0; i < side; i++) {
+            int offset = static_cast<int>(i - radius);
             ss << "texture2D(Texture0, TextureCoord + vec2(" <<
                   offset << ".0 * TextureStepX, 0.0)) * Kernel" <<
                   std::abs(offset) << " +" << std::endl;
@@ -71,8 +71,8 @@ 
         ss << "0.0 ;" << std::endl;
     }
     else if (direction == BlurDirectionVertical) {
-        for (size_t i = 0; i < side; i++) {
-            int offset = (int)(i - radius);
+        for (unsigned int i = 0; i < side; i++) {
+            int offset = static_cast<int>(i - radius);
             ss << "texture2D(Texture0, TextureCoord + vec2(0.0, " <<
                   offset << ".0 * TextureStepY)) * Kernel" <<
                   std::abs(offset) << " +" << std::endl;
@@ -80,10 +80,10 @@ 
         ss << "0.0 ;" << std::endl;
     }
     else if (direction == BlurDirectionBoth) {
-        for (size_t i = 0; i < side; i++) {
-            int ioffset = (int)(i - radius);
-            for (size_t j = 0; j < side; j++) {
-                int joffset = (int)(j - radius);
+        for (unsigned int i = 0; i < side; i++) {
+            int ioffset = static_cast<int>(i - radius);
+            for (unsigned int j = 0; j < side; j++) {
+                int joffset = static_cast<int>(j - radius);
                 ss << "texture2D(Texture0, TextureCoord + vec2(" <<
                       ioffset << ".0 * TextureStepX, " <<
                       joffset << ".0 * TextureStepY))" <<
@@ -97,7 +97,7 @@ 
     frg_source.replace("$CONVOLUTION$", ss.str());
 }
 
-/** 
+/**
  * A RenderObject represents a source and target of rendering
  * operations.
  */
@@ -153,7 +153,7 @@ 
             fbo_ = 0;
         }
 
-        /* 
+        /*
          * Release the shader program when object of this class
          * are no longer in use.
          */
@@ -197,7 +197,12 @@ 
         glClear(GL_COLOR_BUFFER_BIT);
     }
 
-    virtual void render_to(RenderObject& target, Program& program = main_program)
+    virtual void render_to(RenderObject& target)
+    {
+        render_to(target, main_program);
+    }
+
+    virtual void render_to(RenderObject& target, Program& program)
     {
         LibMatrix::vec2 anchor(pos_);
         LibMatrix::vec2 ll(pos_ - anchor);
@@ -254,13 +259,13 @@ 
             ll_tex.x(), ur_tex.y(),
             ur_tex.x(), ur_tex.y(),
         };
-            
+
         make_current();
         glBindTexture(GL_TEXTURE_2D, target.texture());
         draw_quad_with_program(position_blur, texcoord_blur, program);
     }
 
-    /** 
+    /**
      * Normalizes a position from [0, size] to [-1.0, 1.0]
      */
     LibMatrix::vec2 normalize_position(const LibMatrix::vec2& pos)
@@ -268,7 +273,7 @@ 
         return pos * 2.0 / size_ - 1.0;
     }
 
-    /** 
+    /**
      * Normalizes a position from [0, size] to [0.0, 1.0]
      */
     LibMatrix::vec2 normalize_texcoord(const LibMatrix::vec2& pos)
@@ -332,7 +337,7 @@ 
 int RenderObject::use_count = 0;
 Program RenderObject::main_program;
 
-/** 
+/**
  * A RenderObject representing the screen.
  *
  * Rendering to this objects renders to the screen framebuffer.
@@ -343,7 +348,7 @@ 
     virtual void init() {}
 };
 
-/** 
+/**
  * A RenderObject with a background image.
  *
  * The image is drawn to the RenderObject automatically when the
@@ -406,7 +411,7 @@ 
     GLuint background_texture_;
 };
 
-/** 
+/**
  * A RenderObject that blurs the target it is drawn to.
  */
 class RenderWindowBlur : public RenderObject
@@ -425,7 +430,7 @@ 
         if (draw_contents_ && RenderWindowBlur::use_count == 0)
             window_contents_.init();
 
-        RenderWindowBlur::use_count++; 
+        RenderWindowBlur::use_count++;
     }
 
     virtual void release()
@@ -446,10 +451,8 @@ 
             window_contents_.size(size);
     }
 
-    virtual void render_to(RenderObject& target, Program& program)
+    virtual void render_to(RenderObject& target)
     {
-        (void)program;
-
         if (separable_) {
             Program& blur_program_h1 = blur_program_h(target.size().x());
             Program& blur_program_v1 = blur_program_v(target.size().y());
@@ -465,7 +468,7 @@ 
             for (unsigned int i = 0; i < passes_; i++) {
                 if (i % 2 == 0)
                     render_from(target, blur_program1);
-                else 
+                else
                     RenderObject::render_to(target, blur_program1);
             }
 
@@ -473,7 +476,7 @@ 
                 RenderObject::render_to(target);
         }
 
-        /* 
+        /*
          * Blend the window contents with the target texture.
          */
         if (draw_contents_) {
@@ -488,7 +491,7 @@ 
 private:
     Program& blur_program(unsigned int w, unsigned int h)
     {
-        /* 
+        /*
          * If the size of the window has changed we must recreate
          * the shader to contain the correct texture step values.
          */
@@ -515,7 +518,7 @@ 
 
     Program& blur_program_h(unsigned int w)
     {
-        /* 
+        /*
          * If the size of the window has changed we must recreate
          * the shader to contain the correct texture step values.
          */
@@ -540,7 +543,7 @@ 
 
     Program& blur_program_v(unsigned int h)
     {
-        /* 
+        /*
          * If the size of the window has changed we must recreate
          * the shader to contain the correct texture step values.
          */
@@ -577,7 +580,7 @@ 
 
 };
 
-/** 
+/**
  * A RenderObject that draws a drop shadow around the window.
  */
 class RenderWindowShadow : public RenderObject
@@ -592,7 +595,7 @@ 
     {
         RenderObject::init();
 
-        /* 
+        /*
          * Only have one instance of the resources.
          * This works only if all windows have the same size, which
          * is currently the case for this scene. If this condition
@@ -607,7 +610,7 @@ 
                 window_contents_.init();
         }
 
-        RenderWindowShadow::use_count++; 
+        RenderWindowShadow::use_count++;
     }
 
     virtual void release()
@@ -640,10 +643,8 @@ 
             window_contents_.size(size);
     }
 
-    virtual void render_to(RenderObject& target, Program& program)
+    virtual void render_to(RenderObject& target)
     {
-        (void)program;
-
         glEnable(GL_BLEND);
         glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
@@ -659,7 +660,7 @@ 
         shadow_v_.position(position() +
                            LibMatrix::vec2(size().x() + shadow_v_.size().y(), 0.0));
         shadow_v_.render_to(target);
-        
+
         /* Bottom right shadow */
         shadow_corner_.rotation(0.0);
         shadow_corner_.position(position() +
@@ -669,7 +670,7 @@ 
 
         /* Top right shadow */
         shadow_corner_.rotation(90.0);
-        shadow_corner_.position(position() + size() + 
+        shadow_corner_.position(position() + size() +
                                 LibMatrix::vec2(shadow_corner_.size().x(),
                                                 -shadow_corner_.size().y()));
         shadow_corner_.render_to(target);
@@ -679,7 +680,7 @@ 
         shadow_corner_.position(position());
         shadow_corner_.render_to(target);
 
-        /* 
+        /*
          * Blend the window contents with the target texture.
          */
         if (draw_contents_) {
@@ -711,10 +712,10 @@ 
 RenderClearImage RenderWindowShadow::shadow_corner_(GLMARK_DATA_PATH"/textures/desktop-shadow-corner.png");
 
 /*******************************
- * SceneDesktop implementation * 
+ * SceneDesktop implementation *
  *******************************/
 
-/** 
+/**
  * Private structure used to avoid contaminating scene.h with all of the
  * SceneDesktop internal classes.
  */
@@ -728,7 +729,7 @@ 
         desktop(GLMARK_DATA_PATH"/textures/effect-2d.png") {}
 
     ~SceneDesktopPrivate() { Util::dispose_pointer_vector(windows); }
-    
+
 };
 
 
@@ -736,19 +737,19 @@ 
     Scene(canvas, "desktop")
 {
     priv_ = new SceneDesktopPrivate();
-    mOptions["effect"] = Scene::Option("effect", "blur",
+    options_["effect"] = Scene::Option("effect", "blur",
                                        "the effect to use [blur]");
-    mOptions["windows"] = Scene::Option("windows", "4",
+    options_["windows"] = Scene::Option("windows", "4",
                                         "the number of windows");
-    mOptions["window-size"] = Scene::Option("window-size", "0.35",
+    options_["window-size"] = Scene::Option("window-size", "0.35",
                                             "the window size as a percentage of the minimum screen dimension [0.0 - 0.5]");
-    mOptions["passes"] = Scene::Option("passes", "1",
+    options_["passes"] = Scene::Option("passes", "1",
                                        "the number of effect passes (effect dependent)");
-    mOptions["blur-radius"] = Scene::Option("blur-radius", "5",
+    options_["blur-radius"] = Scene::Option("blur-radius", "5",
                                             "the blur effect radius (in pixels)");
-    mOptions["separable"] = Scene::Option("separable", "true",
+    options_["separable"] = Scene::Option("separable", "true",
                                           "use separable convolution for the blur effect");
-    mOptions["shadow-size"] = Scene::Option("shadow-size", "20",
+    options_["shadow-size"] = Scene::Option("shadow-size", "20",
                                             "the size of the shadow (in pixels)");
 }
 
@@ -773,28 +774,19 @@ 
 {
     Scene::setup();
 
-    std::stringstream ss;
+    /* Parse the options */
     unsigned int windows(0);
     unsigned int passes(0);
     unsigned int blur_radius(0);
     float window_size_factor(0.0);
     unsigned int shadow_size(0);
-    bool separable(mOptions["separable"].value == "true");
+    bool separable(options_["separable"].value == "true");
 
-    ss << mOptions["windows"].value;
-    ss >> windows;
-    ss.clear();
-    ss << mOptions["window-size"].value;
-    ss >> window_size_factor;
-    ss.clear();
-    ss << mOptions["passes"].value;
-    ss >> passes;
-    ss.clear();
-    ss << mOptions["blur-radius"].value;
-    ss >> blur_radius;
-    ss.clear();
-    ss << mOptions["shadow-size"].value;
-    ss >> shadow_size;
+    windows = Util::fromString<unsigned int>(options_["windows"].value);
+    window_size_factor = Util::fromString<float>(options_["window-size"].value);
+    passes = Util::fromString<unsigned int>(options_["passes"].value);
+    blur_radius = Util::fromString<unsigned int>(options_["blur-radius"].value);
+    shadow_size = Util::fromString<unsigned int>(options_["shadow-size"].value);
 
     /* Ensure we get a transparent clear color for all following operations */
     glClearColor(0.0, 0.0, 0.0, 0.0);
@@ -804,36 +796,35 @@ 
     /* Set up the screen and desktop RenderObjects */
     priv_->screen.init();
     priv_->desktop.init();
-    priv_->screen.size(LibMatrix::vec2(mCanvas.width(), mCanvas.height()));
-    priv_->desktop.size(LibMatrix::vec2(mCanvas.width(), mCanvas.height()));
+    priv_->screen.size(LibMatrix::vec2(canvas_.width(), canvas_.height()));
+    priv_->desktop.size(LibMatrix::vec2(canvas_.width(), canvas_.height()));
 
     /* Create the windows */
-    float angular_step(2.0 * M_PI / windows);
-    unsigned int min_dimension = std::min(mCanvas.width(), mCanvas.height());
+    const float angular_step(2.0 * M_PI / windows);
+    unsigned int min_dimension = std::min(canvas_.width(), canvas_.height());
     float window_size(min_dimension * window_size_factor);
     static const LibMatrix::vec2 corner_offset(window_size / 2.0,
                                                window_size / 2.0);
 
     for (unsigned int i = 0; i < windows; i++) {
-        LibMatrix::vec2 center(mCanvas.width() * (0.5 + 0.25 * cos(i * angular_step)),
-                               mCanvas.height() * (0.5 + 0.25 * sin(i * angular_step)));
+        LibMatrix::vec2 center(canvas_.width() * (0.5 + 0.25 * cos(i * angular_step)),
+                               canvas_.height() * (0.5 + 0.25 * sin(i * angular_step)));
         RenderObject* win;
-        if (mOptions["effect"].value == "shadow")
+        if (options_["effect"].value == "shadow")
             win = new RenderWindowShadow(shadow_size);
         else
             win = new RenderWindowBlur(passes, blur_radius, separable);
-        (void)angular_step;
 
         win->init();
         win->position(center - corner_offset);
         win->size(LibMatrix::vec2(window_size, window_size));
-        /* 
+        /*
          * Set the speed in increments of about 30 degrees (but not exactly,
          * so we don't get windows moving just on the X axis or Y axis).
          */
-        win->speed(LibMatrix::vec2(cos(0.1 + i * M_PI / 6.0) * mCanvas.width() / 3,
-                                   sin(0.1 + i * M_PI / 6.0) * mCanvas.height() / 3));
-        /* 
+        win->speed(LibMatrix::vec2(cos(0.1 + i * M_PI / 6.0) * canvas_.width() / 3,
+                                   sin(0.1 + i * M_PI / 6.0) * canvas_.height() / 3));
+        /*
          * Perform a dummy rendering to ensure internal shaders are initialized
          * now, in order not to affect the benchmarking.
          */
@@ -841,16 +832,16 @@ 
         priv_->windows.push_back(win);
     }
 
-    /* 
+    /*
      * Ensure the screen is the current rendering target (it might have changed
      * to a FBO in the previous steps).
      */
     priv_->screen.make_current();
 
-    mCurrentFrame = 0;
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    currentFrame_ = 0;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
 void
@@ -872,10 +863,10 @@ 
 SceneDesktop::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double dt = current_time - mLastUpdateTime;
-    double elapsed_time = current_time - mStartTime;
+    double dt = current_time - lastUpdateTime_;
+    double elapsed_time = current_time - startTime_;
 
-    mLastUpdateTime = current_time;
+    lastUpdateTime_ = current_time;
 
     std::vector<RenderObject *>& windows(priv_->windows);
 
@@ -894,14 +885,14 @@ 
                 win->position().y() + win->speed().y() * dt);
 
         if (new_pos.x() < 0.0 ||
-            new_pos.x() + win->size().x() > ((float)mCanvas.width()))
+            new_pos.x() + win->size().x() > static_cast<float>(canvas_.width()))
         {
             win->speed(LibMatrix::vec2(-win->speed().x(), win->speed().y()));
             should_update = false;
         }
 
         if (new_pos.y() < 0.0 ||
-            new_pos.y() + win->size().y() > ((float)mCanvas.height()))
+            new_pos.y() + win->size().y() > static_cast<float>(canvas_.height()))
         {
             win->speed(LibMatrix::vec2(win->speed().x(), -win->speed().y()));
             should_update = false;
@@ -911,12 +902,12 @@ 
             win->position(new_pos);
     }
 
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
 void

=== modified file 'src/scene-effect-2d.cpp'
--- src/scene-effect-2d.cpp	2011-11-02 14:43:36 +0000
+++ src/scene-effect-2d.cpp	2011-11-02 14:56:58 +0000
@@ -36,10 +36,10 @@ 
 SceneEffect2D::SceneEffect2D(Canvas &pCanvas) :
     Scene(pCanvas, "effect2d")
 {
-    mOptions["kernel"] = Scene::Option("kernel",
+    options_["kernel"] = Scene::Option("kernel",
         "0,0,0;0,1,0;0,0,0",
         "The convolution kernel matrix to use [format: \"a,b,c...;d,e,f...\"");;
-    mOptions["normalize"] = Scene::Option("normalize", "true",
+    options_["normalize"] = Scene::Option("normalize", "true",
         "Whether to normalize the supplied convolution kernel matrix [true,false]");
 }
 
@@ -113,7 +113,7 @@ 
     ss_def << std::fixed;
     ss_convolution.precision(1);
     ss_convolution << std::fixed;
-    
+
     ss_convolution << "result = ";
 
     for(std::vector<float>::const_iterator iter = array.begin();
@@ -143,12 +143,12 @@ 
     return source.str();
 }
 
-/** 
+/**
  * Creates a string containing a printout of a kernel matrix.
- * 
+ *
  * @param filter the vector containing the filter coefficients
  * @param width the width of the filter
- * 
+ *
  * @return the printout
  */
 static std::string
@@ -170,19 +170,19 @@ 
     return ss.str();
 }
 
-/** 
+/**
  * Parses a string representation of a matrix and returns it
  * in row-major format.
  *
  * In the string representation, elements are delimited using
  * commas (',') and rows are delimited using semi-colons (';').
  * eg 0,0,0;0,1.0,0;0,0,0
- * 
+ *
  * @param str the matrix string representation to parse
  * @param matrix the float vector to populate
  * @param[out] width the width of the matrix
- * @param[out] height the height of the matrix 
- * 
+ * @param[out] height the height of the matrix
+ *
  * @return whether parsing succeeded
  */
 static bool
@@ -205,21 +205,18 @@ 
 
         if (w != UINT_MAX && elems.size() != w) {
             Log::error("Matrix row %u contains %u elements, whereas previous"
-                       " rows had %u\n", 
+                       " rows had %u\n",
                        iter - rows.begin(), elems.size(), w);
             return false;
         }
 
         w = elems.size();
-        
+
         for (std::vector<std::string>::const_iterator iter_el = elems.begin();
              iter_el != elems.end();
              iter_el++)
         {
-            std::stringstream ss(*iter_el);
-            float f;
-
-            ss >> f;
+            float f(Util::fromString<float>(*iter_el));
             matrix.push_back(f);
             if (iter_el == elems.begin())
                 Log::debug("%f ", f);
@@ -232,13 +229,13 @@ 
 
     width = w;
     height = rows.size();
-    
+
     return true;
 }
 
-/** 
+/**
  * Normalizes a convolution kernel matrix.
- * 
+ *
  * @param filter the filter to normalize
  */
 static void
@@ -246,7 +243,7 @@ 
 {
     float sum = std::accumulate(kernel.begin(), kernel.end(), 0.0);
 
-    /* 
+    /*
      * If sum is essentially zero, perform a zero-sum normalization.
      * This normalizes positive and negative values separately,
      */
@@ -261,37 +258,40 @@ 
         }
     }
 
-    /* 
+    /*
      * We can simply compare with 0.0f here, because we just care about
      * avoiding division-by-zero.
      */
     if (sum == 0.0)
         return;
-        
+
     for (std::vector<float>::iterator iter = kernel.begin();
          iter != kernel.end();
          iter++)
     {
-        *iter /= sum; 
+        *iter /= sum;
     }
 
 }
 
-int SceneEffect2D::load()
+int
+SceneEffect2D::load()
 {
     Texture::load(GLMARK_DATA_PATH"/textures/effect-2d.png", &texture_,
                   GL_NEAREST, GL_NEAREST, 0);
-    mRunning = false;
+    running_ = false;
 
     return 1;
 }
 
-void SceneEffect2D::unload()
+void
+SceneEffect2D::unload()
 {
     glDeleteTextures(1, &texture_);
 }
 
-void SceneEffect2D::setup()
+void
+SceneEffect2D::setup()
 {
     Scene::setup();
 
@@ -302,14 +302,14 @@ 
     unsigned int kernel_height = 0;
 
     /* Parse the kernel matrix from the options */
-    if (!parse_matrix(mOptions["kernel"].value, kernel,
+    if (!parse_matrix(options_["kernel"].value, kernel,
                       kernel_width, kernel_height))
     {
         return;
     }
 
     /* Normalize the kernel matrix if needed */
-    if (mOptions["normalize"].value == "true") {
+    if (options_["normalize"].value == "true") {
         normalize(kernel);
         Log::debug("Normalized kernel matrix:\n%s",
                    kernel_printout(kernel, kernel_width).c_str());
@@ -318,7 +318,7 @@ 
     /* Create and load the shaders */
     ShaderSource vtx_source(vtx_shader_filename);
     ShaderSource frg_source;
-    frg_source.append(create_convolution_fragment_shader(mCanvas, kernel,
+    frg_source.append(create_convolution_fragment_shader(canvas_, kernel,
                                                          kernel_width,
                                                          kernel_height));
 
@@ -347,13 +347,14 @@ 
     // Load texture sampler value
     program_["Texture0"] = 0;
 
-    mCurrentFrame = 0;
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    currentFrame_ = 0;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
-void SceneEffect2D::teardown()
+void
+SceneEffect2D::teardown()
 {
     mesh_.reset();
 
@@ -363,22 +364,24 @@ 
     Scene::teardown();
 }
 
-void SceneEffect2D::update()
+void
+SceneEffect2D::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
-void SceneEffect2D::draw()
+void
+SceneEffect2D::draw()
 {
     glActiveTexture(GL_TEXTURE0);
     glBindTexture(GL_TEXTURE_2D, texture_);

=== modified file 'src/scene-function.cpp'
--- src/scene-function.cpp	2011-08-31 21:22:27 +0000
+++ src/scene-function.cpp	2011-11-01 16:46:08 +0000
@@ -25,8 +25,7 @@ 
 #include "vec.h"
 #include "log.h"
 #include "shader-source.h"
-
-#include <sstream>
+#include "util.h"
 
 static const std::string shader_file_base(GLMARK_DATA_PATH"/shaders/function");
 
@@ -39,17 +38,17 @@ 
 SceneFunction::SceneFunction(Canvas &pCanvas) :
     SceneGrid(pCanvas, "function")
 {
-    mOptions["fragment-steps"] = Scene::Option("fragment-steps", "1",
+    options_["fragment-steps"] = Scene::Option("fragment-steps", "1",
             "The number of computational steps in the fragment shader");
-    mOptions["fragment-function"] = Scene::Option("fragment-function", "true",
+    options_["fragment-function"] = Scene::Option("fragment-function", "true",
             "Whether each computational step includes a function call");
-    mOptions["vertex-steps"] = Scene::Option("vertex-steps", "1",
+    options_["vertex-steps"] = Scene::Option("vertex-steps", "1",
             "The number of computational steps in the vertex shader");
-    mOptions["vertex-function"] = Scene::Option("vertex-function", "true",
+    options_["vertex-function"] = Scene::Option("vertex-function", "true",
             "Whether each computational step includes an if-else clause");
-    mOptions["vertex-complexity"] = Scene::Option("vertex-complexity", "low",
+    options_["vertex-complexity"] = Scene::Option("vertex-complexity", "low",
             "The complexity of each computational step in the vertex shader");
-    mOptions["fragment-complexity"] = Scene::Option("fragment-complexity", "low",
+    options_["fragment-complexity"] = Scene::Option("fragment-complexity", "low",
             "The complexity of each computational step in the fragment shader");
 }
 
@@ -115,25 +114,18 @@ 
     return source.str();
 }
 
-void SceneFunction::setup()
+void
+SceneFunction::setup()
 {
     SceneGrid::setup();
 
     /* Parse options */
-    bool vtx_function = mOptions["vertex-function"].value == "true";
-    bool frg_function = mOptions["fragment-function"].value == "true";
-    std::string vtx_complexity = mOptions["vertex-complexity"].value;
-    std::string frg_complexity = mOptions["fragment-complexity"].value;
-    int vtx_steps = 0;
-    int frg_steps = 0;
-
-    std::stringstream ss;
-
-    ss << mOptions["vertex-steps"].value;
-    ss >> vtx_steps;
-    ss.clear();
-    ss << mOptions["fragment-steps"].value;
-    ss >> frg_steps;
+    bool vtx_function = options_["vertex-function"].value == "true";
+    bool frg_function = options_["fragment-function"].value == "true";
+    std::string vtx_complexity = options_["vertex-complexity"].value;
+    std::string frg_complexity = options_["fragment-complexity"].value;
+    int vtx_steps = Util::fromString<int>(options_["vertex-steps"].value);
+    int frg_steps = Util::fromString<int>(options_["fragment-steps"].value);
 
     /* Load shaders */
     std::string vtx_shader(get_vertex_shader_source(vtx_steps, vtx_function,
@@ -141,16 +133,16 @@ 
     std::string frg_shader(get_fragment_shader_source(frg_steps, frg_function,
                                                       frg_complexity));
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_shader, frg_shader))
+    if (!Scene::load_shaders_from_strings(program_, vtx_shader, frg_shader))
         return;
 
-    mProgram.start();
+    program_.start();
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    mMesh.set_attrib_locations(attrib_locations);
+    attrib_locations.push_back(program_["position"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }

=== modified file 'src/scene-grid.cpp'
--- src/scene-grid.cpp	2011-08-31 21:22:27 +0000
+++ src/scene-grid.cpp	2011-11-01 16:46:08 +0000
@@ -24,15 +24,14 @@ 
 #include "stack.h"
 #include "vec.h"
 #include "log.h"
-
-#include <sstream>
+#include "util.h"
 
 SceneGrid::SceneGrid(Canvas &pCanvas, const std::string &name) :
     Scene(pCanvas, name)
 {
-    mOptions["grid-size"] = Scene::Option("grid-size", "32",
+    options_["grid-size"] = Scene::Option("grid-size", "32",
             "The number of squares per side of the grid (controls the number of vertices)");
-    mOptions["grid-length"] = Scene::Option("grid-length", "5.0",
+    options_["grid-length"] = Scene::Option("grid-length", "5.0",
             "The length of each side of the grid (normalized) (controls the area drawn to)");
 }
 
@@ -40,92 +39,90 @@ 
 {
 }
 
-int SceneGrid::load()
+int
+SceneGrid::load()
 {
-    mRotationSpeed = 36.0f;
-    mRunning = false;
+    rotationSpeed_ = 36.0f;
+    running_ = false;
 
     return 1;
 }
 
-void SceneGrid::unload()
+void
+SceneGrid::unload()
 {
 }
 
-void SceneGrid::setup()
+void
+SceneGrid::setup()
 {
     Scene::setup();
 
-    int grid_size = 0;
-    double grid_length = 0;
-
-    std::stringstream ss;
-
-    ss << mOptions["grid-size"].value;
-    ss >> grid_size;
-    ss.clear();
-    ss << mOptions["grid-length"].value;
-    ss >> grid_length;
+    int grid_size(Util::fromString<int>(options_["grid-size"].value));
+    double grid_length(Util::fromString<double>(options_["grid-length"].value));
 
     /* Create and configure the grid mesh */
     std::vector<int> vertex_format;
     vertex_format.push_back(3);
-    mMesh.set_vertex_format(vertex_format);
+    mesh_.set_vertex_format(vertex_format);
 
-    /* 
+    /*
      * The spacing needed in order for the area of the requested grid
      * to be the same as the area of a grid with size 32 and spacing 0.02.
      */
     double spacing = grid_length * (1 - 4.38 / 5.0) / (grid_size - 1.0);
 
-    mMesh.make_grid(grid_size, grid_size, grid_length, grid_length,
+    mesh_.make_grid(grid_size, grid_size, grid_length, grid_length,
                     grid_size > 1 ? spacing : 0);
-    mMesh.build_vbo();
+    mesh_.build_vbo();
 
-    mCurrentFrame = 0;
-    mRotation = 0.0f;
+    currentFrame_ = 0;
+    rotation_ = 0.0f;
 }
 
-void SceneGrid::teardown()
+void
+SceneGrid::teardown()
 {
-    mProgram.stop();
-    mProgram.release();
-    mMesh.reset();
+    program_.stop();
+    program_.release();
+    mesh_.reset();
 
     Scene::teardown();
 }
 
-void SceneGrid::update()
+void
+SceneGrid::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double dt = current_time - mLastUpdateTime;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    double dt = current_time - lastUpdateTime_;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
-    mRotation += mRotationSpeed * dt;
+    rotation_ += rotationSpeed_ * dt;
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
-void SceneGrid::draw()
+void
+SceneGrid::draw()
 {
     // Load the ModelViewProjectionMatrix uniform in the shader
     LibMatrix::Stack4 model_view;
-    LibMatrix::mat4 model_view_proj(mCanvas.projection());
+    LibMatrix::mat4 model_view_proj(canvas_.projection());
 
     model_view.translate(0.0f, 0.0f, -5.0f);
-    model_view.rotate(mRotation, 0.0f, 0.0f, 1.0f);
+    model_view.rotate(rotation_, 0.0f, 0.0f, 1.0f);
     model_view_proj *= model_view.getCurrent();
 
-    mProgram["ModelViewProjectionMatrix"] = model_view_proj;
+    program_["ModelViewProjectionMatrix"] = model_view_proj;
 
-    mMesh.render_vbo();
+    mesh_.render_vbo();
 }
 
 Scene::ValidationResult

=== modified file 'src/scene-loop.cpp'
--- src/scene-loop.cpp	2011-08-31 21:22:27 +0000
+++ src/scene-loop.cpp	2011-11-01 16:46:08 +0000
@@ -25,8 +25,7 @@ 
 #include "vec.h"
 #include "log.h"
 #include "shader-source.h"
-
-#include <sstream>
+#include "util.h"
 
 static const std::string shader_file_base(GLMARK_DATA_PATH"/shaders/loop");
 
@@ -38,17 +37,17 @@ 
 SceneLoop::SceneLoop(Canvas &pCanvas) :
     SceneGrid(pCanvas, "loop")
 {
-    mOptions["fragment-steps"] = Scene::Option("fragment-steps", "1",
+    options_["fragment-steps"] = Scene::Option("fragment-steps", "1",
             "The number of computational steps in the fragment shader");
-    mOptions["fragment-loop"] = Scene::Option("fragment-function", "true",
+    options_["fragment-loop"] = Scene::Option("fragment-function", "true",
             "Whether to execute the steps in the vertex shader using a for loop");
-    mOptions["vertex-steps"] = Scene::Option("vertex-steps", "1",
+    options_["vertex-steps"] = Scene::Option("vertex-steps", "1",
             "The number of computational steps in the vertex shader");
-    mOptions["vertex-loop"] = Scene::Option("vertex-function", "true",
+    options_["vertex-loop"] = Scene::Option("vertex-function", "true",
             "Whether to execute the steps in the vertex shader using a for loop");
-    mOptions["vertex-uniform"] = Scene::Option("vertex-uniform", "true",
+    options_["vertex-uniform"] = Scene::Option("vertex-uniform", "true",
             "Whether to use a uniform in the vertex shader for the number of loop iterations to perform (i.e. vertex-steps)");
-    mOptions["fragment-uniform"] = Scene::Option("fragment-uniform", "true",
+    options_["fragment-uniform"] = Scene::Option("fragment-uniform", "true",
             "Whether to use a uniform in the fragment shader for the number of loop iterations to perform (i.e. fragment-steps)");
 }
 
@@ -68,9 +67,7 @@ 
             source_main.replace("$NLOOPS$", "FragmentLoops");
         }
         else {
-            std::stringstream ss_steps;
-            ss_steps << steps;
-            source_main.replace("$NLOOPS$", ss_steps.str());
+            source_main.replace("$NLOOPS$", Util::toString(steps));
         }
     }
     else {
@@ -95,9 +92,7 @@ 
             source_main.replace("$NLOOPS$", "VertexLoops");
         }
         else {
-            std::stringstream ss_steps;
-            ss_steps << steps;
-            source_main.replace("$NLOOPS$", ss_steps.str());
+            source_main.replace("$NLOOPS$", Util::toString(steps));
         }
     }
     else {
@@ -111,25 +106,18 @@ 
 }
 
 
-void SceneLoop::setup()
+void
+SceneLoop::setup()
 {
     SceneGrid::setup();
 
     /* Parse options */
-    bool vtx_loop = mOptions["vertex-loop"].value == "true";
-    bool frg_loop = mOptions["fragment-loop"].value == "true";
-    bool vtx_uniform = mOptions["vertex-uniform"].value == "true";
-    bool frg_uniform = mOptions["fragment-uniform"].value == "true";
-    int vtx_steps = 0;
-    int frg_steps = 0;
-
-    std::stringstream ss;
-
-    ss << mOptions["vertex-steps"].value;
-    ss >> vtx_steps;
-    ss.clear();
-    ss << mOptions["fragment-steps"].value;
-    ss >> frg_steps;
+    bool vtx_loop = options_["vertex-loop"].value == "true";
+    bool frg_loop = options_["fragment-loop"].value == "true";
+    bool vtx_uniform = options_["vertex-uniform"].value == "true";
+    bool frg_uniform = options_["fragment-uniform"].value == "true";
+    int vtx_steps = Util::fromString<int>(options_["vertex-steps"].value);
+    int frg_steps = Util::fromString<int>(options_["fragment-steps"].value);
 
     /* Load shaders */
     std::string vtx_shader(get_vertex_shader_source(vtx_steps, vtx_loop,
@@ -137,19 +125,19 @@ 
     std::string frg_shader(get_fragment_shader_source(frg_steps, frg_loop,
                                                       frg_uniform));
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_shader, frg_shader))
+    if (!Scene::load_shaders_from_strings(program_, vtx_shader, frg_shader))
         return;
 
-    mProgram.start();
+    program_.start();
 
-    mProgram["VertexLoops"] = vtx_steps;
-    mProgram["FragmentLoops"] = frg_steps;
+    program_["VertexLoops"] = vtx_steps;
+    program_["FragmentLoops"] = frg_steps;
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    mMesh.set_attrib_locations(attrib_locations);
+    attrib_locations.push_back(program_["position"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }

=== modified file 'src/scene-pulsar.cpp'
--- src/scene-pulsar.cpp	2011-08-31 21:22:27 +0000
+++ src/scene-pulsar.cpp	2011-11-01 16:50:07 +0000
@@ -21,45 +21,57 @@ 
  *  Ben Smith (original glmark benchmark)
  *  Alexandros Frantzis (glmark2)
  *  Marc Ordinas i Llopis, Collabora Ltd. (pulsar scene)
+ *  Jesse Barker
  */
+#include <stdlib.h>
 #include "scene.h"
 #include "mat.h"
 #include "stack.h"
 #include "vec.h"
 #include "log.h"
-#include "program.h"
 #include "shader-source.h"
+#include "util.h"
 
 #include <cmath>
 
+using LibMatrix::vec2;
+using LibMatrix::vec3;
+using LibMatrix::vec4;
+using LibMatrix::mat4;
+using LibMatrix::Stack4;
+
 ScenePulsar::ScenePulsar(Canvas &pCanvas) :
     Scene(pCanvas, "pulsar"),
-    mTexture(0)
+    numQuads_(0),
+    texture_(0)
 {
-    mOptions["quads"] = Scene::Option("quads", "5", "Number of quads to render");
-    mOptions["texture"] = Scene::Option("texture", "false", "Enable texturing");
-    mOptions["light"] = Scene::Option("light", "false", "Enable lighting");
-    mOptions["random"] = Scene::Option("random", "false", "Enable random rotation speeds");
+    options_["quads"] = Scene::Option("quads", "5", "Number of quads to render");
+    options_["texture"] = Scene::Option("texture", "false", "Enable texturing");
+    options_["light"] = Scene::Option("light", "false", "Enable lighting");
+    options_["random"] = Scene::Option("random", "false", "Enable random rotation speeds");
 }
 
 ScenePulsar::~ScenePulsar()
 {
 }
 
-int ScenePulsar::load()
+int
+ScenePulsar::load()
 {
-    mScale = LibMatrix::vec3(1.0, 1.0, 1.0);
+    scale_ = vec3(1.0, 1.0, 1.0);
 
-    mRunning = false;
+    running_ = false;
 
     return 1;
 }
 
-void ScenePulsar::unload()
+void
+ScenePulsar::unload()
 {
 }
 
-void ScenePulsar::setup()
+void
+ScenePulsar::setup()
 {
     Scene::setup();
 
@@ -70,23 +82,21 @@ 
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
     // Create a rotation for each quad.
-    std::stringstream ss;
-    ss << mOptions["quads"].value;
-    ss >> mNumQuads;
+    numQuads_ = Util::fromString<int>(options_["quads"].value);
 
     srand((unsigned)time(0));
-    for (int i = 0; i < mNumQuads; i++) {
-        mRotations.push_back(LibMatrix::vec3());
-        if (mOptions["random"].value == "true") {
-            mRotationSpeeds.push_back(LibMatrix::vec3(((float)rand() / (float)RAND_MAX) * 5.0,
-                                                      ((float)rand() / (float)RAND_MAX) * 5.0,
-                                                      0.0));
+    for (int i = 0; i < numQuads_; i++) {
+        rotations_.push_back(vec3());
+        if (options_["random"].value == "true") {
+            rotationSpeeds_.push_back(vec3((static_cast<float>(rand()) / static_cast<float>(RAND_MAX)) * 5.0,
+                                            (static_cast<float>(rand()) / static_cast<float>(RAND_MAX)) * 5.0,
+                                             0.0));
         }
         else {
             float integral;
             float x_rot = std::modf((i + 1) * M_PI, &integral);
             float y_rot = std::modf((i + 1) * M_E, &integral);
-            mRotationSpeeds.push_back(LibMatrix::vec3(x_rot * 5.0,
+            rotationSpeeds_.push_back(vec3(x_rot * 5.0,
                                                       y_rot * 5.0,
                                                       0.0));
         }
@@ -95,16 +105,16 @@ 
     // Load shaders
     std::string vtx_shader_filename;
     std::string frg_shader_filename;
-    static const LibMatrix::vec4 lightPosition(-20.0f, 20.0f,-20.0f, 1.0f);
-    if (mOptions["light"].value == "true") {
+    static const vec4 lightPosition(-20.0f, 20.0f,-20.0f, 1.0f);
+    if (options_["light"].value == "true") {
         vtx_shader_filename = GLMARK_DATA_PATH"/shaders/pulsar-light.vert";
     } else {
         vtx_shader_filename = GLMARK_DATA_PATH"/shaders/pulsar.vert";
     }
 
-    if (mOptions["texture"].value == "true") {
+    if (options_["texture"].value == "true") {
         frg_shader_filename = GLMARK_DATA_PATH"/shaders/light-basic-tex.frag";
-        Texture::load(GLMARK_DATA_PATH"/textures/crate-base.png", &mTexture,
+        Texture::load(GLMARK_DATA_PATH"/textures/crate-base.png", &texture_,
                       GL_NEAREST, GL_NEAREST, 0);
 
     } else {
@@ -113,12 +123,12 @@ 
 
     ShaderSource vtx_source(vtx_shader_filename);
     ShaderSource frg_source(frg_shader_filename);
-    if (mOptions["light"].value == "true") {
+    if (options_["light"].value == "true") {
         // Load the light position constant
         vtx_source.add_const("LightSourcePosition", lightPosition);
     }
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_source.str(),
+    if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
         return;
@@ -126,23 +136,24 @@ 
 
     create_and_setup_mesh();
 
-    mProgram.start();
-
-    mCurrentFrame = 0;
-
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    program_.start();
+
+    currentFrame_ = 0;
+
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
-void ScenePulsar::teardown()
+void
+ScenePulsar::teardown()
 {
-    mProgram.stop();
-    mProgram.release();
+    program_.stop();
+    program_.release();
 
-    if (mOptions["texture"].value == "true") {
-        glDeleteTextures(1, &mTexture);
-        mTexture = 0;
+    if (options_["texture"].value == "true") {
+        glDeleteTextures(1, &texture_);
+        texture_ = 0;
     }
 
     // Re-enable back-face culling
@@ -150,61 +161,63 @@ 
     // Disable alpha blending
     glDisable(GL_BLEND);
 
-    mPlaneMesh.reset();
+    mesh_.reset();
 
     Scene::teardown();
 }
 
-void ScenePulsar::update()
+void
+ScenePulsar::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double dt = current_time - mLastUpdateTime;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
-    }
-
-    for (int i = 0; i < mNumQuads; i++) {
-        mRotations[i] += mRotationSpeeds[i] * (dt * 60);
-    }
-
-    mScale = LibMatrix::vec3(cos(elapsed_time / 3.60) * 10.0, sin(elapsed_time / 3.60) * 10.0, 1.0);
-
-    mCurrentFrame++;
+    double dt = current_time - lastUpdateTime_;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
+    }
+
+    for (int i = 0; i < numQuads_; i++) {
+        rotations_[i] += rotationSpeeds_[i] * (dt * 60);
+    }
+
+    scale_ = vec3(cos(elapsed_time / 3.60) * 10.0, sin(elapsed_time / 3.60) * 10.0, 1.0);
+
+    currentFrame_++;
 }
 
-void ScenePulsar::draw()
+void
+ScenePulsar::draw()
 {
-    if (mOptions["texture"].value == "true") {
+    if (options_["texture"].value == "true") {
         glActiveTexture(GL_TEXTURE0);
-        glBindTexture(GL_TEXTURE_2D, mTexture);
+        glBindTexture(GL_TEXTURE_2D, texture_);
     }
 
-    for (int i = 0; i < mNumQuads; i++) {
+    for (int i = 0; i < numQuads_; i++) {
         // Load the ModelViewProjectionMatrix uniform in the shader
-        LibMatrix::Stack4 model_view;
-        LibMatrix::mat4 model_view_proj(mCanvas.projection());
-        model_view.scale(mScale.x(), mScale.y(), mScale.z());
+        Stack4 model_view;
+        mat4 model_view_proj(canvas_.projection());
+        model_view.scale(scale_.x(), scale_.y(), scale_.z());
         model_view.translate(0.0f, 0.0f, -10.0f);
-        model_view.rotate(mRotations[i].x(), 1.0f, 0.0f, 0.0f);
-        model_view.rotate(mRotations[i].y(), 0.0f, 1.0f, 0.0f);
-        model_view.rotate(mRotations[i].z(), 0.0f, 0.0f, 1.0f);
+        model_view.rotate(rotations_[i].x(), 1.0f, 0.0f, 0.0f);
+        model_view.rotate(rotations_[i].y(), 0.0f, 1.0f, 0.0f);
+        model_view.rotate(rotations_[i].z(), 0.0f, 0.0f, 1.0f);
         model_view_proj *= model_view.getCurrent();
-        mProgram["ModelViewProjectionMatrix"] = model_view_proj;
+        program_["ModelViewProjectionMatrix"] = model_view_proj;
 
-        if (mOptions["light"].value == "true") {
+        if (options_["light"].value == "true") {
             // Load the NormalMatrix uniform in the shader. The NormalMatrix is the
             // inverse transpose of the model view matrix.
-            LibMatrix::mat4 normal_matrix(model_view.getCurrent());
+            mat4 normal_matrix(model_view.getCurrent());
             normal_matrix.inverse().transpose();
-            mProgram["NormalMatrix"] = normal_matrix;
+            program_["NormalMatrix"] = normal_matrix;
         }
 
-        mPlaneMesh.render_vbo();
+        mesh_.render_vbo();
     }
 }
 
@@ -214,42 +227,43 @@ 
     return ValidationUnknown;
 }
 
-void ScenePulsar::create_and_setup_mesh()
+void
+ScenePulsar::create_and_setup_mesh()
 {
-    bool texture = mOptions["texture"].value == "true";
-    bool light = mOptions["light"].value == "true";
+    bool texture = options_["texture"].value == "true";
+    bool light = options_["light"].value == "true";
 
     struct PlaneMeshVertex {
-        LibMatrix::vec3 position;
-        LibMatrix::vec4 color;
-        LibMatrix::vec2 texcoord;
-        LibMatrix::vec3 normal;
+        vec3 position;
+        vec4 color;
+        vec2 texcoord;
+        vec3 normal;
     };
 
     PlaneMeshVertex plane_vertices[] = {
         {
-          LibMatrix::vec3(-1.0, -1.0, 0.0),
-          LibMatrix::vec4(1.0, 0.0, 0.0, 0.4),
-          LibMatrix::vec2(0.0, 0.0),
-          LibMatrix::vec3(0.0, 0.0, 1.0)
-        },
-        {
-          LibMatrix::vec3(-1.0, 1.0, 0.0),
-          LibMatrix::vec4(0.0, 1.0, 0.0, 0.4),
-          LibMatrix::vec2(0.0, 1.0),
-          LibMatrix::vec3(0.0, 0.0, 1.0)
-        },
-        {
-          LibMatrix::vec3(1.0, 1.0, 0.0),
-          LibMatrix::vec4(0.0, 0.0, 1.0, 0.4),
-          LibMatrix::vec2(1.0, 1.0),
-          LibMatrix::vec3(0.0, 0.0, 1.0)
-        },
-        {
-          LibMatrix::vec3(1.0, -1.0, 0.0),
-          LibMatrix::vec4(1.0, 1.0, 1.0, 1.0),
-          LibMatrix::vec2(1.0, 0.0),
-          LibMatrix::vec3(0.0, 0.0, 1.0)
+          vec3(-1.0, -1.0, 0.0),
+          vec4(1.0, 0.0, 0.0, 0.4),
+          vec2(0.0, 0.0),
+          vec3(0.0, 0.0, 1.0)
+        },
+        {
+          vec3(-1.0, 1.0, 0.0),
+          vec4(0.0, 1.0, 0.0, 0.4),
+          vec2(0.0, 1.0),
+          vec3(0.0, 0.0, 1.0)
+        },
+        {
+          vec3(1.0, 1.0, 0.0),
+          vec4(0.0, 0.0, 1.0, 0.4),
+          vec2(1.0, 1.0),
+          vec3(0.0, 0.0, 1.0)
+        },
+        {
+          vec3(1.0, -1.0, 0.0),
+          vec4(1.0, 1.0, 1.0, 1.0),
+          vec2(1.0, 0.0),
+          vec3(0.0, 0.0, 1.0)
         }
     };
 
@@ -264,31 +278,31 @@ 
     if (light)
         vertex_format.push_back(3); // Normal
 
-    mPlaneMesh.set_vertex_format(vertex_format);
+    mesh_.set_vertex_format(vertex_format);
 
     // Build the plane mesh
     for (size_t i = 0; i < sizeof(vertex_index) / sizeof(*vertex_index); i++) {
         PlaneMeshVertex& vertex = plane_vertices[vertex_index[i]];
 
-        mPlaneMesh.next_vertex();
-        mPlaneMesh.set_attrib(0, vertex.position);
-        mPlaneMesh.set_attrib(1, vertex.color);
+        mesh_.next_vertex();
+        mesh_.set_attrib(0, vertex.position);
+        mesh_.set_attrib(1, vertex.color);
         if (texture)
-            mPlaneMesh.set_attrib(2, vertex.texcoord);
+            mesh_.set_attrib(2, vertex.texcoord);
         if (light)
-            mPlaneMesh.set_attrib(2 + ((int)texture), vertex.normal);
+            mesh_.set_attrib(2 + static_cast<int>(texture), vertex.normal);
     }
 
-    mPlaneMesh.build_vbo();
+    mesh_.build_vbo();
 
     // Set attribute locations
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    attrib_locations.push_back(mProgram["vtxcolor"].location());
+    attrib_locations.push_back(program_["position"].location());
+    attrib_locations.push_back(program_["vtxcolor"].location());
     if (texture)
-        attrib_locations.push_back(mProgram["texcoord"].location());
+        attrib_locations.push_back(program_["texcoord"].location());
     if (light)
-        attrib_locations.push_back(mProgram["normal"].location());
-    mPlaneMesh.set_attrib_locations(attrib_locations);
+        attrib_locations.push_back(program_["normal"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 }
 

=== modified file 'src/scene-shading.cpp'
--- src/scene-shading.cpp	2011-10-17 22:56:15 +0000
+++ src/scene-shading.cpp	2011-10-31 20:42:52 +0000
@@ -26,6 +26,7 @@ 
 #include "stack.h"
 #include "vec.h"
 #include "log.h"
+#include "util.h"
 #include "shader-source.h"
 
 #include <cmath>
@@ -35,27 +36,9 @@ 
 using std::string;
 using std::endl;
 
-template<typename T> T
-fromString(const string& asString)
-{
-    std::stringstream ss(asString);
-    T retVal;
-    ss >> retVal;
-    return retVal;
-}
-
-template<typename T>
-string
-toString(const T t)
-{
-    std::stringstream ss;
-    ss << t;
-    return ss.str();
-}
-
 SceneShading::SceneShading(Canvas &pCanvas) :
     Scene(pCanvas, "shading"),
-    mOrientModel(false)
+    orientModel_(false)
 {
     const ModelMap& modelMap = Model::find_models();
     std::string optionDesc("Which model to use [");
@@ -73,11 +56,11 @@ 
         doSeparator = true;
     }
     optionDesc += "]";
-    mOptions["shading"] = Scene::Option("shading", "gouraud",
+    options_["shading"] = Scene::Option("shading", "gouraud",
                                         "[gouraud, blinn-phong-inf, phong]");
-    mOptions["num-lights"] = Scene::Option("num-lights", "1",
+    options_["num-lights"] = Scene::Option("num-lights", "1",
             "The number of lights applied to the scene (phong only)");
-    mOptions["model"] = Scene::Option("model", "cat",
+    options_["model"] = Scene::Option("model", "cat",
                                       optionDesc);
 }
 
@@ -85,18 +68,20 @@ 
 {
 }
 
-int SceneShading::load()
+int
+SceneShading::load()
 {
-    mRotationSpeed = 36.0f;
+    rotationSpeed_ = 36.0f;
 
-    mRunning = false;
+    running_ = false;
 
     return 1;
 }
 
-void SceneShading::unload()
+void
+SceneShading::unload()
 {
-    mMesh.reset();
+    mesh_.reset();
 }
 
 static string
@@ -120,7 +105,7 @@ 
     {
         // Construct constant names for the light position and color and add it
         // to the list of constants for the shader.
-        string indexString(toString(l));
+        string indexString(Util::toString(l));
         string curLightPosition(lightPositionName + indexString);
         string curLightColor(lightColorName + indexString);
         float sin_theta(sin(theta * l));
@@ -145,7 +130,8 @@ 
     return source.str();
 }
 
-void SceneShading::setup()
+void
+SceneShading::setup()
 {
     Scene::setup();
 
@@ -161,7 +147,7 @@ 
     // Load and add constants to shaders
     std::string vtx_shader_filename;
     std::string frg_shader_filename;
-    const std::string &shading = mOptions["shading"].value;
+    const std::string &shading = options_["shading"].value;
     ShaderSource vtx_source;
     ShaderSource frg_source;
     if (shading == "gouraud") {
@@ -183,21 +169,21 @@ 
     else if (shading == "phong") {
         vtx_shader_filename = GLMARK_DATA_PATH"/shaders/light-phong.vert";
         frg_shader_filename = GLMARK_DATA_PATH"/shaders/light-phong.frag";
-        unsigned int num_lights = fromString<unsigned int>(mOptions["num-lights"].value);
+        unsigned int num_lights = Util::fromString<unsigned int>(options_["num-lights"].value);
         string fragsource = get_fragment_shader_source(frg_shader_filename, num_lights);
         frg_source.append(fragsource);
         frg_source.add_const("MaterialDiffuse", materialDiffuse);
         vtx_source.append_file(vtx_shader_filename);
     }
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_source.str(),
+    if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
         return;
     }
 
     Model model;
-    const std::string& whichModel(mOptions["model"].value);
+    const std::string& whichModel(options_["model"].value);
     bool modelLoaded = model.load(whichModel);
 
     if(!modelLoaded)
@@ -220,9 +206,9 @@ 
     // Horse rotates around the Y axis
     if (whichModel == "buddha" || whichModel == "dragon")
     {
-        mOrientModel = true;
-        mOrientationAngle = -90.0;
-        mOrientationVec = vec3(1.0, 0.0, 0.0);
+        orientModel_ = true;
+        orientationAngle_ = -90.0;
+        orientationVec_ = vec3(1.0, 0.0, 0.0);
     }
 
     model.calculate_normals();
@@ -232,90 +218,93 @@ 
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypePosition, 3));
     attribs.push_back(std::pair<Model::AttribType, int>(Model::AttribTypeNormal, 3));
 
-    model.convert_to_mesh(mMesh, attribs);
+    model.convert_to_mesh(mesh_, attribs);
 
-    mMesh.build_vbo();
+    mesh_.build_vbo();
 
     /* Calculate a projection matrix that is a good fit for the model */
     vec3 maxVec = model.maxVec();
     vec3 minVec = model.minVec();
     vec3 diffVec = maxVec - minVec;
-    mCenterVec = maxVec + minVec;
-    mCenterVec /= 2.0;
+    centerVec_ = maxVec + minVec;
+    centerVec_ /= 2.0;
     float diameter = diffVec.length();
-    mRadius = diameter / 2;
-    float fovy = 2.0 * atanf(mRadius / (2.0 + mRadius));
+    radius_ = diameter / 2;
+    float fovy = 2.0 * atanf(radius_ / (2.0 + radius_));
     fovy /= M_PI;
     fovy *= 180.0;
-    float aspect(static_cast<float>(mCanvas.width())/static_cast<float>(mCanvas.height()));
-    mPerspective.setIdentity();
-    mPerspective *= LibMatrix::Mat4::perspective(fovy, aspect, 2.0, 2.0 + diameter); 
+    float aspect(static_cast<float>(canvas_.width())/static_cast<float>(canvas_.height()));
+    perspective_.setIdentity();
+    perspective_ *= LibMatrix::Mat4::perspective(fovy, aspect, 2.0, 2.0 + diameter);
 
-    mProgram.start();
+    program_.start();
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    attrib_locations.push_back(mProgram["normal"].location());
-    mMesh.set_attrib_locations(attrib_locations);
+    attrib_locations.push_back(program_["position"].location());
+    attrib_locations.push_back(program_["normal"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 
-    mCurrentFrame = 0;
-    mRotation = 0.0f;
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    currentFrame_ = 0;
+    rotation_ = 0.0f;
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
-void SceneShading::teardown()
+void
+SceneShading::teardown()
 {
-    mProgram.stop();
-    mProgram.release();
+    program_.stop();
+    program_.release();
 
     Scene::teardown();
 }
 
-void SceneShading::update()
+void
+SceneShading::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double dt = current_time - mLastUpdateTime;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    double dt = current_time - lastUpdateTime_;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
-    mRotation += mRotationSpeed * dt;
+    rotation_ += rotationSpeed_ * dt;
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
-void SceneShading::draw()
+void
+SceneShading::draw()
 {
     // Load the ModelViewProjectionMatrix uniform in the shader
     LibMatrix::Stack4 model_view;
-    model_view.translate(-mCenterVec.x(), -mCenterVec.y(), -(mCenterVec.z() + 2.0 + mRadius));
-    model_view.rotate(mRotation, 0.0f, 1.0f, 0.0f);
-    if (mOrientModel)
+    model_view.translate(-centerVec_.x(), -centerVec_.y(), -(centerVec_.z() + 2.0 + radius_));
+    model_view.rotate(rotation_, 0.0f, 1.0f, 0.0f);
+    if (orientModel_)
     {
-        model_view.rotate(mOrientationAngle, mOrientationVec.x(), mOrientationVec.y(), mOrientationVec.z());
+        model_view.rotate(orientationAngle_, orientationVec_.x(), orientationVec_.y(), orientationVec_.z());
     }
-    LibMatrix::mat4 model_view_proj(mPerspective);
+    LibMatrix::mat4 model_view_proj(perspective_);
     model_view_proj *= model_view.getCurrent();
 
-    mProgram["ModelViewProjectionMatrix"] = model_view_proj;
+    program_["ModelViewProjectionMatrix"] = model_view_proj;
 
     // Load the NormalMatrix uniform in the shader. The NormalMatrix is the
     // inverse transpose of the model view matrix.
     LibMatrix::mat4 normal_matrix(model_view.getCurrent());
     normal_matrix.inverse().transpose();
-    mProgram["NormalMatrix"] = normal_matrix;
+    program_["NormalMatrix"] = normal_matrix;
 
     // Load the modelview matrix itself
-    mProgram["ModelViewMatrix"] = model_view.getCurrent();
+    program_["ModelViewMatrix"] = model_view.getCurrent();
 
-    mMesh.render_vbo();
+    mesh_.render_vbo();
 }
 
 Scene::ValidationResult
@@ -323,21 +312,21 @@ 
 {
     static const double radius_3d(std::sqrt(3.0));
 
-    if (mRotation != 0) 
+    if (rotation_ != 0)
         return Scene::ValidationUnknown;
 
     Canvas::Pixel ref;
 
-    Canvas::Pixel pixel = mCanvas.read_pixel(mCanvas.width() / 3,
-                                             mCanvas.height() / 3);
+    Canvas::Pixel pixel = canvas_.read_pixel(canvas_.width() / 3,
+                                             canvas_.height() / 3);
 
-    const std::string &filter = mOptions["shading"].value;
+    const std::string &filter = options_["shading"].value;
 
     if (filter == "gouraud")
         ref = Canvas::Pixel(0x00, 0x00, 0x2d, 0xff);
     else if (filter == "blinn-phong-inf")
         ref = Canvas::Pixel(0x1a, 0x1a, 0x3e, 0xff);
-    else if (filter == "phong" && mOptions["num-lights"].value == "1")
+    else if (filter == "phong" && options_["num-lights"].value == "1")
         ref = Canvas::Pixel(0x05, 0x05, 0xad, 0xff);
     else
         return Scene::ValidationUnknown;

=== modified file 'src/scene-texture.cpp'
--- src/scene-texture.cpp	2011-10-07 18:35:47 +0000
+++ src/scene-texture.cpp	2011-10-26 14:09:17 +0000
@@ -34,7 +34,7 @@ 
 SceneTexture::SceneTexture(Canvas &pCanvas) :
     Scene(pCanvas, "texture")
 {
-    mOptions["texture-filter"] = Scene::Option("texture-filter", "nearest",
+    options_["texture-filter"] = Scene::Option("texture-filter", "nearest",
                                                "[nearest, linear, mipmap]");
 }
 
@@ -42,7 +42,8 @@ 
 {
 }
 
-int SceneTexture::load()
+int
+SceneTexture::load()
 {
     Model::find_models();
     Model model;
@@ -51,22 +52,24 @@ 
         return 0;
 
     model.calculate_normals();
-    model.convert_to_mesh(mCubeMesh);
-    mCubeMesh.build_vbo();
-
-    mRotationSpeed = LibMatrix::vec3(36.0f, 36.0f, 36.0f);
-
-    mRunning = false;
+    model.convert_to_mesh(mesh_);
+    mesh_.build_vbo();
+
+    rotationSpeed_ = LibMatrix::vec3(36.0f, 36.0f, 36.0f);
+
+    running_ = false;
 
     return 1;
 }
 
-void SceneTexture::unload()
+void
+SceneTexture::unload()
 {
-    mCubeMesh.reset();
+    mesh_.reset();
 }
 
-void SceneTexture::setup()
+void
+SceneTexture::setup()
 {
     Scene::setup();
 
@@ -82,22 +85,22 @@ 
     vtx_source.add_const("LightSourcePosition", lightPosition);
     vtx_source.add_const("MaterialDiffuse", materialDiffuse);
 
-    if (!Scene::load_shaders_from_strings(mProgram, vtx_source.str(),
+    if (!Scene::load_shaders_from_strings(program_, vtx_source.str(),
                                           frg_source.str()))
     {
         return;
     }
 
     std::vector<GLint> attrib_locations;
-    attrib_locations.push_back(mProgram["position"].location());
-    attrib_locations.push_back(mProgram["normal"].location());
-    attrib_locations.push_back(mProgram["texcoord"].location());
-    mCubeMesh.set_attrib_locations(attrib_locations);
+    attrib_locations.push_back(program_["position"].location());
+    attrib_locations.push_back(program_["normal"].location());
+    attrib_locations.push_back(program_["texcoord"].location());
+    mesh_.set_attrib_locations(attrib_locations);
 
     // Create texture according to selected filtering
     GLint min_filter = GL_NONE;
     GLint mag_filter = GL_NONE;
-    const std::string &filter = mOptions["texture-filter"].value;
+    const std::string &filter = options_["texture-filter"].value;
 
     if (filter == "nearest") {
         min_filter = GL_NEAREST;
@@ -112,70 +115,73 @@ 
         mag_filter = GL_LINEAR;
     }
 
-    Texture::load(GLMARK_DATA_PATH"/textures/crate-base.png", &mTexture,
+    Texture::load(GLMARK_DATA_PATH"/textures/crate-base.png", &texture_,
                   min_filter, mag_filter, 0);
 
-    mProgram.start();
+    program_.start();
 
-    mCurrentFrame = 0;
-    mRotation = LibMatrix::vec3();
-    mRunning = true;
-    mStartTime = Scene::get_timestamp_us() / 1000000.0;
-    mLastUpdateTime = mStartTime;
+    currentFrame_ = 0;
+    rotation_ = LibMatrix::vec3();
+    running_ = true;
+    startTime_ = Scene::get_timestamp_us() / 1000000.0;
+    lastUpdateTime_ = startTime_;
 }
 
-void SceneTexture::teardown()
+void
+SceneTexture::teardown()
 {
-    mProgram.stop();
-    mProgram.release();
+    program_.stop();
+    program_.release();
 
-    glDeleteTextures(1, &mTexture);
+    glDeleteTextures(1, &texture_);
 
     Scene::teardown();
 }
 
-void SceneTexture::update()
+void
+SceneTexture::update()
 {
     double current_time = Scene::get_timestamp_us() / 1000000.0;
-    double dt = current_time - mLastUpdateTime;
-    double elapsed_time = current_time - mStartTime;
-
-    mLastUpdateTime = current_time;
-
-    if (elapsed_time >= mDuration) {
-        mAverageFPS = mCurrentFrame / elapsed_time;
-        mRunning = false;
+    double dt = current_time - lastUpdateTime_;
+    double elapsed_time = current_time - startTime_;
+
+    lastUpdateTime_ = current_time;
+
+    if (elapsed_time >= duration_) {
+        averageFPS_ = currentFrame_ / elapsed_time;
+        running_ = false;
     }
 
-    mRotation += mRotationSpeed * dt;
+    rotation_ += rotationSpeed_ * dt;
 
-    mCurrentFrame++;
+    currentFrame_++;
 }
 
-void SceneTexture::draw()
+void
+SceneTexture::draw()
 {
     // Load the ModelViewProjectionMatrix uniform in the shader
     LibMatrix::Stack4 model_view;
-    LibMatrix::mat4 model_view_proj(mCanvas.projection());
+    LibMatrix::mat4 model_view_proj(canvas_.projection());
 
     model_view.translate(0.0f, 0.0f, -5.0f);
-    model_view.rotate(mRotation.x(), 1.0f, 0.0f, 0.0f);
-    model_view.rotate(mRotation.y(), 0.0f, 1.0f, 0.0f);
-    model_view.rotate(mRotation.z(), 0.0f, 0.0f, 1.0f);
+    model_view.rotate(rotation_.x(), 1.0f, 0.0f, 0.0f);
+    model_view.rotate(rotation_.y(), 0.0f, 1.0f, 0.0f);
+    model_view.rotate(rotation_.z(), 0.0f, 0.0f, 1.0f);
     model_view_proj *= model_view.getCurrent();
 
-    mProgram["ModelViewProjectionMatrix"] = model_view_proj;
+    program_["ModelViewProjectionMatrix"] = model_view_proj;
 
     // Load the NormalMatrix uniform in the shader. The NormalMatrix is the
     // inverse transpose of the model view matrix.
     LibMatrix::mat4 normal_matrix(model_view.getCurrent());
     normal_matrix.inverse().transpose();
-    mProgram["NormalMatrix"] = normal_matrix;
+    program_["NormalMatrix"] = normal_matrix;
 
     glActiveTexture(GL_TEXTURE0);
-    glBindTexture(GL_TEXTURE_2D, mTexture);
+    glBindTexture(GL_TEXTURE_2D, texture_);
 
-    mCubeMesh.render_vbo();
+    mesh_.render_vbo();
 }
 
 Scene::ValidationResult
@@ -183,15 +189,15 @@ 
 {
     static const double radius_3d(std::sqrt(3.0));
 
-    if (mRotation.x() != 0 || mRotation.y() != 0 || mRotation.z() != 0)
+    if (rotation_.x() != 0 || rotation_.y() != 0 || rotation_.z() != 0)
         return Scene::ValidationUnknown;
 
     Canvas::Pixel ref;
 
-    Canvas::Pixel pixel = mCanvas.read_pixel(mCanvas.width() / 2 + 3,
-                                             mCanvas.height() / 2 + 3);
+    Canvas::Pixel pixel = canvas_.read_pixel(canvas_.width() / 2 + 3,
+                                             canvas_.height() / 2 + 3);
 
-    const std::string &filter = mOptions["texture-filter"].value;
+    const std::string &filter = options_["texture-filter"].value;
 
     if (filter == "nearest")
         ref = Canvas::Pixel(0x3b, 0x3a, 0x39, 0xff);

=== modified file 'src/scene.cpp'
--- src/scene.cpp	2011-09-20 09:45:24 +0000
+++ src/scene.cpp	2011-11-01 16:46:08 +0000
@@ -25,6 +25,7 @@ 
 #include "log.h"
 #include "shader-source.h"
 #include "options.h"
+#include "util.h"
 #include <sstream>
 #include <cmath>
 #include <sys/time.h>
@@ -34,16 +35,16 @@ 
 using std::map;
 
 Scene::Scene(Canvas &pCanvas, const string &name) :
-    mCanvas(pCanvas), mName(name),
-    mStartTime(0), mLastUpdateTime(0), mCurrentFrame(0), mAverageFPS(0), 
-    mRunning(0), mDuration(0)
+    canvas_(pCanvas), name_(name),
+    startTime_(0), lastUpdateTime_(0), currentFrame_(0), averageFPS_(0),
+    running_(0), duration_(0)
 {
-    mOptions["duration"] = Scene::Option("duration", "10.0",
+    options_["duration"] = Scene::Option("duration", "10.0",
                                          "The duration of each benchmark in seconds");
-    mOptions["vertex-precision"] = Scene::Option("vertex-precision",
+    options_["vertex-precision"] = Scene::Option("vertex-precision",
                                                  "default,default,default,default",
                                                  "The precision values for the vertex shader (\"int,float,sampler2d,samplercube\")");
-    mOptions["fragment-precision"] = Scene::Option("fragment-precision",
+    options_["fragment-precision"] = Scene::Option("fragment-precision",
                                                    "default,default,default,default",
                                                    "The precision values for the fragment shader (\"int,float,sampler2d,samplercube\")");
 }
@@ -52,41 +53,46 @@ 
 {
 }
 
-int Scene::load()
+int
+Scene::load()
 {
     return 1;
 }
 
-void Scene::unload()
+void
+Scene::unload()
 {
 }
 
-void Scene::setup()
+void
+Scene::setup()
 {
-    stringstream ss(mOptions["duration"].value);
-    ss >> mDuration;
+    duration_ = Util::fromString<double>(options_["duration"].value);
 
     ShaderSource::default_precision(
-            ShaderSource::Precision(mOptions["vertex-precision"].value),
+            ShaderSource::Precision(options_["vertex-precision"].value),
             ShaderSource::ShaderTypeVertex
             );
 
     ShaderSource::default_precision(
-            ShaderSource::Precision(mOptions["fragment-precision"].value),
+            ShaderSource::Precision(options_["fragment-precision"].value),
             ShaderSource::ShaderTypeFragment
             );
 
 }
 
-void Scene::teardown()
-{
-}
-
-void Scene::update()
-{
-}
-
-void Scene::draw()
+void
+Scene::teardown()
+{
+}
+
+void
+Scene::update()
+{
+}
+
+void
+Scene::draw()
 {
 }
 
@@ -95,28 +101,30 @@ 
 {
     stringstream ss;
 
-    ss << "[" << mName << "] " << Scene::construct_title(title) << " ";
+    ss << "[" << name_ << "] " << Scene::construct_title(title) << " ";
 
     return ss.str();
 }
 
-unsigned Scene::average_fps()
+unsigned
+Scene::average_fps()
 {
-    return mAverageFPS;
+    return averageFPS_;
 }
 
 
-bool Scene::is_running()
+bool
+Scene::is_running()
 {
-    return mRunning;
+    return running_;
 }
 
 bool
 Scene::set_option(const string &opt, const string &val)
-{ 
-    map<string, Option>::iterator iter = mOptions.find(opt);
+{
+    map<string, Option>::iterator iter = options_.find(opt);
 
-    if (iter == mOptions.end())
+    if (iter == options_.end())
         return false;
 
     iter->second.value = val;
@@ -128,8 +136,8 @@ 
 void
 Scene::reset_options()
 {
-    for (map<string, Option>::iterator iter = mOptions.begin();
-         iter != mOptions.end();
+    for (map<string, Option>::iterator iter = options_.begin();
+         iter != options_.end();
          iter++)
     {
         Option &opt = iter->second;
@@ -141,10 +149,10 @@ 
 
 bool
 Scene::set_option_default(const string &opt, const string &val)
-{ 
-    map<string, Option>::iterator iter = mOptions.find(opt);
+{
+    map<string, Option>::iterator iter = options_.find(opt);
 
-    if (iter == mOptions.end())
+    if (iter == options_.end())
         return false;
 
     iter->second.default_value = val;
@@ -159,8 +167,8 @@ 
     stringstream ss;
 
     if (title == "") {
-        for (map<string, Option>::iterator iter = mOptions.begin();
-             iter != mOptions.end();
+        for (map<string, Option>::iterator iter = options_.begin();
+             iter != options_.end();
              iter++)
         {
             if (Options::show_all_options || iter->second.set)

=== modified file 'src/scene.h'
--- src/scene.h	2011-10-17 22:56:15 +0000
+++ src/scene.h	2011-10-25 18:05:37 +0000
@@ -81,11 +81,11 @@ 
     unsigned average_fps();
     bool is_running();
 
-    const std::string &name() { return mName; }
+    const std::string &name() { return name_; }
     virtual bool set_option(const std::string &opt, const std::string &val);
     void reset_options();
     bool set_option_default(const std::string &opt, const std::string &val);
-    const std::map<std::string, Option> &options() { return mOptions; }
+    const std::map<std::string, Option> &options() { return options_; }
 
     static Scene &dummy()
     {
@@ -112,17 +112,15 @@ 
     double pixel_value_distance(Canvas::Pixel p1, Canvas::Pixel p2,
                                 bool use_alpha=false);
 
-    Canvas &mCanvas;
-    std::string mName;
-    std::map<std::string, Option> mOptions;
-
-    double mStartTime;
-    double mLastUpdateTime;
-    unsigned mCurrentFrame;
-    unsigned mAverageFPS;      // Average FPS of run
-
-    bool mRunning;
-    double mDuration;      // Duration of run in seconds
+    Canvas &canvas_;
+    std::string name_;
+    std::map<std::string, Option> options_;
+    double startTime_;
+    double lastUpdateTime_;
+    unsigned currentFrame_;
+    unsigned averageFPS_;      // Average FPS of run
+    bool running_;
+    double duration_;      // Duration of run in seconds
 };
 
 /*
@@ -136,7 +134,7 @@ 
     void setup();
 
 private:
-    std::list<std::pair<std::string, std::string> > mDefaultOptions;
+    std::list<std::pair<std::string, std::string> > defaultOptions_;
 };
 
 class SceneBuild : public Scene
@@ -154,17 +152,17 @@ 
     ~SceneBuild();
 
 protected:
-    Program mProgram;
-    LibMatrix::mat4 mPerspective;
-    LibMatrix::vec3 mCenterVec;
-    float mRadius;
-    Mesh mMesh;
-    bool mOrientModel;
-    float mOrientationAngle;
-    LibMatrix::vec3 mOrientationVec;
-    float mRotation;
-    float mRotationSpeed;
-    bool mUseVbo;
+    Program program_;
+    LibMatrix::mat4 perspective_;
+    LibMatrix::vec3 centerVec_;
+    float radius_;
+    Mesh mesh_;
+    bool orientModel_;
+    float orientationAngle_;
+    LibMatrix::vec3 orientationVec_;
+    float rotation_;
+    float rotationSpeed_;
+    bool useVbo_;
 };
 
 class SceneTexture : public Scene
@@ -182,12 +180,11 @@ 
     ~SceneTexture();
 
 protected:
-    Program mProgram;
-
-    Mesh mCubeMesh;
-    GLuint mTexture;
-    LibMatrix::vec3 mRotation;
-    LibMatrix::vec3 mRotationSpeed;
+    Program program_;
+    Mesh mesh_;
+    GLuint texture_;
+    LibMatrix::vec3 rotation_;
+    LibMatrix::vec3 rotationSpeed_;
 };
 
 class SceneShading : public Scene
@@ -205,16 +202,16 @@ 
     ~SceneShading();
 
 protected:
-    Program mProgram;
-    float mRadius;
-    bool mOrientModel;
-    float mOrientationAngle;
-    LibMatrix::vec3 mOrientationVec;
-    LibMatrix::vec3 mCenterVec;
-    LibMatrix::mat4 mPerspective;
-    Mesh mMesh;
-    float mRotation;
-    float mRotationSpeed;
+    Program program_;
+    float radius_;
+    bool orientModel_;
+    float orientationAngle_;
+    LibMatrix::vec3 orientationVec_;
+    LibMatrix::vec3 centerVec_;
+    LibMatrix::mat4 perspective_;
+    Mesh mesh_;
+    float rotation_;
+    float rotationSpeed_;
 };
 
 class SceneGrid : public Scene
@@ -232,11 +229,10 @@ 
     ~SceneGrid();
 
 protected:
-    Program mProgram;
-
-    Mesh mMesh;
-    float mRotation;
-    float mRotationSpeed;
+    Program program_;
+    Mesh mesh_;
+    float rotation_;
+    float rotationSpeed_;
 };
 
 class SceneConditionals : public SceneGrid
@@ -281,12 +277,11 @@ 
     ~SceneBump();
 
 protected:
-    Program mProgram;
-
-    Mesh mMesh;
-    GLuint mTexture;
-    float mRotation;
-    float mRotationSpeed;
+    Program program_;
+    Mesh mesh_;
+    GLuint texture_;
+    float rotation_;
+    float rotationSpeed_;
 private:
     void setup_model_plain(const std::string &type);
     void setup_model_normals();
@@ -328,15 +323,13 @@ 
     ~ScenePulsar();
 
 protected:
-    int mNumQuads;
-    Program mProgram;
-
-    Mesh mPlaneMesh;
-    LibMatrix::vec3 mScale;
-    std::vector<LibMatrix::vec3> mRotations;
-    std::vector<LibMatrix::vec3> mRotationSpeeds;
-
-    GLuint mTexture;
+    int numQuads_;
+    Program program_;
+    Mesh mesh_;
+    LibMatrix::vec3 scale_;
+    std::vector<LibMatrix::vec3> rotations_;
+    std::vector<LibMatrix::vec3> rotationSpeeds_;
+    GLuint texture_;
 
 private:
     void create_and_setup_mesh();

=== modified file 'src/shader-source.cpp'
--- src/shader-source.cpp	2011-09-15 09:04:17 +0000
+++ src/shader-source.cpp	2011-10-26 11:12:19 +0000
@@ -28,16 +28,16 @@ 
 #include "vec.h"
 #include "util.h"
 
-/** 
+/**
  * Holds default precision values for all shader types
  * (even the unknown type, which is hardwired to default precision values)
  */
 std::vector<ShaderSource::Precision>
 ShaderSource::default_precision_(ShaderSource::ShaderTypeUnknown + 1);
 
-/** 
+/**
  * Loads the contents of a file into a string.
- * 
+ *
  * @param filename the name of the file
  * @param str the string to put the contents of the file into
  */
@@ -64,9 +64,9 @@ 
 }
 
 
-/** 
+/**
  * Appends a string to the shader source.
- * 
+ *
  * @param str the string to append
  */
 void
@@ -75,9 +75,9 @@ 
     source_ << str;
 }
 
-/** 
+/**
  * Appends the contents of a file to the shader source.
- * 
+ *
  * @param filename the name of the file to append
  */
 void
@@ -88,9 +88,9 @@ 
         source_ << source;
 }
 
-/** 
+/**
  * Replaces a string in the source with another string.
- * 
+ *
  * @param remove the string to replace
  * @param insert the string to replace with
  */
@@ -109,9 +109,9 @@ 
     source_.str(str);
 }
 
-/** 
+/**
  * Replaces a string in the source with the contents of a file.
- * 
+ *
  * @param remove the string to replace
  * @param filename the name of the file to read from
  */
@@ -123,12 +123,12 @@ 
         replace(remove, source);
 }
 
-/** 
+/**
  * Adds a string (usually containing a constant definition) at
  * global (per shader) scope.
  *
  * The string is placed after any default precision qualifiers.
- * 
+ *
  * @param str the string to add
  */
 void
@@ -141,7 +141,7 @@ 
     pos = source.rfind("precision");
 
     if (pos != std::string::npos) {
-        /* 
+        /*
          * Find the next #endif line of a preprocessor block that contains
          * the precision qualifier.
          */
@@ -165,12 +165,12 @@ 
     source_.str(source);
 }
 
-/** 
+/**
  * Adds a string (usually containing a constant definition) at
  * global (per shader) scope.
  *
  * The string is placed after any default precision qualifiers.
- * 
+ *
  * @param function the function to add the string into
  * @param str the string to add
  */
@@ -195,7 +195,7 @@ 
     source_.str(source);
 }
 
-/** 
+/**
  * Adds a string (usually containing a constant definition) to a shader source
  *
  * If the function parameter is empty, the string will be added to global
@@ -213,7 +213,7 @@ 
         add_global(str);
 }
 
-/** 
+/**
  * Adds a float constant definition.
  *
  * @param name the name of the constant
@@ -231,7 +231,7 @@ 
     add(ss.str(), function);
 }
 
-/** 
+/**
  * Adds a float array constant definition.
  *
  * Note that various GLSL versions (including ES) don't support
@@ -262,7 +262,7 @@ 
     add(ss.str(), function);
 }
 
-/** 
+/**
  * Adds a vec3 constant definition.
  *
  * @param name the name of the constant
@@ -281,7 +281,7 @@ 
     add(ss.str(), function);
 }
 
-/** 
+/**
  * Adds a vec4 constant definition.
  *
  * @param name the name of the constant
@@ -300,7 +300,7 @@ 
     add(ss.str(), function);
 }
 
-/** 
+/**
  * Adds a mat3 constant definition.
  *
  * @param name the name of the constant
@@ -322,7 +322,7 @@ 
     add(ss.str(), function);
 }
 
-/** 
+/**
  * Adds a float array declaration and initialization.
  *
  * @param name the name of the array
@@ -351,7 +351,7 @@ 
         iter != array.end();
         iter++)
     {
-        ss << name << "[" << iter - array.begin() << "] = " << *iter << ";" << std::endl; 
+        ss << name << "[" << iter - array.begin() << "] = " << *iter << ";" << std::endl;
     }
 
     add(ss.str(), init_function);
@@ -359,12 +359,12 @@ 
     add(decl, decl_function);
 }
 
-/** 
+/**
  * Gets the ShaderType for this ShaderSource.
  *
  * If the ShaderType is unknown, an attempt is made to infer
  * the type from the shader source contents.
- * 
+ *
  * @return the ShaderType
  */
 ShaderSource::ShaderType
@@ -385,9 +385,9 @@ 
     return type_;
 }
 
-/** 
+/**
  * Helper function that emits a precision statement.
- * 
+ *
  * @param ss the stringstream to add the statement to
  * @param val the precision value
  * @param type_str the variable type to apply the precision value to
@@ -425,11 +425,11 @@ 
     }
 }
 
-/** 
+/**
  * Gets a string containing the complete shader source.
  *
  * Precision statements are applied at this point.
- * 
+ *
  * @return the shader source
  */
 std::string
@@ -445,7 +445,7 @@ 
 
     /* Create the precision statements */
     std::stringstream ss;
-    
+
     emit_precision(ss, precision.int_precision, "int");
     emit_precision(ss, precision.float_precision, "float");
     emit_precision(ss, precision.sampler2d_precision, "sampler2D");
@@ -460,11 +460,11 @@ 
     return precision_str + source_.str();
 }
 
-/** 
+/**
  * Sets the precision that will be used for this shader.
  *
  * This overrides any default values set with ShaderSource::default_*_precision().
- * 
+ *
  * @param precision the precision to set
  */
 void
@@ -474,9 +474,9 @@ 
     precision_has_been_set_ = true;
 }
 
-/** 
+/**
  * Gets the precision that will be used for this shader.
- * 
+ *
  * @return the precision
  */
 const ShaderSource::Precision&
@@ -485,14 +485,14 @@ 
     return precision_;
 }
 
-/** 
+/**
  * Sets the default precision that will be used for a shaders type.
  *
  * If type is ShaderTypeUnknown the supplied precision is used for all
  * shader types.
  *
  * This can be overriden per ShaderSource object by using ::precision().
- * 
+ *
  * @param precision the default precision to set
  * @param type the ShaderType to use the precision for
  */
@@ -512,14 +512,14 @@ 
     }
 }
 
-/** 
+/**
  * Gets the default precision that will be used for a shader type.
  *
  * It is valid to use a type of ShaderTypeUnknown. This will always
  * return a Precision with default values.
  *
  * @param type the ShaderType to get the precision of
- * 
+ *
  * @return the precision
  */
 const ShaderSource::Precision&
@@ -535,7 +535,7 @@ 
  * ShaderSource::Precision constructors *
  ****************************************/
 
-/** 
+/**
  * Creates a ShaderSource::Precision with default precision values.
  */
 ShaderSource::Precision::Precision() :
@@ -546,7 +546,7 @@ 
 {
 }
 
-/** 
+/**
  * Creates a ShaderSource::Precision using the supplied precision values.
  */
 ShaderSource::Precision::Precision(ShaderSource::PrecisionValue int_p,
@@ -558,7 +558,7 @@ 
 {
 }
 
-/** 
+/**
  * Creates a ShaderSource::Precision from a string representation of
  * precision values.
  *
@@ -566,7 +566,7 @@ 
  * "<int>,<float>,<sampler2d>,<samplercube>"
  *
  * Each precision value is one of "high", "medium", "low" or "default".
- * 
+ *
  * @param precision_values the string representation of the precision values
  */
 ShaderSource::Precision::Precision(const std::string& precision_values) :

=== modified file 'src/shader-source.h'
--- src/shader-source.h	2011-09-15 09:04:17 +0000
+++ src/shader-source.h	2011-10-26 11:12:19 +0000
@@ -26,7 +26,7 @@ 
 #include "vec.h"
 #include "mat.h"
 
-/** 
+/**
  * Helper class for loading and manipulating shader sources.
  */
 class ShaderSource

=== modified file 'src/util.cpp'
--- src/util.cpp	2011-10-13 13:56:26 +0000
+++ src/util.cpp	2011-10-26 11:12:19 +0000
@@ -32,9 +32,9 @@ 
 #include "log.h"
 #include "util.h"
 
-/** 
+/**
  * Splits a string using a delimiter
- * 
+ *
  * @param s the string to split
  * @param delim the delimitir to use
  * @param elems the string vector to populate

=== modified file 'src/util.h'
--- src/util.h	2011-10-13 13:56:26 +0000
+++ src/util.h	2011-10-31 20:42:52 +0000
@@ -27,6 +27,7 @@ 
 #include <string>
 #include <vector>
 #include <istream>
+#include <sstream>
 
 #ifdef ANDROID
 #include <android/asset_manager_jni.h>
@@ -47,6 +48,25 @@ 
 
         vec.clear();
     }
+    template<typename T>
+    static T
+    fromString(const std::string& asString)
+    {
+        std::stringstream ss(asString);
+        T retVal;
+        ss >> retVal;
+        return retVal;
+    }
+
+    template<typename T>
+    static std::string
+    toString(const T t)
+    {
+        std::stringstream ss;
+        ss << t;
+        return ss.str();
+    }
+
 
 #ifdef ANDROID
     static void android_set_asset_manager(AAssetManager *asset_manager);