Index: /trunk/vizservers/nanovis/PCASplit.cpp
===================================================================
--- /trunk/vizservers/nanovis/PCASplit.cpp	(revision 826)
+++ /trunk/vizservers/nanovis/PCASplit.cpp	(revision 827)
@@ -97,5 +97,5 @@
 		finalSize += data[i].size * sqrt(distance);
 		*/
-		if (distance > finalSize) finalSize = distance;;
+		if (distance > finalSize) finalSize = distance;
 	}
 
@@ -103,5 +103,4 @@
 	//finalSize = 0.5f * sqrt (finalSize) / (float) (count - 1) + maxSize;
 	finalSize = sqrt (finalSize) + maxSize;
-	
 }
 	
@@ -270,4 +269,5 @@
 void PCASplit::analyze(ClusterListNode* clusterNode, Cluster* parent, int level, float limit)
 {
+    fflush(stdout);
 	if (level > _maxLevel) return;
 	else if (level > _finalMaxLevel) _finalMaxLevel = level;
@@ -335,7 +335,4 @@
 						0.2);
 
-            printf("CLUSTER points : %d\n", node->data->numOfPoints_t);
-            fflush(stdout);
-					
 					points[i].position = node->data->centroid_t;
 					points[i].color.set(1.0f, 1.0f, 1.0f, 0.2f);
@@ -392,5 +389,4 @@
 				}
 
-				printf("points %d\n", curClusterNodeCount);
 			}
 		}
Index: /trunk/vizservers/nanovis/PCASplit.h
===================================================================
--- /trunk/vizservers/nanovis/PCASplit.h	(revision 826)
+++ /trunk/vizservers/nanovis/PCASplit.h	(revision 827)
@@ -17,5 +17,5 @@
     float value;
 public :
-	Point() : size(1.0f) {}
+	Point() : size(1.0f), value(0.0f) {}
 };
 
@@ -125,4 +125,6 @@
 public :
 	ClusterAccel* doIt(Point* data, int count);
+    void setMinDistance(const float minDistance);
+    void setMaxLevel(int maxLevel);
 
 private :	
@@ -139,4 +141,14 @@
 };	
 
+inline void PCASplit::setMinDistance(const float minDistance)
+{
+    _minDistance = minDistance;
+}
+
+inline void PCASplit::setMaxLevel(int maxLevel)
+{
+    _maxLevel = maxLevel;
+}
+
 };
 
Index: /trunk/vizservers/nanovis/PointSet.cpp
===================================================================
--- /trunk/vizservers/nanovis/PointSet.cpp	(revision 826)
+++ /trunk/vizservers/nanovis/PointSet.cpp	(revision 827)
@@ -2,7 +2,8 @@
 #include "PCASplit.h"
 #include <stdlib.h>
+#include <stdio.h>
 
 PointSet::PointSet()
-: _visible(false), _cluster(0), _sortLevel(4)
+: _visible(false), _cluster(0), _sortLevel(4), _min(0.0f), _max(1.0f)
 {
 }
@@ -16,7 +17,12 @@
 }
 
-void PointSet::initialize(Vector4* values, const unsigned int count)
+void PointSet::initialize(Vector4* values, const unsigned int count, const Vector3& scale, const Vector3& origin, float min, float max)
 {
     PCA::PCASplit pcaSplit;
+
+    _scale = scale;
+    _origin = origin;
+    _min = min;
+    _max = max;
 
     PCA::Point* points = (PCA::Point*) malloc(sizeof(PCA::Point) * count);
@@ -24,9 +30,7 @@
     {
         points[i].position.set(values[i].x, values[i].y, values[i].z);
-
-        // TBD
         points[i].color.set(1.0f, 1.0f, 1.0f, 0.2f);
-
         points[i].value = values[i].w;
+        points[i].size = 0.001;
     }
 
@@ -35,12 +39,42 @@
         delete _cluster;
     }
-
     
+    pcaSplit.setMinDistance(scale.length() / 3.0f);
     _cluster = pcaSplit.doIt(points, count);
 }
 
