diff --git a/Graphics/drawAxes.cpp b/Graphics/drawAxes.cpp
index 2ef021b44f6a6957642d958e69fdf655b591fde8..e36be3cdf31b00d7606aed78174e480b39688ed5 100644
--- a/Graphics/drawAxes.cpp
+++ b/Graphics/drawAxes.cpp
@@ -32,8 +32,7 @@ static int drawTics(drawContext *ctx, int comp, double n, std::string &format,
   double w2 = w * 1.25; // distance to labels
 
   // draw label at the end of the axis
-  glRasterPos3d(p2[0] + t[0] * w2, p2[1] + t[1] * w2, p2[2] + t[2] * w2);
-  ctx->drawString(label);
+  ctx->drawString(label, p2[0] + t[0] * w2, p2[1] + t[1] * w2, p2[2] + t[2] * w2);
 
   // return number of tics in special cases
   if(n < 2.) return 0;
@@ -105,8 +104,7 @@ static int drawTics(drawContext *ctx, int comp, double n, std::string &format,
     else if(winr[1] < winp[1]) // top align
       winr[1] -= drawContext::global()->getStringHeight();
     ctx->viewport2World(winr, r);
-    glRasterPos3d(r[0], r[1], r[2]);
-    ctx->drawString(tmp);
+    ctx->drawString(tmp, r[0], r[1], r[2]);
   }
 
   return n;
@@ -381,7 +379,7 @@ void drawContext::drawSmallAxes()
     zx = l * fvViewMatrix[8];
     zy = l * fvViewMatrix[9];
     ///
-    
+
     ///
   }
   else{
@@ -405,10 +403,7 @@ void drawContext::drawSmallAxes()
   glVertex2d(cx, cy);
   glVertex2d(cx + zx, cy + zy);
   glEnd();
-  glRasterPos2d(cx + xx + o, cy + xy + o);
-  drawString("X");
-  glRasterPos2d(cx + yx + o, cy + yy + o);
-  drawString("Y");
-  glRasterPos2d(cx + zx + o, cy + zy + o);
-  drawString("Z");
+  drawString("X", cx + xx + o, cy + xy + o, 0.);
+  drawString("Y", cx + yx + o, cy + yy + o, 0.);
+  drawString("Z", cx + zx + o, cy + zy + o, 0.);
 }
diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp
index f3915f836154b95b3d31dd2b4fd69c9d385ce6d0..2125cb3cdb7b34bb1481355e3738a19b079b7045 100644
--- a/Graphics/drawContext.cpp
+++ b/Graphics/drawContext.cpp
@@ -377,43 +377,31 @@ void drawContext::invalidateBgImageTexture()
   _bgImageTexture = 0;
 }
 
