Index: trunk/FACT++/gui/BasicGlCamera.cc
===================================================================
--- trunk/FACT++/gui/BasicGlCamera.cc	(revision 12302)
+++ trunk/FACT++/gui/BasicGlCamera.cc	(revision 12310)
@@ -290,6 +290,9 @@
 
         for (int i=0;i<1440;i++)
+        {
+            for (int j=0;j<6;j++)
+                neighbors[i][j] = -1;
             updateNeighbors(i);
-
+        }
         buildPatchesIndices();
 
Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12302)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc	(revision 12310)
@@ -49,4 +49,6 @@
     if (first < 0)
         first = 5;
+ //   if (second > 5)
+ //       second = 0;
     first = neighbors[pixel][first];
     second = neighbors[pixel][second];
@@ -70,4 +72,25 @@
     glColor3fv(color);
 }
+void RawDataViewer::calcMidBlurColor(int pixel, int vertex)
+{
+    GLfloat color[3];
+    int first, second;
+    first = vertex-1;
+    if (first < 0)
+        first = 5;
+    first = neighbors[pixel][first];
+    for (int i=0;i<3;i++)
+        color[i] = pixelsColor[pixel][i];
+    float divide = 1;
+    if (first != -1)
+    {
+        divide++;
+        for (int i=0;i<3;i++)
+            color[i] += pixelsColor[first][i];
+    }
+    for (int i=0;i<3;i++)
+        color[i] /= divide;
+    glColor3fv(color);
+}
 /************************************************************
  * DRAW BLURRY HEXAGON. draws a solid hexagon, with interpolated colours
@@ -75,4 +98,34 @@
 void RawDataViewer::drawBlurryHexagon(int index)
 {
+//alternative mesh
+/*    GLfloat color1[3];
+    GLfloat color2[3];
+    GLfloat color3[3];
+    for (int i=0;i<3;i++)
+        color1[i] = pixelsColor[index][i];
+    glBegin(GL_TRIANGLES);
+    for (int i=0;i<6;i++)
+    {
+        int first = i;
+        int second = i+1;
+        if (second == 6) second = 0;
+        first = neighbors[index][first];
+        second = neighbors[index][second];
+        if (first == -1 || second == -1) continue;
+        for (int j=0;j<3;j++)
+        {
+            color2[j] = pixelsColor[first][j];
+            color3[j] = pixelsColor[second][j];
+        }
+        glColor3fv(color2);
+        glVertex2fv(pixelsCoords[first]);
+        glColor3fv(color1);
+        glVertex2fv(pixelsCoords[index]);
+        glColor3fv(color3);
+        glVertex2fv(pixelsCoords[second]);
+    }
+    glEnd();
+    return;*/
+//per-pixel mesh
     GLfloat color[3];
     for (int i=0;i<3;i++)
@@ -83,4 +136,13 @@
     glColor3fv(color);
     glVertex2fv(pixelsCoords[index]);
+/*
+    calcMidBlurColor(index, 1);
+    glVertex2f((verticesList[verticesIndices[index][0]][0] + verticesList[verticesIndices[index][1]][0])/2.f,
+                   (verticesList[verticesIndices[index][0]][1] + verticesList[verticesIndices[index][1]][1])/2.f);
+    glVertex2f((verticesList[verticesIndices[index][0]][0] + verticesList[verticesIndices[index][1]][0])/2.f,
+                   (verticesList[verticesIndices[index][0]][1] + verticesList[verticesIndices[index][1]][1])/2.f);
+    glColor3fv(color);
+    glVertex2fv(pixelsCoords[index]);
+*/
     calcBlurColor(index, 1);
     glVertex2fv(verticesList[verticesIndices[index][1]]);
@@ -89,4 +151,13 @@
     glColor3fv(color);
     glVertex2fv(pixelsCoords[index]);
+/*
+    calcMidBlurColor(index, 2);
+    glVertex2f((verticesList[verticesIndices[index][1]][0] + verticesList[verticesIndices[index][2]][0])/2.f,
+                   (verticesList[verticesIndices[index][1]][1] + verticesList[verticesIndices[index][2]][1])/2.f);
+    glVertex2f((verticesList[verticesIndices[index][1]][0] + verticesList[verticesIndices[index][2]][0])/2.f,
+                   (verticesList[verticesIndices[index][1]][1] + verticesList[verticesIndices[index][2]][1])/2.f);
+    glColor3fv(color);
+    glVertex2fv(pixelsCoords[index]);
+*/
     calcBlurColor(index, 2);
     glVertex2fv(verticesList[verticesIndices[index][2]]);