-void PointSet::updateColor()
+void PointSet::updateColor(float* color,  int colorCount)
 {
-    
+	if (_cluster == 0) return;
+
+    int level = 4;
+
+	PCA::Cluster* cluster = _cluster->startPointerCluster[level - 1];
+	PCA::Cluster* c = &(cluster[0]);
+	PCA::Cluster* end = &(cluster[_cluster->numOfClusters[level - 1] - 1]);
+
+	Vector3 pos;
+	
+    PCA::Point* points;
+    Vector4* colors = (Vector4*) color;
+	int numOfPoints;
+    int index;
+    float d = _max - _min;
+	for (; c <= end; c = (PCA::Cluster*) ((int) c + sizeof(PCA::Cluster)))
+	{
+        points = c->points;
+        numOfPoints = c->numOfPoints;
+
+        for (int i = 0; i < numOfPoints; ++i)
+        {
+            index = (points[i].value - _min) / d  * (colorCount - 1);
+            if (index >= colorCount) index = colorCount - 1;
+            //printf("TEST %f %d/%d -> %d (%f %f %f)\n", points[i].value, i, numOfPoints, index, 
+            //                                    colors[index].x, colors[index].y, colors[index].z);
+            //fflush(stdout);
+            points[i].color = colors[index];
+        }
+
+	}
 }
 
Index: /trunk/vizservers/nanovis/PointSet.h
===================================================================
--- /trunk/vizservers/nanovis/PointSet.h	(revision 826)
+++ /trunk/vizservers/nanovis/PointSet.h	(revision 827)
@@ -4,9 +4,15 @@
 #include <PCASplit.h>
 #include <Vector4.h>
+#include <Vector3.h>
 
 class PointSet {
     unsigned int _sortLevel;
+    PCA::ClusterAccel* _cluster;
+
+    Vector3 _scale;
+    Vector3 _origin;
+    float _max;
+    float _min;
     bool _visible;
-    PCA::ClusterAccel* _cluster;
 public :
     PointSet();
@@ -14,10 +20,14 @@
 
 public :
-    void initialize(Vector4* values, const unsigned int count);
+    void initialize(Vector4* values, const unsigned int count, const Vector3& scale, const Vector3& origin, float min, float max);
     bool isVisible() const;
     void setVisible(bool visible);
     unsigned int getSortLevel()const;
     PCA::ClusterAccel* getCluster();
-    void updateColor();
+    void updateColor(float* color, int  count);
+    const Vector3& getScale() const;
+    Vector3& getScale();
+    const Vector3& getOrigin() const;
+    Vector3& getOrigin();
 };
 
@@ -42,4 +52,23 @@
 }
 
+inline Vector3& PointSet::getScale()
+{
+    return _scale;
+}
+
+inline const Vector3& PointSet::getScale() const
+{
+    return _scale;
+}
+
+inline Vector3& PointSet::getOrigin()
+{
+    return _origin;
+}
+
+inline const Vector3& PointSet::getOrigin() const
+{
+    return _origin;
+}
 
 #endif // 
Index: /trunk/vizservers/nanovis/PointSetRenderer.cpp
===================================================================
--- /trunk/vizservers/nanovis/PointSetRenderer.cpp	(revision 826)
+++ /trunk/vizservers/nanovis/PointSetRenderer.cpp	(revision 827)
@@ -8,4 +8,8 @@
 #include <stdio.h>
 #include <R2/R2FilePath.h>
+
+#define USE_TEXTURE 
+//#define USE_SHADER 
+#define POINT_SIZE 5
 
 PointSetRenderer::PointSetRenderer()
@@ -22,4 +26,14 @@
     ImageLoader* loader = ImageLoaderFactory::getInstance()->createLoader("bmp");
     Image* image = loader->load(path, Image::IMG_RGBA);
+
+    unsigned char* bytes = (unsigned char*) image->getImageBuffer();
+    if (bytes)
+    {
+        for (int y = 0; y < image->getHeight(); ++y)
+           for (int x = 0; x < image->getWidth(); ++x, bytes +=4)
+           {
+                bytes[3] =  (bytes[0] == 0)? 0 : 255;
+           }
+    }
 
     if (image)
@@ -54,10 +68,12 @@
     float quadratic[] = { 1.0f, 0.0f, 0.01f };
 
-
+    glEnable(GL_POINT_SPRITE_ARB);
     glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, quadratic);
     glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 60.0f);
     glPointParameterfARB(GL_POINT_SIZE_MIN_ARB, 1.0f);
     glPointParameterfARB(GL_POINT_SIZE_MAX_ARB, 100);
+#ifdef USE_TEXTURE 
     glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
+#endif
 
     glEnable(GL_POINT_SPRITE_ARB);