-void drawContext::drawBackgroundImage(bool threeD)
+bool drawContext::generateTextureForImage(const std::string &name, int page,
+                                          GLuint &imageTexture, GLuint &imageW,
+                                          GLuint &imageH)
 {
-  if(CTX::instance()->bgImageFileName.empty() ||
-     (CTX::instance()->bgImage3d && !threeD) ||
-     (!CTX::instance()->bgImage3d && threeD)) return;
-
-  std::string name = FixRelativePath(GModel::current()->getFileName(),
-                                     CTX::instance()->bgImageFileName);
-  std::string ext = SplitFileName(CTX::instance()->bgImageFileName)[2];
-
-  double x = CTX::instance()->bgImagePosition[0];
-  double y = CTX::instance()->bgImagePosition[1];
-  double w = CTX::instance()->bgImageSize[0];
-  double h = CTX::instance()->bgImageSize[1];
-
+  std::string ext = SplitFileName(name)[2];
   if(ext == ".pdf" || ext == ".PDF"){
 #if defined(HAVE_POPPLER)
-    if(!_bgImageTexture){
+    if(!imageTexture){
       if(!gmshPopplerWrapper::instance()->loadFromFile(name)){
         Msg::Error("Could not load PDF file '%s'", name.c_str());
-        CTX::instance()->bgImageFileName.clear();
-        return;
+        return false;
       }
     }
-    gmshPopplerWrapper::instance()->setCurrentPage(CTX::instance()->bgImagePage);
-    _bgImageTexture = gmshPopplerWrapper::instance()->getTextureForPage(300, 300);
-    _bgImageW = gmshPopplerWrapper::instance()->width();
-    _bgImageH = gmshPopplerWrapper::instance()->height();
+    gmshPopplerWrapper::instance()->setCurrentPage(page);
+    imageTexture = gmshPopplerWrapper::instance()->getTextureForPage(300, 300);
+    imageW = gmshPopplerWrapper::instance()->width();
+    imageH = gmshPopplerWrapper::instance()->height();
 #else
     Msg::Error("Gmsh must be compiled with Poppler support to load PDFs");
-    CTX::instance()->bgImageFileName.clear();
-    return;
+    return false;
 #endif
   }
   else{
 #if defined(HAVE_FLTK)
-    if(!_bgImageTexture){
+    if(!imageTexture){
       Fl_RGB_Image *img = 0;
       if(ext == ".jpg" || ext == ".JPG" || ext == ".jpeg" || ext == ".JPEG")
         img = new Fl_JPEG_Image(name.c_str());
@@ -421,27 +409,47 @@ void drawContext::drawBackgroundImage(bool threeD)
         img = new Fl_PNG_Image(name.c_str());
       if(!img){
         Msg::Error("Could not load background image '%s'", name.c_str());
-        CTX::instance()->bgImageFileName.clear();
-        return;
+        return false;
       }
       Fl_RGB_Image *img2 = (Fl_RGB_Image*)img->copy(2048, 2048);
-      glGenTextures(1, &_bgImageTexture);
-      glBindTexture(GL_TEXTURE_2D, _bgImageTexture);
+      glGenTextures(1, &imageTexture);
+      glBindTexture(GL_TEXTURE_2D, imageTexture);
       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img2->w(), img2->h(), 0,
                    (img2->d() == 4) ? GL_RGBA : GL_RGB,
                    GL_UNSIGNED_BYTE, img2->array);
-      _bgImageW = img->w();
-      _bgImageH = img->h();
+      imageW = img->w();
+      imageH = img->h();
       delete img;
       delete img2;
     }
 #else
     Msg::Error("Gmsh must be compiled with FLTK support to load JPEGs or PNGs");
+    return false;
+#endif
+  }
+  return true;
+}
+
+void drawContext::drawBackgroundImage(bool threeD)
+{
+  if(CTX::instance()->bgImageFileName.empty() ||
+     (CTX::instance()->bgImage3d && !threeD) ||
+     (!CTX::instance()->bgImage3d && threeD)) return;
+
+  std::string name = FixRelativePath(GModel::current()->getFileName(),
+                                     CTX::instance()->bgImageFileName);
+
+  double x = CTX::instance()->bgImagePosition[0];
+  double y = CTX::instance()->bgImagePosition[1];
+  double w = CTX::instance()->bgImageSize[0];
+  double h = CTX::instance()->bgImageSize[1];
+
+  if(!generateTextureForImage(name, CTX::instance()->bgImagePage,
+                              _bgImageTexture, _bgImageW, _bgImageH)){
     CTX::instance()->bgImageFileName.clear();
     return;
-#endif
   }
 
   if(!_bgImageTexture) return;
@@ -898,6 +906,7 @@ bool drawContext::select(int type, bool multiple, bool mesh,
   glMatrixMode(GL_MODELVIEW);
   glLoadIdentity();
   drawGraph2d(false);
+  drawText2d();
 
   glPopMatrix();
 
diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h
index 80b0ec88f36918119ca1cedc5af8483f6475ab94..f76d157bb167d84b157c59cbfb191da6ee1f3464 100644
--- a/Graphics/drawContext.h
+++ b/Graphics/drawContext.h
@@ -115,6 +115,8 @@ class drawContext {
   std::set<PView*> _hiddenViews;
   GLuint _bgImageTexture, _bgImageW, _bgImageH;
   openglWindow *_openglWindow;
+  struct imgtex{ GLuint tex, w, h; };
+  std::map<std::string, imgtex> _imageTextures;
  public:
   Camera camera;
   double r[3]; // current Euler angles (in degrees!)
@@ -182,6 +184,9 @@ class drawContext {
   bool isVisible(PView *v){ return (_hiddenViews.find(v) == _hiddenViews.end()); }
   void createQuadricsAndDisplayLists();
   void invalidateQuadricsAndDisplayLists();
+  bool generateTextureForImage(const std::string &name, int page,
+                               GLuint &imageTexture, GLuint &imageW,
+                               GLuint &imageH);
   void invalidateBgImageTexture();
   void buildRotationMatrix();
   void setQuaternion(double p1x, double p1y, double p2x, double p2y);
@@ -222,12 +227,14 @@ class drawContext {
   void drawSmallAxes();
   void drawTrackball();
   void drawScales();
-  void drawString(const std::string &s, const std::string &font_name, int font_enum,
+  void drawString(const std::string &s, double x, double y, double z,
+                  const std::string &font_name, int font_enum,
                   int font_size, int align);
-  void drawString(const std::string &s);
-  void drawStringCenter(const std::string &s);
-  void drawStringRight(const std::string &s);
-  void drawString(const std::string &s, double style);
+  void drawString(const std::string &s, double x, double y, double z);
+  void drawStringCenter(const std::string &s, double x, double y, double z);
+  void drawStringRight(const std::string &s, double x, double y, double z);
+  void drawString(const std::string &s, double x, double y, double z, double style);
+  void drawImage(const std::string &s, double x, double y, double z);
   void drawSphere(double R, double x, double y, double z, int n1, int n2, int light);
   void drawEllipsoid(double x, double y, double z, float v0[3], float v1[3],
                      float v2[3], int light);
diff --git a/Graphics/drawGeom.cpp b/Graphics/drawGeom.cpp
index 917a558d5c850cd0bc4e4c587efe4b637f3e8f47..0c43abd80f90baf107f9542e114446895d2eebe0 100644
--- a/Graphics/drawGeom.cpp
+++ b/Graphics/drawGeom.cpp
@@ -30,10 +30,10 @@ static void drawEntityLabel(drawContext *ctx, GEntity *e,
       strcat(str, tmp);
     }
   }
-  glRasterPos3d(x + offset / ctx->s[0],
-                y + offset / ctx->s[1],
-                z + offset / ctx->s[2]);
-  ctx->drawString(str);
+  ctx->drawString(str,
+                  x + offset / ctx->s[0],
+                  y + offset / ctx->s[1],
+                  z + offset / ctx->s[2]);
 }
 
 class drawGVertex {
diff --git a/Graphics/drawGlyph.cpp b/Graphics/drawGlyph.cpp
index 553071c51d547271a3b2921e14939fefdf56b2bc..abd772d512cc15610b2c1c0bbe3054f52a45f7f2 100644
--- a/Graphics/drawGlyph.cpp
+++ b/Graphics/drawGlyph.cpp
@@ -11,13 +11,21 @@
 #include "Context.h"
 #include "gl2ps.h"
 #include "SVector3.h"
+#include "GModel.h"
 
-void drawContext::drawString(const std::string &s, const std::string &font_name,
-                             int font_enum, int font_size, int align)
+void drawContext::drawString(const std::string &s, double x, double y, double z,
+                             const std::string &font_name, int font_enum,
+                             int font_size, int align)
 {
   if(s.empty()) return;
   if(CTX::instance()->printing && !CTX::instance()->print.text) return;
 
+  if(s.size() > 8 && s.substr(0, 7) == "file://"){
+    drawImage(s.substr(7), x, y, z);
+    return;
+  }
+
+  glRasterPos3d(x, y, z);
   GLboolean valid;
   glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID, &valid);
   if(valid == GL_FALSE) return; // the primitive is culled
@@ -88,30 +96,31 @@ void drawContext::drawString(const std::string &s, const std::string &font_name,
   }
 }
 
-void drawContext::drawString(const std::string &s)
+void drawContext::drawString(const std::string &s, double x, double y, double z)
 {
-  drawString(s, CTX::instance()->glFont, CTX::instance()->glFontEnum,
+  drawString(s, x, y, z, CTX::instance()->glFont, CTX::instance()->glFontEnum,
              CTX::instance()->glFontSize, 0);
 }
 
-void drawContext::drawStringCenter(const std::string &s)
+void drawContext::drawStringCenter(const std::string &s, double x, double y, double z)
 {
-  drawString(s, CTX::instance()->glFont, CTX::instance()->glFontEnum,
+  drawString(s, x, y, z, CTX::instance()->glFont, CTX::instance()->glFontEnum,
              CTX::instance()->glFontSize, 1);
 }
 
-void drawContext::drawStringRight(const std::string &s)
+void drawContext::drawStringRight(const std::string &s, double x, double y, double z)
 {
-  drawString(s, CTX::instance()->glFont, CTX::instance()->glFontEnum,
+  drawString(s, x, y, z, CTX::instance()->glFont, CTX::instance()->glFontEnum,
              CTX::instance()->glFontSize, 2);
 }
 
-void drawContext::drawString(const std::string &s, double style)
+void drawContext::drawString(const std::string &s, double x, double y, double z,
+                             double style)
 {
   unsigned int bits = (unsigned int)style;
 
   if(!bits){ // use defaults
-    drawString(s);
+    drawString(s, x, y, z);
   }
   else{
     int size = (bits & 0xff);
@@ -120,8 +129,67 @@ void drawContext::drawString(const std::string &s, double style)
     int font_enum = drawContext::global()->getFontEnum(font);
     std::string font_name = drawContext::global()->getFontName(font);
     if(!size) size = CTX::instance()->glFontSize;
-    drawString(s, font_name, font_enum, size, align);
+    drawString(s, x, y, z, font_name, font_enum, size, align);
+  }
+}
+
+void drawContext::drawImage(const std::string &name, double x, double y, double z)
+{
+  std::string file = name;
+  int scaling = file.find_last_of("@");
+  if(scaling != std::string::npos)
+    file = file.substr(0, file.size() - scaling - 1);
+
+  printf("drawing image %s x=%g y=%g z=%g!\n", name.c_str(), x, y, z);
+
+  imgtex *img;
+  double w = 0.;
+  double h = 0.;
+
+  if(!_imageTextures.count(file)){
+    img = &_imageTextures[file];
+    file = FixRelativePath(GModel::current()->getFileName(), file);
+    if(!generateTextureForImage(file, 1, img->tex, img->w, img->h)){
+      Msg::Error("Problem generating image texture");
+      return;
+    }
+  }
+  else{
+    img = &_imageTextures[file];
   }
+
+  if(!img->tex){
+    Msg::Error("No texture for image");
+    return;
+  }
+
+  if(w == 0 && h == 0){
+    w = img->w;
+    h = img->h;
+  }
+  else if(h == 0){
+    h = w * img->h / img->w;
+  }
+  else if(w == 0){
+    w = h * img->w / img->h;
+  }
+
+  //w=0.4;
+  //h=0.1;
+
+  glEnable(GL_BLEND);
+  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+  glEnable(GL_TEXTURE_2D);
+  glBindTexture(GL_TEXTURE_2D, img->tex);
+  glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+  glBegin(GL_QUADS);
+  glTexCoord2f(1.0f, 1.0f); glVertex3d(x+w, y, z);
+  glTexCoord2f(1.0f, 0.0f); glVertex3d(x+w, y+h, z);
+  glTexCoord2f(0.0f, 0.0f); glVertex3d(x, y+h, z);
+  glTexCoord2f(0.0f, 1.0f); glVertex3d(x, y, z);
+  glEnd();
+  glDisable(GL_TEXTURE_2D);
+  glDisable(GL_BLEND);
 }
 
 void drawContext::drawSphere(double R, double x, double y, double z,
@@ -549,16 +617,14 @@ void drawContext::drawBox(double xmin, double ymin, double zmin,
   if(labels){
     char label[256];
     double offset = 0.3 * CTX::instance()->glFontSize * pixel_equiv_x;
-    glRasterPos3d(xmin + offset / s[0],
-                  ymin + offset / s[1],
-                  zmin + offset / s[2]);
     sprintf(label, "(%g,%g,%g)", xmin, ymin, zmin);
-    drawString(label);
-    glRasterPos3d(xmax + offset / s[0],
-                  ymax + offset / s[1],
-                  zmax + offset / s[2]);
+    drawString(label, xmin + offset / s[0],
+               ymin + offset / s[1],
+               zmin + offset / s[2]);
     sprintf(label, "(%g,%g,%g)", xmax, ymax, zmax);
-    drawString(label);
+    drawString(label, xmax + offset / s[0],
+               ymax + offset / s[1],
+               zmax + offset / s[2]);
   }
 }
 
diff --git a/Graphics/drawGraph2d.cpp b/Graphics/drawGraph2d.cpp
index cd147184c96e72131a367788077b03d6dc1b470a..19ade4be7f8f47c6b596e4707aaaa12ed7ad50a7 100644
--- a/Graphics/drawGraph2d.cpp
+++ b/Graphics/drawGraph2d.cpp
@@ -36,14 +36,21 @@ void drawContext::drawText2d()
     PViewData *data = PView::list[i]->getData();
     PViewOptions *opt = PView::list[i]->getOptions();
     if(opt->visible && opt->drawStrings && isVisible(PView::list[i])){
+      if(render_mode == drawContext::GMSH_SELECT){
+        glPushName(5);
+        glPushName(PView::list[i]->getIndex());
+      }
       glColor4ubv((GLubyte *) & opt->color.text2d);
       for(int j = 0; j < data->getNumStrings2D(); j++){
         double x, y, style;
         std::string str;
         data->getString2D(j, opt->timeStep, str, x, y, style);
         fix2dCoordinates(&x, &y);
-        glRasterPos2d(x, y);
-        drawString(str, style);
+        drawString(str, x, y, 0., style);
+      }
+      if(render_mode == drawContext::GMSH_SELECT){
+        glPopName();
+        glPopName();
       }
     }
   }
@@ -286,16 +293,16 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop,
   }
   if(opt->scaleType == PViewOptions::Logarithmic)
     label = "Log10 " + label;
-  glRasterPos2d(xleft + (overlay ? width : 0), ytop + font_h + tic);
-  ctx->drawString(label,CTX::instance()->glFontTitle,
+  ctx->drawString(label, xleft + (overlay ? width : 0), ytop + font_h + tic, 0,
+                  CTX::instance()->glFontTitle,
                   CTX::instance()->glFontEnumTitle,
                   CTX::instance()->glFontSizeTitle, 1);
 
   // x label
   label = opt->axesLabel[0];
-  glRasterPos2d(xleft + width / 2,
-                ytop - height - 2 * font_h - 2 * tic - overlay * (font_h + tic));
-  ctx->drawString(label,CTX::instance()->glFontTitle,
+  ctx->drawString(label, xleft + width / 2,
+                  ytop - height - 2 * font_h - 2 * tic - overlay * (font_h + tic), 0,
+                  CTX::instance()->glFontTitle,
                   CTX::instance()->glFontEnumTitle,
                   CTX::instance()->glFontSizeTitle, 1);
 
@@ -334,12 +341,10 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop,
         sprintf(tmp, opt->format.c_str(), (i == nb) ? opt->tmpMin :
                 (opt->tmpMax - i * dv));
         if(!overlay){
-          glRasterPos2d(xleft - 2 * tic, ytop - i * dy - font_a / 3.);
-          ctx->drawStringRight(tmp);
+          ctx->drawStringRight(tmp, xleft - 2 * tic, ytop - i * dy - font_a / 3., 0.);
         }
         else{
-          glRasterPos2d(xleft + width + 2 * tic, ytop - i * dy - font_a / 3.);
-          ctx->drawString(tmp);
+          ctx->drawString(tmp, xleft + width + 2 * tic, ytop - i * dy - font_a / 3., 0.);
         }
       }
     }
@@ -388,9 +393,8 @@ static void drawGraphAxes(drawContext *ctx, PView *p, double xleft, double ytop,
         else
           sprintf(tmp, opt->axesFormat[0].c_str(),
                   xmin + i * (xmax - xmin) / (double)(nb - 1));
-        glRasterPos2d(xleft + i * dx,
-                      ybot - font_h - tic - overlay * (font_h + tic));
-        ctx->drawStringCenter(tmp);
+        ctx->drawStringCenter(tmp, xleft + i * dx,
+                              ybot - font_h - tic - overlay * (font_h + tic), 0.);
       }
     }
   }
@@ -448,10 +452,9 @@ static void addGraphPoint(drawContext *ctx, PView *p, double xleft, double ytop,
     if(numeric){
       double offset = 3;
       if(inModelCoordinates) offset *= ctx->pixel_equiv_x / ctx->s[0];
-      glRasterPos2d(px + offset, py + offset);
       char label[256];
       sprintf(label, opt->format.c_str(), y);
-      ctx->drawString(label);
+      ctx->drawString(label, px + offset, py + offset, 0.);
     }
     else if(singlePoint && (opt->pointType == 1 || opt->pointType == 3)){
       double ps = CTX::instance()->pointSize;
diff --git a/Graphics/drawMesh.cpp b/Graphics/drawMesh.cpp
index e93a50109ea6c734f5d27c79f089d93a9b7f139b..13410eeb23f58be3cd1e0de831cbd4588d6d1257 100644
--- a/Graphics/drawMesh.cpp
+++ b/Graphics/drawMesh.cpp
@@ -60,8 +60,7 @@ static void drawElementLabels(drawContext *ctx, GEntity *e,
         sprintf(str, "%d", e->tag());
       else
         sprintf(str, "%d", ele->getNum());
-      glRasterPos3d(pc.x(), pc.y(), pc.z());
-      ctx->drawString(str);
+      ctx->drawString(str, pc.x(), pc.y(), pc.z());
     }
   }
 }
@@ -135,10 +134,9 @@ static void drawVertexLabel(drawContext *ctx, GEntity *e, MVertex *v,
   }
   double offset = (0.5 * CTX::instance()->mesh.pointSize +
                    0.1 * CTX::instance()->glFontSize) * ctx->pixel_equiv_x;
-  glRasterPos3d(v->x() + offset / ctx->s[0],
-                v->y() + offset / ctx->s[1],
-                v->z() + offset / ctx->s[2]);
-  ctx->drawString(str);
+  ctx->drawString(str, v->x() + offset / ctx->s[0],
+                  v->y() + offset / ctx->s[1],
+                  v->z() + offset / ctx->s[2]);
 }
 
 static void drawVerticesPerEntity(drawContext *ctx, GEntity *e)
diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp
index 3678dddee965bfaad12aadfcf657b7161b1ab159..9240dc65cb72c9eb332ca99d4e708be415824955 100644
--- a/Graphics/drawPost.cpp
+++ b/Graphics/drawPost.cpp
@@ -216,13 +216,15 @@ static void drawNumberGlyphs(drawContext *ctx, PView *p, int numNodes, int numCo
     if(v >= vmin && v <= vmax){
       unsigned int col = opt->getColor(v, vmin, vmax, false, opt->nbIso);
       glColor4ubv((GLubyte *) & col);
-      glRasterPos3d(pc.x(), pc.y(), pc.z());
       if(opt->centerGlyphs == 2)
-        ctx->drawStringRight(stringValue(numComp, d, v, opt->format.c_str()));
+        ctx->drawStringRight(stringValue(numComp, d, v, opt->format.c_str()),
+                             pc.x(), pc.y(), pc.z());
       else if(opt->centerGlyphs == 1)
-        ctx->drawStringCenter(stringValue(numComp, d, v, opt->format.c_str()));
+        ctx->drawStringCenter(stringValue(numComp, d, v, opt->format.c_str()),
+                              pc.x(), pc.y(), pc.z());
       else
-        ctx->drawString(stringValue(numComp, d, v, opt->format.c_str()));
+        ctx->drawString(stringValue(numComp, d, v, opt->format.c_str()),
+                        pc.x(), pc.y(), pc.z());
     }
   }
   else if(opt->glyphLocation == PViewOptions::Vertex){
@@ -231,13 +233,15 @@ static void drawNumberGlyphs(drawContext *ctx, PView *p, int numNodes, int numCo
       if(v >= vmin && v <= vmax){
         unsigned int col = opt->getColor(v, vmin, vmax, false, opt->nbIso);
         glColor4ubv((GLubyte *) & col);
-        glRasterPos3d(xyz[i][0], xyz[i][1], xyz[i][2]);
         if(opt->centerGlyphs == 2)
-          ctx->drawStringRight(stringValue(numComp, val[i], v, opt->format.c_str()));
+          ctx->drawStringRight(stringValue(numComp, val[i], v, opt->format.c_str()),
+                               xyz[i][0], xyz[i][1], xyz[i][2]);
         else if(opt->centerGlyphs == 1)
-          ctx->drawStringCenter(stringValue(numComp, val[i], v, opt->format.c_str()));
+          ctx->drawStringCenter(stringValue(numComp, val[i], v, opt->format.c_str()),
+                                xyz[i][0], xyz[i][1], xyz[i][2]);
         else
-          ctx->drawString(stringValue(numComp, val[i], v, opt->format.c_str()));
+          ctx->drawString(stringValue(numComp, val[i], v, opt->format.c_str()),
+                          xyz[i][0], xyz[i][1], xyz[i][2]);
       }
     }
   }
@@ -506,8 +510,7 @@ class drawPView {
         double x, y, z, style;
         std::string str;
         data->getString3D(i, opt->timeStep, str, x, y, z, style);
-        glRasterPos3d(x, y, z);
-        _ctx->drawString(str, style);
+        _ctx->drawString(str, x, y, z, style);
       }
     }
 
diff --git a/Graphics/drawScales.cpp b/Graphics/drawScales.cpp
index c6d273b03177df3795c45fb54ff500883e905d7b..16f0b268a3cd263c25224123a50566f19b444cef 100644
--- a/Graphics/drawScales.cpp
+++ b/Graphics/drawScales.cpp
@@ -125,12 +125,11 @@ static void drawScaleValues(drawContext *ctx, PView *p, double xmin, double ymin
       double v = opt->getScaleValue(i, nbv + 1, opt->tmpMin, opt->tmpMax);
       sprintf(label, opt->format.c_str(), v);
       if(horizontal){
-        glRasterPos2d(xmin + i * vbox, ymin + height + tic);
-        ctx->drawStringCenter(label);
+        ctx->drawStringCenter(label, xmin + i * vbox, ymin + height + tic, 0.);
       }
       else{
-        glRasterPos2d(xmin + width + tic, ymin + i * vbox - font_a / 3.);
-        ctx->drawString(label);
+        ctx->drawString(label, xmin + width + tic,
+                        ymin + i * vbox - font_a / 3., 0.);
       }
     }
   }
@@ -143,12 +142,12 @@ static void drawScaleValues(drawContext *ctx, PView *p, double xmin, double ymin
       double v = opt->getScaleValue(i, nbv, opt->tmpMin, opt->tmpMax);
       sprintf(label, opt->format.c_str(), v);
       if(horizontal){
-        glRasterPos2d(xmin + box / 2. + i * vbox, ymin + height + tic);
-        ctx->drawStringCenter(label);
+        ctx->drawStringCenter(label, xmin + box / 2. + i * vbox,
+                              ymin + height + tic, 0.);
       }
       else{
-        glRasterPos2d(xmin + width + tic, ymin + box / 2. + i * vbox - font_a / 3.);
-        ctx->drawString(label);
+        ctx->drawString(label, xmin + width + tic,
+                        ymin + box / 2. + i * vbox - font_a / 3., 0.);
       }
     }
   }
@@ -186,14 +185,14 @@ static void drawScaleLabel(drawContext *ctx, PView *p, double xmin, double ymin,
     sprintf(label, "%s", data->getName().c_str());
 
   if(horizontal){
-    glRasterPos2d(xmin + width / 2., ymin + height + tic + 1.4 * font_h);
-    ctx->drawString(label, CTX::instance()->glFontTitle,
+    ctx->drawString(label, xmin + width / 2., ymin + height + tic + 1.4 * font_h, 0.,
+                    CTX::instance()->glFontTitle,
                     CTX::instance()->glFontEnumTitle,
                     CTX::instance()->glFontSizeTitle, 1);
   }
   else{
-    glRasterPos2d(xmin, ymin - 2 * font_h);
-    ctx->drawString(label, CTX::instance()->glFontTitle,
+    ctx->drawString(label, xmin, ymin - 2 * font_h, 0.,
+                    CTX::instance()->glFontTitle,
                     CTX::instance()->glFontEnumTitle,
                     CTX::instance()->glFontSizeTitle, 0);
   }
diff --git a/Plugin/Annotate.cpp b/Plugin/Annotate.cpp
index f190d6212de9e6e9d9c2137f7f77b49dc66fc6a5..37405ca7df4d1c2569840a67351979337494fbb8 100644
--- a/Plugin/Annotate.cpp
+++ b/Plugin/Annotate.cpp
@@ -58,8 +58,7 @@ void GMSH_AnnotatePlugin::draw(void *context)
 
   glColor4ubv((GLubyte *) & CTX::instance()->color.fg);
   if(AnnotateOptions_Number[3].def){ // 3D
-    glRasterPos3d(X, Y, Z);
-    ctx->drawString(AnnotateOptions_String[0].def, style);
+    ctx->drawString(AnnotateOptions_String[0].def, X, Y, Z, style);
     // draw 10-pixel marker
     double d = 10 * ctx->pixel_equiv_x / ctx->s[0];
     glBegin(GL_LINES);
@@ -80,8 +79,7 @@ void GMSH_AnnotatePlugin::draw(void *context)
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
     ctx->fix2dCoordinates(&X, &Y);
-    glRasterPos2d(X, Y);
-    ctx->drawString(AnnotateOptions_String[0].def, style);
+    ctx->drawString(AnnotateOptions_String[0].def, X, Y, 0., style);
     // draw 10-pixel marker
     glBegin(GL_LINES);
     glVertex2d(X-10,Y); glVertex2d(X+10,Y);
@@ -123,8 +121,8 @@ double GMSH_AnnotatePlugin::callbackX(int num, int action, double value)
   // not perfect: the change will only take place if we reopen the dialog...
   int dim3 = (int)AnnotateOptions_Number[3].def;
   return callback(num, action, value, &AnnotateOptions_Number[0].def,
-                  dim3 ? CTX::instance()->lc/200. : 0.5, 
-                  dim3 ? -CTX::instance()->lc : -100., 
+                  dim3 ? CTX::instance()->lc/200. : 0.5,
+                  dim3 ? -CTX::instance()->lc : -100.,
                   dim3 ? CTX::instance()->lc : 100000.);
 }
 
@@ -133,8 +131,8 @@ double GMSH_AnnotatePlugin::callbackY(int num, int action, double value)
   // not perfect: the change will only take place if we reopen the dialog...
   int dim3 = (int)AnnotateOptions_Number[3].def;
   return callback(num, action, value, &AnnotateOptions_Number[1].def,
-                  dim3 ? CTX::instance()->lc/200. : 0.5, 
-                  dim3 ? -CTX::instance()->lc : -100., 
+                  dim3 ? CTX::instance()->lc/200. : 0.5,
+                  dim3 ? -CTX::instance()->lc : -100.,
                   dim3 ? CTX::instance()->lc : 100000.);
 }
 
@@ -143,8 +141,8 @@ double GMSH_AnnotatePlugin::callbackZ(int num, int action, double value)
   // not perfect: the change will only take place if we reopen the dialog...
   int dim3 = (int)AnnotateOptions_Number[3].def;
   return callback(num, action, value, &AnnotateOptions_Number[2].def,
-                  dim3 ? CTX::instance()->lc/200. : 0.5, 
-                  dim3 ? -CTX::instance()->lc : -100., 
+                  dim3 ? CTX::instance()->lc/200. : 0.5,
+                  dim3 ? -CTX::instance()->lc : -100.,
                   dim3 ? CTX::instance()->lc : 100000.);
 }
 
@@ -223,7 +221,7 @@ PView *GMSH_AnnotatePlugin::execute(PView *v)
   PView *v1 = getView(iView, v);
   if(!v1) return v;
   PViewData *data1 = v1->getData();
-  
+
   PView *v2 = v1;
   PViewDataList *data2 = getDataList(v2, false);
   if(!data2){
@@ -235,9 +233,9 @@ PView *GMSH_AnnotatePlugin::execute(PView *v)
     data2->T3D.push_back(X);
     data2->T3D.push_back(Y);
     data2->T3D.push_back(Z);
-    data2->T3D.push_back(style); 
-    data2->T3D.push_back(data2->T3C.size()); 
-    for(unsigned int i = 0; i < text.size(); i++) 
+    data2->T3D.push_back(style);
+    data2->T3D.push_back(data2->T3C.size());
+    for(unsigned int i = 0; i < text.size(); i++)
       data2->T3C.push_back(text[i]);
     data2->T3C.push_back('\0');
     data2->NbT3++;
@@ -245,9 +243,9 @@ PView *GMSH_AnnotatePlugin::execute(PView *v)
   else{
     data2->T2D.push_back(X);
     data2->T2D.push_back(Y);
-    data2->T2D.push_back(style); 
-    data2->T2D.push_back(data2->T2C.size()); 
-    for(unsigned int i = 0; i < text.size(); i++) 
+    data2->T2D.push_back(style);
+    data2->T2D.push_back(data2->T2C.size());
+    for(unsigned int i = 0; i < text.size(); i++)
       data2->T2C.push_back(text[i]);
     data2->T2C.push_back('\0');
     data2->NbT2++;
diff --git a/Plugin/CutBox.cpp b/Plugin/CutBox.cpp
index e45bcda5a827209489476038a475edfd4ea1d077..a8f5df70232755d9f56104dcfc8ab49ec5dfb3e3 100644
--- a/Plugin/CutBox.cpp
+++ b/Plugin/CutBox.cpp
@@ -49,22 +49,18 @@ void GMSH_CutBoxPlugin::draw(void *context)
   drawContext *ctx = (drawContext*)context;
 
   getPoint(0, 0, 0, p);
-  glRasterPos3d(p[0], p[1], p[2]);
-  ctx->drawString("(X0, Y0, Z0)");
+  ctx->drawString("(X0, Y0, Z0)", p[0], p[1], p[2]);
   if(getNbU() > 1){
     getPoint(getNbU() - 1, 0, 0, p);
-    glRasterPos3d(p[0], p[1], p[2]);
-    ctx->drawString("(X1, Y1, Z1)");
+    ctx->drawString("(X1, Y1, Z1)", p[0], p[1], p[2]);
   }
   if(getNbV() > 1){
     getPoint(0, getNbV() - 1, 0, p);
-    glRasterPos3d(p[0], p[1], p[2]);
-    ctx->drawString("(X2, Y2, Z2)");
+    ctx->drawString("(X2, Y2, Z2)", p[0], p[1], p[2]);
   }
   if(getNbW() > 1){
     getPoint(0, 0, getNbW() - 1, p);
-    glRasterPos3d(p[0], p[1], p[2]);
-    ctx->drawString("(X3, Y3, Z3)");
+    ctx->drawString("(X3, Y3, Z3)", p[0], p[1], p[2]);
   }
 
   if(CutBoxOptions_Number[15].def){
@@ -98,7 +94,7 @@ void GMSH_CutBoxPlugin::draw(void *context)
       glVertex3d(p[0], p[1], p[2]);
       getPoint(i, 0, getNbW()-1, p);
       glVertex3d(p[0], p[1], p[2]);
- 
+
       getPoint(i, getNbV()-1, 0, p);
       glVertex3d(p[0], p[1], p[2]);
       getPoint(i, getNbV()-1, getNbW()-1, p);
@@ -108,12 +104,12 @@ void GMSH_CutBoxPlugin::draw(void *context)
       getPoint(0, 0, i, p);
       glVertex3d(p[0], p[1], p[2]);
       getPoint(getNbU()-1, 0, i, p);
-      glVertex3d(p[0], p[1], p[2]); 
+      glVertex3d(p[0], p[1], p[2]);
 
       getPoint(0, getNbV()-1, i, p);
       glVertex3d(p[0], p[1], p[2]);
       getPoint(getNbU()-1, getNbV()-1, i, p);
-      glVertex3d(p[0], p[1], p[2]); 
+      glVertex3d(p[0], p[1], p[2]);
     }
     // VW
     for(int i = 0; i < getNbV(); ++i){
@@ -131,12 +127,12 @@ void GMSH_CutBoxPlugin::draw(void *context)
       getPoint(0, 0, i, p);
       glVertex3d(p[0], p[1], p[2]);
       getPoint(0, getNbV()-1, i, p);
-      glVertex3d(p[0], p[1], p[2]); 
+      glVertex3d(p[0], p[1], p[2]);
 
       getPoint(getNbU()-1, 0, i, p);
       glVertex3d(p[0], p[1], p[2]);
       getPoint(getNbU()-1, getNbV()-1, i, p);
-      glVertex3d(p[0], p[1], p[2]); 
+      glVertex3d(p[0], p[1], p[2]);
     }
 
     glEnd();
@@ -311,7 +307,7 @@ std::string GMSH_CutBoxPlugin::getHelp() const
     "otherwise, the plugin generates hexahedra, quadrangles, lines or "
     "points depending on the values of `NumPointsU', "
     "`NumPointsV' and `NumPointsW'.\n\n"
-    "If `Boundary' is zero, the plugin interpolates the view inside " 
+    "If `Boundary' is zero, the plugin interpolates the view inside "
     "the box; otherwise the plugin interpolates the view at its boundary.\n\n"
     "If `View' < 0, the plugin is run on the current view.\n\n"
     "Plugin(CutBox) creates one new view.";
@@ -349,28 +345,28 @@ void GMSH_CutBoxPlugin::getPoint(int iU, int iV, int iW, double *X)
   double v = getNbV() > 1 ? (double)iV / (double)(getNbV() - 1.) : 0.;
   double w = getNbW() > 1 ? (double)iW / (double)(getNbW() - 1.) : 0.;
 
-  X[0] = CutBoxOptions_Number[0].def + 
+  X[0] = CutBoxOptions_Number[0].def +
     u  * (CutBoxOptions_Number[3].def-CutBoxOptions_Number[0].def) +
-    v  * (CutBoxOptions_Number[6].def-CutBoxOptions_Number[0].def) + 
+    v  * (CutBoxOptions_Number[6].def-CutBoxOptions_Number[0].def) +
     w  * (CutBoxOptions_Number[9].def-CutBoxOptions_Number[0].def) ;
-  X[1] = CutBoxOptions_Number[1].def + 
+  X[1] = CutBoxOptions_Number[1].def +
     u  * (CutBoxOptions_Number[4].def-CutBoxOptions_Number[1].def) +
     v  * (CutBoxOptions_Number[7].def-CutBoxOptions_Number[1].def) +
     w  * (CutBoxOptions_Number[10].def-CutBoxOptions_Number[1].def) ;
-  X[2] = CutBoxOptions_Number[2].def + 
+  X[2] = CutBoxOptions_Number[2].def +
     u  * (CutBoxOptions_Number[5].def-CutBoxOptions_Number[2].def) +
     v  * (CutBoxOptions_Number[8].def-CutBoxOptions_Number[2].def) +
     w  * (CutBoxOptions_Number[11].def-CutBoxOptions_Number[2].def) ;
 }
 
-void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int nbcomp, 
-                                   double ****pnts, double ****vals, 
-                                   std::vector<double> &P, int *nP, 
-                                   std::vector<double> &L, int *nL, 
+void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int nbcomp,
+                                   double ****pnts, double ****vals,
+                                   std::vector<double> &P, int *nP,
+                                   std::vector<double> &L, int *nL,
                                    std::vector<double> &Q, int *nQ,
                                    std::vector<double> &H, int *nH)
 {
-  if(!connect || (getNbU() == 1 && getNbV() == 1 && getNbW() == 1)){ // generate points    
+  if(!connect || (getNbU() == 1 && getNbV() == 1 && getNbW() == 1)){ // generate points
     if(!boundary)
       for(int i = 0; i < getNbU(); ++i){
         for(int j = 0; j < getNbV(); ++j){
@@ -628,7 +624,7 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
             Q.push_back(pnts[i  ][0][j  ][1]); Q.push_back(pnts[i+1][0][j  ][1]);
             Q.push_back(pnts[i+1][0][j+1][1]); Q.push_back(pnts[i  ][0][j+1][1]);
             Q.push_back(pnts[i  ][0][j  ][2]); Q.push_back(pnts[i+1][0][j  ][2]);
-            Q.push_back(pnts[i+1][0][j+1][2]); Q.push_back(pnts[i  ][0][j+1][2]);          
+            Q.push_back(pnts[i+1][0][j+1][2]); Q.push_back(pnts[i  ][0][j+1][2]);
             (*nQ)++;
             for(int k = 0; k < numsteps; ++k){
               for(int l = 0; l < nbcomp; ++l)
@@ -709,7 +705,7 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
                 Q.push_back(vals[i+1][j+1][0][nbcomp*k+l]);
               for(int l = 0; l < nbcomp; ++l)
                 Q.push_back(vals[i  ][j+1][0][nbcomp*k+l]);
-            }  
+            }
           }
         }
       else{
@@ -798,7 +794,7 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
                   H.push_back(vals[i+1][j+1][m+1][nbcomp*k+l]);
                 for(int l = 0; l < nbcomp; ++l)
                   H.push_back(vals[i  ][j+1][m+1][nbcomp*k+l]);
-              }         
+              }
             }
           }
         }