@@ -95,4 +166,13 @@
     glColor3fv(color);
     glVertex2fv(pixelsCoords[index]);
+/*
+    calcMidBlurColor(index, 3);
+    glVertex2f((verticesList[verticesIndices[index][2]][0] + verticesList[verticesIndices[index][3]][0])/2.f,
+                   (verticesList[verticesIndices[index][2]][1] + verticesList[verticesIndices[index][3]][1])/2.f);
+    glVertex2f((verticesList[verticesIndices[index][2]][0] + verticesList[verticesIndices[index][3]][0])/2.f,
+                   (verticesList[verticesIndices[index][2]][1] + verticesList[verticesIndices[index][3]][1])/2.f);
+    glColor3fv(color);
+    glVertex2fv(pixelsCoords[index]);
+*/
     calcBlurColor(index, 3);
     glVertex2fv(verticesList[verticesIndices[index][3]]);
@@ -101,4 +181,13 @@
     glColor3fv(color);
     glVertex2fv(pixelsCoords[index]);
+/*
+    calcMidBlurColor(index, 4);
+    glVertex2f((verticesList[verticesIndices[index][3]][0] + verticesList[verticesIndices[index][4]][0])/2.f,
+                   (verticesList[verticesIndices[index][3]][1] + verticesList[verticesIndices[index][4]][1])/2.f);
+    glVertex2f((verticesList[verticesIndices[index][3]][0] + verticesList[verticesIndices[index][4]][0])/2.f,
+                   (verticesList[verticesIndices[index][3]][1] + verticesList[verticesIndices[index][4]][1])/2.f);
+    glColor3fv(color);
+    glVertex2fv(pixelsCoords[index]);
+*/
     calcBlurColor(index, 4);
     glVertex2fv(verticesList[verticesIndices[index][4]]);
@@ -107,4 +196,13 @@
     glColor3fv(color);
     glVertex2fv(pixelsCoords[index]);
+/*
+    calcMidBlurColor(index, 5);
+    glVertex2f((verticesList[verticesIndices[index][4]][0] + verticesList[verticesIndices[index][5]][0])/2.f,
+                   (verticesList[verticesIndices[index][4]][1] + verticesList[verticesIndices[index][5]][1])/2.f);
+    glVertex2f((verticesList[verticesIndices[index][4]][0] + verticesList[verticesIndices[index][5]][0])/2.f,
+                   (verticesList[verticesIndices[index][4]][1] + verticesList[verticesIndices[index][5]][1])/2.f);
+    glColor3fv(color);
+    glVertex2fv(pixelsCoords[index]);
+*/
     calcBlurColor(index, 5);
     glVertex2fv(verticesList[verticesIndices[index][5]]);
@@ -113,4 +211,13 @@
     glColor3fv(color);
     glVertex2fv(pixelsCoords[index]);
+/*
+    calcMidBlurColor(index, 0);
+    glVertex2f((verticesList[verticesIndices[index][5]][0] + verticesList[verticesIndices[index][0]][0])/2.f,
+                   (verticesList[verticesIndices[index][5]][1] + verticesList[verticesIndices[index][0]][1])/2.f);
+    glVertex2f((verticesList[verticesIndices[index][5]][0] + verticesList[verticesIndices[index][0]][0])/2.f,
+                   (verticesList[verticesIndices[index][5]][1] + verticesList[verticesIndices[index][0]][1])/2.f);
+    glColor3fv(color);
+    glVertex2fv(pixelsCoords[index]);
+*/
     calcBlurColor(index, 0);
     glVertex2fv(verticesList[verticesIndices[index][0]]);
@@ -383,4 +490,6 @@
     assignPixelMap(mypMap);
     buildVerticesList();
+//    for (int i=0;i<1440;i++)
+//        updateNeighbors(i);
 
     for (int i=0;i<160;i++)
@@ -490,5 +599,5 @@
         cy > bboxMax[1])
         return;
-    whichSlice = (cx - bboxMin[0])*1024/(bboxMax[0] - bboxMin[0]);
+    whichSlice = (cx - bboxMin[0])*nRoi/(bboxMax[0] - bboxMin[0]);
     emit signalCurrentSlice(whichSlice);
 }
Index: trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h
===================================================================
--- trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h	(revision 12302)
+++ trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.h	(revision 12310)
@@ -112,4 +112,5 @@
 //    void buildPatchesIndices();
     void calcBlurColor(int pixel, int vertex);
+    void calcMidBlurColor(int pixel, int vertex);
     void drawBlurryHexagon(int index);
     int whichSlice;