@@ -74,5 +90,7 @@
             if (!setSize) 
             {
+#ifdef USE_SHADER 
                 _shader->setScale(p->data->points[0].size);
+#endif
                 setSize = true;
             }
@@ -91,21 +109,58 @@
 
     glDisable(GL_POINT_SPRITE_ARB);
+    glPointSize(1);
 
 }
 
-void PointSetRenderer::render(PCA::ClusterAccel* cluster, const Mat4x4& mat, int sortLevel)
+void PointSetRenderer::render(PCA::ClusterAccel* cluster, const Mat4x4& mat, int sortLevel, const Vector3& scale, const Vector3& origin)
 {
     _bucketSort->init();
     _bucketSort->sort(cluster, mat, sortLevel);
 
+    glDisable(GL_TEXTURE_2D);
+
+#ifdef USE_TEXTURE 
     _pointTexture->activate();
+    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+#endif
+
+    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    //glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+    glEnable(GL_BLEND);
+
+    glDisable(GL_LIGHTING);
+    glEnable(GL_COLOR_MATERIAL);
+
+    glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+    glPushMatrix();
+    float s = 1.0f / scale.x;
+    Vector3 shift(origin.x + scale.x * 0.5, origin.x + scale.x * 0.5, origin.x + scale.x * 0.5);
+    glScalef(s, scale.y / scale.x * s, scale.z / scale.x * s);
+
+    //glTranslatef(-shift.x, -shift.y, -shift.z);
+    
+#ifdef USE_SHADER 
     _shader->bind();
-    glPushMatrix();
-        glTranslatef(-0.5f, -0.5f, -0.5f);
+#else
+    glPointSize(POINT_SIZE);
+#endif
         renderCluster(_bucketSort->getBucket(), _bucketSort->getSize(), 4);
+#ifdef USE_SHADER 
+    _shader->unbind();
+#else
+    glPointSize(1.0f);
+#endif
+    
     glPopMatrix();
 
-    _shader->unbind();
+    glDisable(GL_COLOR_MATERIAL);
+    glEnable(GL_LIGHTING);
+    glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
+    glDisable(GL_BLEND);
+
+#ifdef USE_TEXTURE 
+    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
     _pointTexture->deactivate();
+#endif
 }
 
Index: /trunk/vizservers/nanovis/PointSetRenderer.h
===================================================================
--- /trunk/vizservers/nanovis/PointSetRenderer.h	(revision 826)
+++ /trunk/vizservers/nanovis/PointSetRenderer.h	(revision 827)
@@ -21,5 +21,5 @@
 
 public :
-    void render(PCA::ClusterAccel* cluster, const Mat4x4& mat, int sortLevel);
+    void render(PCA::ClusterAccel* cluster, const Mat4x4& mat, int sortLevel, const Vector3& scale, const Vector3& origin);
 };
 
Index: /trunk/vizservers/nanovis/nanovis.cpp
===================================================================
--- /trunk/vizservers/nanovis/nanovis.cpp	(revision 826)
+++ /trunk/vizservers/nanovis/nanovis.cpp	(revision 827)
@@ -28,7 +28,9 @@
 #include <signal.h>
 
+
 #include "Nv.h"
 #include "PointSetRenderer.h"
 #include "PointSet.h"
+#include "Util.h"
 
 #include "nanovis.h"
@@ -54,4 +56,7 @@
 
 //#define  _LOCAL_ZINC_TEST_
+//
+// FOR testing new functions
+//#include "Test.h"
 
 // R2 headers
@@ -918,5 +923,5 @@
                 }
             }
-/*
+#ifdef __TEST_CODE__
             else if (!strcmp(header, "<FET>"))
             {
@@ -925,5 +930,5 @@
                 std::stringstream fdata;
                 fdata.write(buf.bytes(),buf.size());
-                //err = load_volume_stream3(n, fdata);
+                err = load_volume_stream3(n, fdata);
 
                 if (err) {
@@ -932,5 +937,5 @@
                 }
             }
-*/
+#endif
             else
             {
@@ -1456,91 +1461,4 @@
         "\": should be data, outline, shading, or state", (char*)NULL);
     return TCL_ERROR;