@@ -822,7 +818,7 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
                 Q.push_back(vals[i+1][j+1][0][nbcomp*k+l]);
               for(int l = 0; l < nbcomp; ++l)
                 Q.push_back(vals[i+1][j  ][0][nbcomp*k+l]);
-            }          
+            }
             Q.push_back(pnts[i  ][j  ][getNbW()-1][0]); Q.push_back(pnts[i+1][j  ][getNbW()-1][0]);
             Q.push_back(pnts[i+1][j+1][getNbW()-1][0]); Q.push_back(pnts[i  ][j+1][getNbW()-1][0]);
             Q.push_back(pnts[i  ][j  ][getNbW()-1][1]); Q.push_back(pnts[i+1][j  ][getNbW()-1][1]);
@@ -860,7 +856,7 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
                 Q.push_back(vals[i+1][0][j+1][nbcomp*k+l]);
               for(int l = 0; l < nbcomp; ++l)
                 Q.push_back(vals[i  ][0][j+1][nbcomp*k+l]);
-            }          
+            }
             Q.push_back(pnts[i  ][getNbV()-1][j  ][0]); Q.push_back(pnts[i  ][getNbV()-1][j+1][0]);
             Q.push_back(pnts[i+1][getNbV()-1][j+1][0]); Q.push_back(pnts[i+1][getNbV()-1][j  ][0]);
             Q.push_back(pnts[i  ][getNbV()-1][j  ][1]); Q.push_back(pnts[i  ][getNbV()-1][j+1][1]);
