Index: /trunk/packages/vizservers/nanovis/Shader.cpp
===================================================================
--- /trunk/packages/vizservers/nanovis/Shader.cpp	(revision 3874)
+++ /trunk/packages/vizservers/nanovis/Shader.cpp	(revision 3875)
@@ -12,4 +12,5 @@
 #include <util/FilePath.h>
 
+#include "config.h"
 #include "Shader.h"
 #include "Trace.h"
@@ -18,6 +19,24 @@
 using namespace nv::util;
 
+/**
+ * These correspond to NV_vertex_program3 and NV_fragment_program2:
+ * CG_PROFILE_VP40
+ * CG_PROFILE_FP40
+ *
+ * These correspond to ARB_vertex_program and ARB_fragment_program:
+ * CG_PROFILE_ARBVP1
+ * CG_PROFILE_ARBFP1
+ *
+ * Generic GLSL targets:
+ * CG_PROFILE_GLSLV
+ * CG_PROFILE_GLSLF
+ */
+#ifdef USE_ARB_PROGRAMS
+CGprofile Shader::_defaultVertexProfile = CG_PROFILE_ARBVP1;
+CGprofile Shader::_defaultFragmentProfile = CG_PROFILE_ARBFP1;
+#else
 CGprofile Shader::_defaultVertexProfile = CG_PROFILE_VP40;
 CGprofile Shader::_defaultFragmentProfile = CG_PROFILE_FP40;
+#endif
 CGcontext Shader::_cgContext = NULL;
 
Index: /trunk/packages/vizservers/nanovis/Shader.h
===================================================================
--- /trunk/packages/vizservers/nanovis/Shader.h	(revision 3874)
+++ /trunk/packages/vizservers/nanovis/Shader.h	(revision 3875)
@@ -49,4 +49,14 @@
     void loadFragmentProgram(const char *fileName);
 
+    bool isVertexProgramLoaded()
+    {
+        return (getVP() == NULL);
+    }
+
+    bool isFragmentProgramLoaded()
+    {
+        return (getFP() == NULL);
+    }
+
     void setVPParameter1f(const char *name, float val)
     {
@@ -284,5 +294,4 @@
     void resetPrograms();
 
-
     CGprogram getVP()
     {
Index: /trunk/packages/vizservers/nanovis/VelocityArrowsSlice.cpp
===================================================================
--- /trunk/packages/vizservers/nanovis/VelocityArrowsSlice.cpp	(revision 3874)
+++ /trunk/packages/vizservers/nanovis/VelocityArrowsSlice.cpp	(revision 3875)
@@ -65,6 +65,9 @@
     _queryVelocityFP.loadFragmentProgram("queryvelocity.cg");
 
-    _particleShader.loadVertexProgram("velocityslicevp.cg");
-    _particleShader.loadFragmentProgram("velocityslicefp.cg");
+    // Delay loading of shaders only required for glyph style rendering
+    if (_renderMode == GLYPHS) {
+        _particleShader.loadVertexProgram("velocityslicevp.cg");
+        _particleShader.loadFragmentProgram("velocityslicefp.cg");
+    }
 
     createRenderTarget();
@@ -362,5 +365,5 @@
                     continue;
                 }
-                if (length > 1.0e-6) {
+                if (length > 0.0) {
                     Vector3f vnorm = vel.normalize();
                     Vector3f rotationAxis = refVec.cross(vnorm);
@@ -414,4 +417,13 @@
         glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
 
+        // FIXME: This vertex shader won't compile with ARB_vertex_program,
+        // so it should use GLSL
+        if (!_particleShader.isVertexProgramLoaded()) {
+            _particleShader.loadVertexProgram("velocityslicevp.cg");
+        }
+        if (!_particleShader.isFragmentProgramLoaded()) {
+            _particleShader.loadFragmentProgram("velocityslicefp.cg");
+        }
+
         _particleShader.bind();
         _particleShader.setVPTextureParameter("vfield", _vectorFieldGraphicsID);
@@ -458,5 +470,5 @@
     Vector3f bmin, bmax;
     volume->getBounds(bmin, bmax);
-    _origin = bmin;
+    _origin.set(bmin.x, bmin.y, bmin.z);
     _scale.set(bmax.x-bmin.x, bmax.y-bmin.y, bmax.z-bmin.z);
 
Index: /trunk/packages/vizservers/nanovis/config.h
===================================================================
--- /trunk/packages/vizservers/nanovis/config.h	(revision 3874)
+++ /trunk/packages/vizservers/nanovis/config.h	(revision 3875)
@@ -38,4 +38,11 @@
 
 /*
+ * If defined, use ARB_vertex_program and ARB_fragment_program as Cg
+ * profile target, otherwise NV_vertex_program3 and NV_fragment_program2
+ * are required
+ */
+//#define USE_ARB_PROGRAMS
+
+/*
  * Keep statistics
  */
Index: /trunk/packages/vizservers/nanovis/nanovis.cpp
===================================================================
--- /trunk/packages/vizservers/nanovis/nanovis.cpp	(revision 3874)
+++ /trunk/packages/vizservers/nanovis/nanovis.cpp	(revision 3875)
@@ -504,5 +504,12 @@
     }
 #endif
-    // FIXME: should use ARB programs or (preferably) a GLSL profile for portability
+    // FIXME: should use GLSL for portability
+#ifdef USE_ARB_PROGRAMS
+    if (!GLEW_ARB_vertex_program ||
+        !GLEW_ARB_fragment_program) {
+        ERROR("ARB_vertex_program and ARB_fragment_program extensions are required");
+        return false;
+    }
+#else
     if (!GLEW_NV_vertex_program3 ||
         !GLEW_NV_fragment_program2) {
@@ -510,4 +517,5 @@
         return false;
     }
+#endif
 
     if (!FilePath::getInstance()->setPath(path)) {