-}
-
-int TestCmd _ANSI_ARGS_((ClientData cdata, Tcl_Interp *interp, int argc, CONST84 char *argv[]))
-{
-    std::ifstream fin;
-    fin.open("/home/nanohub/vrinside/nv/data/fet/graph-finfet.txt", std::ios::binary);
-                //std::stringstream fdata(std::ios_base::out|std::ios_base::in|std::ios_base::binary);
-
-    if (!fin) 
-    {
-        printf("file not found\n");
-        return TCL_OK;
-    }
-
-    float temp1, temp2, temp3;
-    float vmin, vmax;
-    int count;
-    char* start;
-
-    char line[128];
-    char temp[24];
-    float dx, dy, dz;
-    float x0, y0, z0;
-    do {
-        fin.getline(line,sizeof(line)-1);
-
-        // skip leading blanks
-        for (start=&line[0]; *start == ' ' || *start == '\t'; start++);
-
-        if (*start != '#') 
-        {  
-            sscanf(start, "%s%f%f%f", temp, &temp1, &temp2, &temp3);
-            if (!strcmp(temp, "size"))
-            {
-                dx = temp1;
-                dy = temp2;
-                dz = temp3;
-            }
-            else if (!strcmp(temp, "size"))
-            {
-                x0 = temp1;
-                y0 = temp2;
-                z0 = temp3;
-            }
-            else if (!strcmp(temp, "minmax"))
-            {
-                vmin = temp1;
-                vmax = temp2;
-            }
-            else if (!strcmp(temp, "count"))
-            {
-                count = temp1;
-            }
-            else if (!strcmp(temp, "</FET>"))
-            {
-                break;
-            }
-        }
-    } while (!fin.eof());
-
-    printf("data count %d \n", count);
-    fflush(stdout);
-
-    Vector4* data = new Vector4[count];
-    memset(data, 0, sizeof(Vector4) * count);
-    float min = 1e21, max = 1e-21;
-    for (int i = 0; i < count; ++i)
-    {
-        fin.getline(line,sizeof(line)-1);
-        sscanf(line, "%f%f%f%f", &data[i].x, &data[i].y, &data[i].z, &data[i].w);
-
-        if (data[i].w < min) min = data[i].w;
-        if (data[i].w > max) max = data[i].w;
-    }
-
-    float d = max - min;
-    for (int i = 0; i < count; ++i)
-    {
-        data[i].w = (data[i].w - min) / d;
-    }
-
-    PointSet* newPointSet = new PointSet();
-    newPointSet->initialize(data, count);
-    newPointSet->setVisible(true);
-    g_pointSet.push_back(newPointSet);
-    
-    return TCL_OK;
 }
 
@@ -2724,329 +2642,4 @@
 }
 