@@ -880,7 +876,7 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
             }
           }
         }
-        
+
         for(int i = 0; i < getNbV()-1; ++i){
           for(int j = 0; j < getNbW()-1; ++j){
             Q.push_back(pnts[0][i  ][j  ][0]); Q.push_back(pnts[0][i  ][j+1][0]);
@@ -899,7 +895,7 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
                 Q.push_back(vals[0][i+1][j+1][nbcomp*k+l]);
               for(int l = 0; l < nbcomp; ++l)
                 Q.push_back(vals[0][i+1][j  ][nbcomp*k+l]);
-            }          
+            }
             Q.push_back(pnts[getNbU()-1][i  ][j  ][0]); Q.push_back(pnts[getNbU()-1][i+1][j  ][0]);
             Q.push_back(pnts[getNbU()-1][i+1][j+1][0]); Q.push_back(pnts[getNbU()-1][i  ][j+1][0]);
             Q.push_back(pnts[getNbU()-1][i  ][j  ][1]); Q.push_back(pnts[getNbU()-1][i+1][j  ][1]);
@@ -918,12 +914,12 @@ void GMSH_CutBoxPlugin::addInView( int connect, int boundary, int numsteps, int
                 Q.push_back(vals[getNbU()-1][i  ][j+1][nbcomp*k+l]);
             }
           }
