Index: /anuga_work/development/anugavis/configure.ac
===================================================================
--- /anuga_work/development/anugavis/configure.ac	(revision 5227)
+++ /anuga_work/development/anugavis/configure.ac	(revision 5228)
@@ -14,5 +14,5 @@
 
 # Checks for libraries.
-AX_CHECK_GL
+AX_CHECK_GLU
 AM_PATH_SDL([1.2.12], [], [AC_MSG_ERROR([SDL is required to build.])])
 AC_CACHE_CHECK([for SDL library path],
Index: /anuga_work/development/anugavis/src/anugavis_simple/anugavis_simple.c
===================================================================
--- /anuga_work/development/anugavis/src/anugavis_simple/anugavis_simple.c	(revision 5227)
+++ /anuga_work/development/anugavis/src/anugavis_simple/anugavis_simple.c	(revision 5228)
@@ -3,6 +3,18 @@
 
 int main(int argc, char *argv[]){
-  if(AnugaVis_Init(640, 480, "") == -1){
-    printf("AnugaVis_Init() Error: %s", AnugaVis_GetError());
+  if(argc != 2){
+    printf("Usage: anugavis_simple sww_file_name\n");
+    return 1;
+  }
+  if(AnugaVis_Init(640, 480, argv[1]) == -1){
+    printf("AnugaVis_Init() Error: %s\n", AnugaVis_GetError());
+    return 1;
+  }
+  if(AnugaVis_DefineHeightQuantity("elevation", 0, 1, 128, 128, 128) == -1){
+    printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError());
+    return 1;
+  }
+  if(AnugaVis_DefineHeightQuantity("stage", 0, 1, 0, 0, 128) == -1){
+    printf("AnugaVis_DefineHeightQuantity() Error: %s\n", AnugaVis_GetError());
     return 1;
   }
Index: /anuga_work/development/anugavis/src/libanugavis/Makefile.am
===================================================================
--- /anuga_work/development/anugavis/src/libanugavis/Makefile.am	(revision 5227)
+++ /anuga_work/development/anugavis/src/libanugavis/Makefile.am	(revision 5228)
@@ -10,5 +10,5 @@
                          height_quantity.h \
                          init.c
-libanugavis_la_CFLAGS = @SDL_CFLAGS@
-libanugavis_la_LIBADD = -lSDL
+libanugavis_la_CFLAGS = @SDL_CFLAGS@ @GLU_CFLAGS@
+libanugavis_la_LIBADD = -lSDL @GLU_LIBS@
 libanugavis_la_LDFLAGS = @SDL_LIBPATH@ -no-undefined -version-info 0:0:0
Index: /anuga_work/development/anugavis/src/libanugavis/anugavis.h
===================================================================
--- /anuga_work/development/anugavis/src/libanugavis/anugavis.h	(revision 5227)
+++ /anuga_work/development/anugavis/src/libanugavis/anugavis.h	(revision 5228)
@@ -11,5 +11,5 @@
  * given offset, scale, and color. Returns 0 on success, -1 on error.
  */
-extern int AnugaVis_DefineHeightQuantity(char *name,
+extern int AnugaVis_DefineHeightQuantity(const char *name,
 					 double offset, double scale,
 					 int red, int green, int blue);
Index: /anuga_work/development/anugavis/src/libanugavis/error.c
===================================================================
--- /anuga_work/development/anugavis/src/libanugavis/error.c	(revision 5227)
+++ /anuga_work/development/anugavis/src/libanugavis/error.c	(revision 5228)
@@ -1,3 +1,4 @@
 #include <stdarg.h>
+#include <netcdf.h>
 #include <SDL.h>
 #include "anugavis.h"
@@ -23,2 +24,6 @@
   SDL_ClearError();
 }
+
+void AnugaVis_NetCDFError(int ncerr){
+  AnugaVis_SetError("NetCDF Error: %s", nc_strerror(ncerr));
+}
Index: /anuga_work/development/anugavis/src/libanugavis/error.h
===================================================================
--- /anuga_work/development/anugavis/src/libanugavis/error.h	(revision 5227)
+++ /anuga_work/development/anugavis/src/libanugavis/error.h	(revision 5228)
@@ -10,3 +10,7 @@
 void AnugaVis_SDLError(void);
 
+/* Report a NetCDF error.
+ */
+void AnugaVis_NetCDFError(int ncerr);
+
 #endif
Index: /anuga_work/development/anugavis/src/libanugavis/globals.h
===================================================================
--- /anuga_work/development/anugavis/src/libanugavis/globals.h	(revision 5227)
+++ /anuga_work/development/anugavis/src/libanugavis/globals.h	(revision 5228)
@@ -7,4 +7,5 @@
 typedef struct{
   SDL_Surface *screen;
+  int netcdfId;
   struct height_quantity_simple *heights;
 } ANUGAVIS;
Index: /anuga_work/development/anugavis/src/libanugavis/height_quantity.c
===================================================================
--- /anuga_work/development/anugavis/src/libanugavis/height_quantity.c	(revision 5227)
+++ /anuga_work/development/anugavis/src/libanugavis/height_quantity.c	(revision 5228)
@@ -1,4 +1,5 @@
 #include <stdlib.h>
 #include <string.h>
+#include <netcdf.h>
 #include <SDL.h>
 #include "anugavis.h"
@@ -7,8 +8,17 @@
 #include "height_quantity.h"
 
-int AnugaVis_DefineHeightQuantity(char *name,
+int AnugaVis_DefineHeightQuantity(const char *name,
 				  double offset, double scale,
 				  int red, int green, int blue){
   struct height_quantity_simple *height;
+  int ncstatus;
+  int ncvarid;
+  int numdims;
+  /* Check that it's actually in the NetCDF file */
+  if((ncstatus = nc_inq_varid(anugavis.netcdfId, name, &ncvarid)) != NC_NOERR){
+    AnugaVis_NetCDFError(ncstatus);
+    return -1;
+  }     
+
   /* Redefining a quantity? */
   for(height = anugavis.heights ; height != NULL ; height = height->next)
@@ -26,5 +36,11 @@
   }
   
-  /* TODO: use NetCDF to check if the quantity is dynamic */
+  /* If the NetCDF variable is 2-dimensional, then it's dynamic. */
+  if((ncstatus = nc_inq_varndims(anugavis.netcdfId,
+				 ncvarid, &numdims)) != NC_NOERR){
+    AnugaVis_NetCDFError(ncstatus);
+    return -1;
+  }
+  height->dynamic = (numdims == 2);
   height->offset = offset;
   height->scale = scale;
Index: /anuga_work/development/anugavis/src/libanugavis/init.c
===================================================================
--- /anuga_work/development/anugavis/src/libanugavis/init.c	(revision 5227)
+++ /anuga_work/development/anugavis/src/libanugavis/init.c	(revision 5228)
@@ -1,2 +1,17 @@
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifdef HAVE_GL_GL_H
+#  include <GL/gl.h>
+#elif HAVE_OPENGL_GL_H
+#  include <OpenGL/gl.h>
+#endif
+#ifdef HAVE_GL_GLU_H
+#  include <GL/glu.h>
+#elif HAVE_OPENGL_GLU_H
+#  include <OpenGL/glu.h>
+#endif
+#include <netcdf.h>
 #include <SDL.h>
 #include "anugavis.h"
@@ -5,4 +20,5 @@
 
 int AnugaVis_Init(int width, int height, const char *swwFilePath){
+  int ncstatus;
   if((SDL_Init(SDL_INIT_VIDEO) == -1) ||
      (SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5) == -1) ||
@@ -16,4 +32,19 @@
     return -1;
   }
+
+  glEnable(GL_DEPTH_TEST);
+  glShadeModel(GL_FLAT);
+  glEnable(GL_NORMALIZE);
+  glMatrixMode(GL_PROJECTION);
+  gluPerspective(45.0, ((GLdouble)width)/((GLdouble)height), 0.1, 1000);
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity();
+
+  if((ncstatus = nc_open(swwFilePath, NC_SHARE,
+			 &anugavis.netcdfId)) != NC_NOERR){
+    AnugaVis_NetCDFError(ncstatus);
+    SDL_Quit();
+    return -1;
+  }
   anugavis.heights = NULL;
   return 0;
@@ -23,4 +54,5 @@
   while(anugavis.heights != NULL)
     AnugaVis_UndefineHeightQuantity(anugavis.heights->name);
+  nc_close(anugavis.netcdfId);
   SDL_Quit();
 }