-Rappture::Outcome
-load_volume_stream3(int index, std::iostream& fin) 
-{
-    Rappture::Outcome result;
-
-    Rappture::MeshTri2D xymesh;
-    int dummy, nx, ny, nz, nxy, npts;
-    double x0, y0, z0, dx, dy, dz, ddx, ddy, ddz;
-    char line[128], type[128], *start;
-
-    int isrect = 1;
-
-    float temp1, temp2, temp3;
-    float vmin, vmax;
-    int count;
-
-    char temp[24];
-    do {
-        fin.getline(line,sizeof(line)-1);
-
-        // skip leading blanks
-        for (start=&line[0]; *start == ' ' || *start == '\t'; start++);
-
-        if (*start != '#') 
-        {  
-            sscanf(start, "%s%f%f%f", temp, &temp1, &temp2, &temp3);
-            if (!strcmp(temp, "size"))
-            {
-                dx = temp1;
-                dy = temp2;
-                dz = temp3;
-            }
-            else if (!strcmp(temp, "size"))
-            {
-                x0 = temp1;
-                y0 = temp2;
-                z0 = temp3;
-            }
-            else if (!strcmp(temp, "minmax"))
-            {
-                vmin = temp1;
-                vmax = temp2;
-            }
-            else if (!strcmp(temp, "count"))
-            {
-                count = temp1;
-            }
-            else if (!strcmp(temp, "<FET>"))
-            {
-                break;
-            }
-        }
-    } while (!fin.eof());
-
-    // read data points
-    if (!fin.eof()) {
-        if (isrect) {
-            Rappture::Mesh1D xgrid(x0, x0+nx*dx, nx);
-            Rappture::Mesh1D ygrid(y0, y0+ny*dy, ny);
-            Rappture::Mesh1D zgrid(z0, z0+nz*dz, nz);
-            Rappture::FieldRect3D field(xgrid, ygrid, zgrid);
-
-            double dval[6];
-            int nread = 0;
-            int ix = 0;
-            int iy = 0;
-            int iz = 0;
-            while (!fin.eof() && nread < npts) {
-                fin.getline(line,sizeof(line)-1);
-                int n = sscanf(line, "%lg %lg %lg %lg %lg %lg", &dval[0], &dval[1], &dval[2], &dval[3], &dval[4], &dval[5]);
-
-                for (int p=0; p < n; p++) {
-                    int nindex = iz*nx*ny + iy*nx + ix;
-                    field.define(nindex, dval[p]);
-                    nread++;
-                    if (++iz >= nz) {
-                        iz = 0;
-                        if (++iy >= ny) {
-                            iy = 0;
-                            ++ix;
-                        }
-                    }
-                }
-            }
-
-            // make sure that we read all of the expected points
-            if (nread != nx*ny*nz) {
-                char mesg[256];
-                sprintf(mesg,"inconsistent data: expected %d points but found %d points", nx*ny*nz, nread);
-                result.error(mesg);
-                return result;
-            }
-
-            // figure out a good mesh spacing
-            int nsample = 30;
-            dx = field.rangeMax(Rappture::xaxis) - field.rangeMin(Rappture::xaxis);
-            dy = field.rangeMax(Rappture::yaxis) - field.rangeMin(Rappture::yaxis);
-            dz = field.rangeMax(Rappture::zaxis) - field.rangeMin(Rappture::zaxis);
-            double dmin = pow((dx*dy*dz)/(nsample*nsample*nsample), 0.333);
-
-            nx = (int)ceil(dx/dmin);
-            ny = (int)ceil(dy/dmin);
-            nz = (int)ceil(dz/dmin);
-
-#ifndef NV40
-            // must be an even power of 2 for older cards
-	        nx = (int)pow(2.0, ceil(log10((double)nx)/log10(2.0)));
-	        ny = (int)pow(2.0, ceil(log10((double)ny)/log10(2.0)));
-	        nz = (int)pow(2.0, ceil(log10((double)nz)/log10(2.0)));
-#endif
-
-            float *data = new float[4*nx*ny*nz];
-
-            double vmin = field.valueMin();
-            double dv = field.valueMax() - field.valueMin();
-            if (dv == 0.0) { dv = 1.0; }
-
-            // generate the uniformly sampled data that we need for a volume
-            int ngen = 0;
-            double nzero_min = 0.0;
-            for (int iz=0; iz < nz; iz++) {
-                double zval = z0 + iz*dmin;
-                for (int iy=0; iy < ny; iy++) {
-                    double yval = y0 + iy*dmin;
-                    for (int ix=0; ix < nx; ix++) {
-                        double xval = x0 + ix*dmin;
-                        double v = field.value(xval,yval,zval);
-
-                        if (v != 0.0f && v < nzero_min)
-                        {
-                            nzero_min = v;
-                        }
-
-                        // scale all values [0-1], -1 => out of bounds
-                        v = (isnan(v)) ? -1.0 : (v - vmin)/dv;
-
-                        data[ngen] = v;
-                        ngen += 4;
-                    }
-                }
-            }
-
-            // Compute the gradient of this data.  BE CAREFUL: center
-            // calculation on each node to avoid skew in either direction.
-            ngen = 0;
-            for (int iz=0; iz < nz; iz++) {
-                for (int iy=0; iy < ny; iy++) {
-                    for (int ix=0; ix < nx; ix++) {
-                        // gradient in x-direction
-                        double valm1 = (ix == 0) ? 0.0 : data[ngen-4];
-                        double valp1 = (ix == nx-1) ? 0.0 : data[ngen+4];
-                        if (valm1 < 0 || valp1 < 0) {
-                            data[ngen+1] = 0.0;
-                        } else {
-                            data[ngen+1] = ((valp1-valm1) + 1) *  0.5; // assume dx=1
-                        }
-
-                        // gradient in y-direction
-                        valm1 = (iy == 0) ? 0.0 : data[ngen-4*nx];
-                        valp1 = (iy == ny-1) ? 0.0 : data[ngen+4*nx];
-                        if (valm1 < 0 || valp1 < 0) {
-                            data[ngen+2] = 0.0;
-                        } else {
-                            //data[ngen+2] = valp1-valm1; // assume dy=1
-                            data[ngen+2] = ((valp1-valm1) + 1) *  0.5; // assume dx=1
-                        }
-
-                        // gradient in z-direction
-                        valm1 = (iz == 0) ? 0.0 : data[ngen-4*nx*ny];
-                        valp1 = (iz == nz-1) ? 0.0 : data[ngen+4*nx*ny];
-                        if (valm1 < 0 || valp1 < 0) {
-                            data[ngen+3] = 0.0;
-                        } else {
-                            //data[ngen+3] = valp1-valm1; // assume dz=1
-                            data[ngen+3] = ((valp1-valm1) + 1) *  0.5; // assume dz=1
-                        }
-
-                        ngen += 4;
-                    }
-                }
-            }
-
-            load_volume(index, nx, ny, nz, 4, data,
-                field.valueMin(), field.valueMax(), nzero_min);
-
-            delete [] data;
-
-        } else {
-            Rappture::Mesh1D zgrid(z0, z0+nz*dz, nz);
-            Rappture::FieldPrism3D field(xymesh, zgrid);
-
-            double dval;
-            int nread = 0;
-            int ixy = 0;
-            int iz = 0;
-            while (!fin.eof() && nread < npts) {
-                if (!(fin >> dval).fail()) {
-                    int nid = nxy*iz + ixy;
-                    field.define(nid, dval);
-
-                    nread++;
-                    if (++iz >= nz) {
-                        iz = 0;
-                        ixy++;
-                    }
-                }
-            }
-
-            // make sure that we read all of the expected points
-            if (nread != nxy*nz) {
-                char mesg[256];
-                sprintf(mesg,"inconsistent data: expected %d points but found %d points", nxy*nz, nread);
-                return result.error(mesg);
-            }
-
-            // figure out a good mesh spacing
-            int nsample = 30;
-            x0 = field.rangeMin(Rappture::xaxis);
-            dx = field.rangeMax(Rappture::xaxis) - field.rangeMin(Rappture::xaxis);
-            y0 = field.rangeMin(Rappture::yaxis);
-            dy = field.rangeMax(Rappture::yaxis) - field.rangeMin(Rappture::yaxis);
-            z0 = field.rangeMin(Rappture::zaxis);
-            dz = field.rangeMax(Rappture::zaxis) - field.rangeMin(Rappture::zaxis);
-            double dmin = pow((dx*dy*dz)/(nsample*nsample*nsample), 0.333);
-
-            nx = (int)ceil(dx/dmin);
-            ny = (int)ceil(dy/dmin);
-            nz = (int)ceil(dz/dmin);
-#ifndef NV40
-            // must be an even power of 2 for older cards
-	        nx = (int)pow(2.0, ceil(log10((double)nx)/log10(2.0)));
-	        ny = (int)pow(2.0, ceil(log10((double)ny)/log10(2.0)));
-	        nz = (int)pow(2.0, ceil(log10((double)nz)/log10(2.0)));
-#endif
-            float *data = new float[4*nx*ny*nz];
-
-            double vmin = field.valueMin();
-            double dv = field.valueMax() - field.valueMin();
-            if (dv == 0.0) { dv = 1.0; }
-
-            // generate the uniformly sampled data that we need for a volume
-            int ngen = 0;
-            double nzero_min = 0.0;
-            for (iz=0; iz < nz; iz++) {
-                double zval = z0 + iz*dmin;
-                for (int iy=0; iy < ny; iy++) {
-                    double yval = y0 + iy*dmin;
-                    for (int ix=0; ix < nx; ix++) {
-                        double xval = x0 + ix*dmin;
-                        double v = field.value(xval,yval,zval);
-
-                        if (v != 0.0f && v < nzero_min)
-                        {
-                            nzero_min = v;
-                        }
-                        // scale all values [0-1], -1 => out of bounds
-                        v = (isnan(v)) ? -1.0 : (v - vmin)/dv;
-                        data[ngen] = v;
-
-                        ngen += 4;
-                    }
-                }
-            }
-
-            // Compute the gradient of this data.  BE CAREFUL: center
-            // calculation on each node to avoid skew in either direction.
-            ngen = 0;
-            for (int iz=0; iz < nz; iz++) {
-                for (int iy=0; iy < ny; iy++) {
-                    for (int ix=0; ix < nx; ix++) {
-                        // gradient in x-direction
-                        double valm1 = (ix == 0) ? 0.0 : data[ngen-1];
-                        double valp1 = (ix == nx-1) ? 0.0 : data[ngen+1];
-                        if (valm1 < 0 || valp1 < 0) {
-                            data[ngen+1] = 0.0;
-                        } else {
-                            //data[ngen+1] = valp1-valm1; // assume dx=1
-                            data[ngen+1] = ((valp1-valm1) + 1) *  0.5; // assume dx=1
-                        }
-
-                        // gradient in y-direction
-                        valm1 = (iy == 0) ? 0.0 : data[ngen-4*nx];
-                        valp1 = (iy == ny-1) ? 0.0 : data[ngen+4*nx];
-                        if (valm1 < 0 || valp1 < 0) {
-                            data[ngen+2] = 0.0;
-                        } else {
-                            //data[ngen+2] = valp1-valm1; // assume dy=1
-                            data[ngen+2] = ((valp1-valm1) + 1) *  0.5; // assume dy=1
-                        }
-
-                        // gradient in z-direction
-                        valm1 = (iz == 0) ? 0.0 : data[ngen-4*nx*ny];
-                        valp1 = (iz == nz-1) ? 0.0 : data[ngen+4*nx*ny];
-                        if (valm1 < 0 || valp1 < 0) {
-                            data[ngen+3] = 0.0;
-                        } else {
-                            //data[ngen+3] = valp1-valm1; // assume dz=1
-                            data[ngen+3] = ((valp1-valm1) + 1) *  0.5; // assume dz=1
-                        }
-
-                        ngen += 4;
-                    }
-                }
-            }
-
-            load_volume(index, nx, ny, nz, 4, data,
-                field.valueMin(), field.valueMax(), nzero_min);
-
-            delete [] data;
-        }
-    } else {
-        return result.error("data not found in stream");
-    }
-
-    //
-    // Center this new volume on the origin.
-    //
-    float dx0 = -0.5;
-    float dy0 = -0.5*dy/dx;
-    float dz0 = -0.5*dz/dx;
-    volume[index]->move(Vector3(dx0, dy0, dz0));
-
-    return result;
-}
-
 /* Load a 3D volume
  * index: the index into the volume array, which stores pointers to 3D volume instances
@@ -3096,5 +2689,6 @@
 
   float data[256*4];
-  for(int i=0; i<256; i++){
+  for(int i=0; i<256; i++)
+  {
     data[4*i+0] = color_table[i][0];
     data[4*i+1] = color_table[i][1];
@@ -3398,6 +2992,8 @@
         (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
 
+#ifdef __TEST_CODE__
     Tcl_CreateCommand(interp, "test", TestCmd,
         (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+#endif
 
     // create a default transfer function
@@ -3988,5 +3584,5 @@
 
 void draw_3d_axis()
-{
+{ 
     glDisable(GL_TEXTURE_2D);
     glEnable(GL_DEPTH_TEST);
@@ -3997,4 +3593,5 @@
 	
 	glDepthFunc(GL_LESS);
+    glEnable(GL_COLOR_MATERIAL);
 	glEnable(GL_DEPTH_TEST);
 	glDisable(GL_BLEND);
@@ -4030,5 +3627,5 @@
 	glEnable(GL_LIGHT0);
 
-	glColor3f(0.2, 0.2, 0.8);
+	//glColor3f(0.2, 0.2, 0.8);
 	glPushMatrix();
 	glutSolidSphere(0.02, segments, segments );
@@ -4199,5 +3796,7 @@
             if (g_pointSet[i]->isVisible())
             {
-                g_pointset_renderer->render(g_pointSet[i]->getCluster(), mat, g_pointSet[i]->getSortLevel());
+                g_pointset_renderer->render(g_pointSet[i]->getCluster(), mat, g_pointSet[i]->getSortLevel(), 
+                                            g_pointSet[i]->getScale(),
+                                            g_pointSet[i]->getOrigin());
             }
         }
Index: /trunk/vizservers/nanovis/shaders/pointsvp.cg
===================================================================
--- /trunk/vizservers/nanovis/shaders/pointsvp.cg	(revision 826)
+++ /trunk/vizservers/nanovis/shaders/pointsvp.cg	(revision 827)
@@ -28,6 +28,6 @@
 	
 	
-	float tmp = posin.w * rsqrt(dot(eye.xyz, eye.xyz));
-	psize = scale.x * max(tmp, 1.0);
+//	float tmp = posin.w * rsqrt(dot(eye.xyz, eye.xyz));
+//	psize = scale.x * max(tmp, 1.0);
 	psize = 10 * p.w / -p.z;
 	