-        }        
+        }
       }
-    }     
+    }
   }
 }
-    
+
 PView *GMSH_CutBoxPlugin::GenerateView(PView *v1, int connect, int boundary)
 {
   if(getNbU() <= 0 || getNbV() <= 0 || getNbW() <= 0)
@@ -933,7 +929,7 @@ PView *GMSH_CutBoxPlugin::GenerateView(PView *v1, int connect, int boundary)
 
   PView *v2 = new PView();
   PViewDataList *data2 = getDataList(v2);
- 
+
   OctreePost o(v1);
 
   int nbs = data1->getNumScalars();
@@ -941,7 +937,7 @@ PView *GMSH_CutBoxPlugin::GenerateView(PView *v1, int connect, int boundary)
   int nbt = data1->getNumTensors();
   int maxcomp = nbt ? 9 : (nbv ? 3 : 1);
   int numsteps = data1->getNumTimeSteps();
-  
+
   double ****pnts = new double*** [getNbU()];
   double ****vals = new double*** [getNbU()];
   for(int i = 0; i < getNbU(); i++){
@@ -963,10 +959,10 @@ PView *GMSH_CutBoxPlugin::GenerateView(PView *v1, int connect, int boundary)
       for(int j = 0; j < getNbV(); j++)
         for(int k = 0; k < getNbW(); k++)
           o.searchScalar(pnts[i][j][k][0], pnts[i][j][k][1], pnts[i][j][k][2], vals[i][j][k]);
-    addInView(connect, boundary, numsteps, 1, pnts, vals, data2->SP, &data2->NbSP, 
+    addInView(connect, boundary, numsteps, 1, pnts, vals, data2->SP, &data2->NbSP,
               data2->SL, &data2->NbSL, data2->SQ, &data2->NbSQ, data2->SH, &data2->NbSH);
   }
-  
+
   if(nbv){
     for(int i = 0; i < getNbU(); i++)
       for(int j = 0; j < getNbV(); j++)
@@ -975,13 +971,13 @@ PView *GMSH_CutBoxPlugin::GenerateView(PView *v1, int connect, int boundary)
     addInView(connect, boundary, numsteps, 3, pnts, vals, data2->VP, &data2->NbVP,
               data2->VL, &data2->NbVL, data2->VQ, &data2->NbVQ, data2->VH, &data2->NbVH);
   }
-  
+
   if(nbt){
     for(int i = 0; i < getNbU(); i++)
       for(int j = 0; j < getNbV(); j++)
         for(int k = 0; k < getNbW(); k++)
           o.searchTensor(pnts[i][j][k][0], pnts[i][j][k][1], pnts[i][j][k][2], vals[i][j][k]);
-    addInView(connect, boundary, numsteps, 9, pnts, vals, data2->TP, &data2->NbTP, 
+    addInView(connect, boundary, numsteps, 9, pnts, vals, data2->TP, &data2->NbTP,
               data2->TL, &data2->NbTL, data2->TQ, &data2->NbTQ, data2->TH, &data2->NbTH);
   }
 
@@ -999,7 +995,7 @@ PView *GMSH_CutBoxPlugin::GenerateView(PView *v1, int connect, int boundary)
   }
   delete [] pnts;
   delete [] vals;
-  
+
   data2->setName(data1->getName() + "_CutBox");
   data2->setFileName(data1->getName() + "_CutBox.pos");
   data2->finalize();
diff --git a/Plugin/CutGrid.cpp b/Plugin/CutGrid.cpp
index 85095f7ec67389cdfdf2cd577501a4fdb6f6c11c..e02c32be898944ff47d658e74204f61bd016e20d 100644
--- a/Plugin/CutGrid.cpp
+++ b/Plugin/CutGrid.cpp
@@ -44,17 +44,14 @@ void GMSH_CutGridPlugin::draw(void *context)
   drawContext *ctx = (drawContext*)context;
 
   getPoint(0, 0, p);
-  glRasterPos3d(p[0], p[1], p[2]);
-  ctx->drawString("(X0, Y0, Z0)");
+  ctx->drawString("(X0, Y0, Z0)", p[0], p[1], p[2]);
   if(getNbU() > 1){
     getPoint(getNbU() - 1, 0, p);
-    glRasterPos3d(p[0], p[1], p[2]);
-    ctx->drawString("(X1, Y1, Z1)");
+    ctx->drawString("(X1, Y1, Z1)", p[0], p[1], p[2]);
   }
   if(getNbV() > 1){
     getPoint(0, getNbV() - 1, p);
-    glRasterPos3d(p[0], p[1], p[2]);
-    ctx->drawString("(X2, Y2, Z2)");
+    ctx->drawString("(X2, Y2, Z2)", p[0], p[1], p[2]);
   }
 
   if(CutGridOptions_Number[11].def){
@@ -219,25 +216,25 @@ void GMSH_CutGridPlugin::getPoint(int iU, int iV, double *X)
 {
   double u = getNbU() > 1 ? (double)iU / (double)(getNbU() - 1.) : 0.;
   double v = getNbV() > 1 ? (double)iV / (double)(getNbV() - 1.) : 0.;
-  X[0] = CutGridOptions_Number[0].def + 
+  X[0] = CutGridOptions_Number[0].def +
     u  * (CutGridOptions_Number[3].def-CutGridOptions_Number[0].def) +
     v  * (CutGridOptions_Number[6].def-CutGridOptions_Number[0].def);
-  X[1] = CutGridOptions_Number[1].def + 
+  X[1] = CutGridOptions_Number[1].def +
     u  * (CutGridOptions_Number[4].def-CutGridOptions_Number[1].def) +
     v  * (CutGridOptions_Number[7].def-CutGridOptions_Number[1].def);
-  X[2] = CutGridOptions_Number[2].def + 
+  X[2] = CutGridOptions_Number[2].def +
     u  * (CutGridOptions_Number[5].def-CutGridOptions_Number[2].def) +
     v  * (CutGridOptions_Number[8].def-CutGridOptions_Number[2].def);
 }
 
-void GMSH_CutGridPlugin::addInView(int numsteps, int connect, int nbcomp, 
-                                   double ***pnts, double ***vals, 
-                                   std::vector<double> &P, int *nP, 
-                                   std::vector<double> &L, int *nL, 
+void GMSH_CutGridPlugin::addInView(int numsteps, int connect, int nbcomp,
+                                   double ***pnts, double ***vals,
+                                   std::vector<double> &P, int *nP,
+                                   std::vector<double> &L, int *nL,
                                    std::vector<double> &Q, int *nQ)
 {
   if(!connect || (getNbU() == 1 && getNbV() == 1)){ // generate points
-    
+
     for(int i = 0; i < getNbU(); ++i){
       for(int j = 0; j < getNbV(); ++j){
         P.push_back(pnts[i][j][0]);
@@ -250,10 +247,10 @@ void GMSH_CutGridPlugin::addInView(int numsteps, int connect, int nbcomp,
         }
       }
     }
-    
+
   }
   else{ // generate lines or quads
-    
+
     if(getNbU() == 1){
       for(int i = 0; i < getNbV()-1; ++i){
         L.push_back(pnts[0][i][0]); L.push_back(pnts[0][i+1][0]);
@@ -305,7 +302,7 @@ void GMSH_CutGridPlugin::addInView(int numsteps, int connect, int nbcomp,
         }
       }
     }
-  }     
+  }
 }
 
 PView *GMSH_CutGridPlugin::GenerateView(PView *v1, int connect)
@@ -317,7 +314,7 @@ PView *GMSH_CutGridPlugin::GenerateView(PView *v1, int connect)
 
   PView *v2 = new PView();
   PViewDataList *data2 = getDataList(v2);
- 
+
   OctreePost o(v1);
 
   int nbs = data1->getNumScalars();
@@ -337,12 +334,12 @@ PView *GMSH_CutGridPlugin::GenerateView(PView *v1, int connect)
       getPoint(i, j, pnts[i][j]);
     }
   }
-  
+
   if(nbs){
     for(int i = 0; i < getNbU(); i++)
       for(int j = 0; j < getNbV(); j++)
         o.searchScalar(pnts[i][j][0], pnts[i][j][1], pnts[i][j][2], vals[i][j]);
-    addInView(numsteps, connect, 1, pnts, vals, data2->SP, &data2->NbSP, 
+    addInView(numsteps, connect, 1, pnts, vals, data2->SP, &data2->NbSP,
               data2->SL, &data2->NbSL, data2->SQ, &data2->NbSQ);
   }
 
@@ -358,7 +355,7 @@ PView *GMSH_CutGridPlugin::GenerateView(PView *v1, int connect)
     for(int i = 0; i < getNbU(); i++)
       for(int j = 0; j < getNbV(); j++)
         o.searchTensor(pnts[i][j][0], pnts[i][j][1], pnts[i][j][2], vals[i][j]);
-    addInView(numsteps, connect, 9, pnts, vals, data2->TP, &data2->NbTP, 
+    addInView(numsteps, connect, 9, pnts, vals, data2->TP, &data2->NbTP,
               data2->TL, &data2->NbTL, data2->TQ, &data2->NbTQ);
   }