Index: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp	(revision 739ee9365702db570a88ff6eecfa0f87be1ec93b)
+++ src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.cpp	(revision 34e7fdbe244fe3d4cc7ffaf1162683ab8c7eff45)
@@ -72,6 +72,6 @@
 {
    //mesh->setParent(this);
-   for (int i=0;i<DETAILTYPES_MAX;i++)
-     m_mesh[i] = mesh[i];
+  for (int i=0;i<DETAILTYPES_MAX;i++)
+    m_mesh[i] = mesh[i];
    m_scaleX = 1.0f;
    m_scaleY = 1.0f;
@@ -91,6 +91,6 @@
 {
    //mesh->setParent(this);
-   for (int i=0;i<DETAILTYPES_MAX;i++)
-     m_mesh[i] = mesh;
+  for (int i=0;i<DETAILTYPES_MAX;i++)
+    m_mesh[i] = mesh;
    m_scaleX = 1.0f;
    m_scaleY = 1.0f;
@@ -108,7 +108,6 @@
    : QObject(parent)
 {
-   scene->setParent(this);
-   for (int i=0;i<DETAILTYPES_MAX;i++)
-     m_mesh[i] = scene->mainNode();
+  for (int i=0;i<DETAILTYPES_MAX;i++)
+    m_mesh[i] = scene->mainNode();
    m_scaleX = 1.0f;
    m_scaleY = 1.0f;
@@ -337,2 +336,16 @@
   }
 }
+
+void GLMoleculeObject::updateMesh(QGLSceneNode *mesh)
+{
+  if (m_mesh[0] != NULL) {
+    if (m_mesh[0] != m_mesh[1]) {
+      for (int i=0;i<DETAILTYPES_MAX;i++)
+        delete m_mesh[i];
+    } else {
+      delete m_mesh[0];
+    }
+  }
+  for (int i=0;i<DETAILTYPES_MAX;i++)
+    m_mesh[i] = mesh;
+}
Index: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp	(revision 739ee9365702db570a88ff6eecfa0f87be1ec93b)
+++ src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject.hpp	(revision 34e7fdbe244fe3d4cc7ffaf1162683ab8c7eff45)
@@ -75,5 +75,5 @@
 
    bool visible() const { return m_visible; }
-   void setVisible(bool value);
+   virtual void setVisible(bool value);
 
    void initStaticMaterials();
@@ -96,4 +96,6 @@
    static QGLMaterial* getMaterial(size_t);
    static void cleanMaterialMap();
+
+   void updateMesh(QGLSceneNode *scene);
 
    typedef std::map< size_t, QGLMaterial *> ElementMaterialMap;
Index: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp	(revision 739ee9365702db570a88ff6eecfa0f87be1ec93b)
+++ src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.cpp	(revision 34e7fdbe244fe3d4cc7ffaf1162683ab8c7eff45)
@@ -41,4 +41,5 @@
 
 #include <Qt3D/qglscenenode.h>
+#include <Qt3D/qglbuilder.h>
 
 #include "CodePatterns/MemDebug.hpp"
@@ -54,11 +55,83 @@
 #include "Element/element.hpp"
 #include "LinearAlgebra/Vector.hpp"
+#include "LinkedCell/PointCloudAdaptor.hpp"
+#include "LinkedCell/linkedcell.hpp"
+#include "Tesselation/tesselation.hpp"
+#include "Tesselation/BoundaryLineSet.hpp"
+#include "Tesselation/BoundaryTriangleSet.hpp"
+#include "Tesselation/CandidateForTesselation.hpp"
+#include "Atom/TesselPoint.hpp"
 #include "World.hpp"
 
 #include "GLMoleculeObject_atom.hpp"
 
-GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const molecule *molref) :
-  GLMoleculeObject(mesh, parent),
+static QGLSceneNode *createMoleculeMesh(const molecule *molref, QObject *parent)
+{
+//  Shape shape = molref->getBoundingSphere();
+  double minradius = 2.; // TODO: set to maximum bond length value
+  LOG(3, "DEBUG: Molecule fits into sphere of radius " << minradius);
+  if (minradius < 1.)
+    minradius = 1.;
+
+  QGeometryData geo;
+  // we need at least three points for tesselation
+  if (molref->getAtomCount() >= 3) {
+    // Tesselate the points.
+    Tesselation T;
+    PointCloudAdaptor<molecule> cloud(const_cast<molecule *>(molref), molref->getName());
+    T(cloud, minradius);
+
+    // Fill the points into a Qt geometry.
+    LinkedCell_deprecated LinkedList(cloud, minradius);
+    std::map<int, int> indices;
+    std::map<int, Vector> normals;
+    int index = 0;
+    for (PointMap::const_iterator piter = T.PointsOnBoundary.begin();
+        piter != T.PointsOnBoundary.end(); ++piter) {
+      const Vector &point = piter->second->getPosition();
+      // add data to the primitive
+      geo.appendVertex(QVector3D(point[0], point[1], point[2]));
+      Vector normalvector;
+      for (LineMap::const_iterator lineiter = piter->second->lines.begin();
+          lineiter != piter->second->lines.end(); ++lineiter)
+        for (TriangleMap::const_iterator triangleiter = lineiter->second->triangles.begin();
+            triangleiter != lineiter->second->triangles.end(); ++triangleiter)
+          normalvector +=
+              triangleiter->second->NormalVector;
+      normalvector.Normalize();
+      geo.appendNormal(QVector3D(normalvector[0], normalvector[1], normalvector[2]));
+      geo.appendColor(QColor(1, 1, 1, 1));
+      geo.appendTexCoord(QVector2D(0, 0));
+      indices.insert( std::make_pair( piter->second->getNr(), index++));
+    }
+
+    // Fill the tesselated triangles into the geometry.
+    for (TriangleMap::const_iterator runner = T.TrianglesOnBoundary.begin();
+        runner != T.TrianglesOnBoundary.end(); runner++) {
+      int v[3];
+      for (size_t i=0; i<3; ++i)
+        v[i] = runner->second->endpoints[i]->getNr();
+
+      // Sort the vertices so the triangle is clockwise (relative to the normal vector).
+      Vector cross = T.PointsOnBoundary[v[1]]->getPosition() - T.PointsOnBoundary[v[0]]->getPosition();
+      cross.VectorProduct(T.PointsOnBoundary[v[2]]->getPosition() - T.PointsOnBoundary[v[0]]->getPosition());
+      if (cross.ScalarProduct(runner->second->NormalVector) > 0)
+        geo.appendIndices(indices[v[0]], indices[v[1]], indices[v[2]]);
+      else
+        geo.appendIndices(indices[v[0]], indices[v[2]], indices[v[1]]);
+    }
+  }
+
+  // Build a mesh from the geometry.
+  QGLBuilder builder;
+  builder.addTriangles(geo);
+  QGLSceneNode *mesh = builder.finalizedSceneNode();
+  return mesh;
+}
+
+GLMoleculeObject_molecule::GLMoleculeObject_molecule(QObject *parent, const molecule *molref) :
+  GLMoleculeObject(createMoleculeMesh(molref, parent), parent),
   Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())),
+  isSignedOn(false),
   _molecule(molref),
   hoverAtom(NULL)
@@ -67,4 +140,5 @@
   _molecule->signOn(this, molecule::AtomInserted);
   _molecule->signOn(this, molecule::AtomRemoved);
+  isSignedOn = true;
   /*molref->signOn(this, AtomObservable::IndexChanged);
   molref->signOn(this, AtomObservable::PositionChanged);
@@ -81,8 +155,35 @@
 }
 
+GLMoleculeObject_molecule::GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const molecule *molref) :
+  GLMoleculeObject(mesh, parent),
+  Observer(std::string("GLMoleculeObject_molecule")+toString(molref->getId())),
+  isSignedOn(false),
+  _molecule(molref),
+  hoverAtom(NULL)
+{
+  // sign on as observer (obtain non-const instance before)
+  _molecule->signOn(this, molecule::AtomInserted);
+  _molecule->signOn(this, molecule::AtomRemoved);
+  isSignedOn = true;
+  /*molref->signOn(this, AtomObservable::IndexChanged);
+  molref->signOn(this, AtomObservable::PositionChanged);
+  molref->signOn(this, AtomObservable::ElementChanged);
+  molref->signOn(this, AtomObservable::BondsAdded);*/
+  setMaterial(getMaterial(1));
+  World::getInstance().signOn(this, World::SelectionChanged);
+  updateBoundingBox();
+
+  // initially, atoms and bonds should be visible
+  m_visible = false;
+
+  init();
+}
+
 GLMoleculeObject_molecule::~GLMoleculeObject_molecule()
 {
-  _molecule->signOff(this, molecule::AtomInserted);
-  _molecule->signOff(this, molecule::AtomRemoved);
+  if (isSignedOn) {
+    _molecule->signOff(this, molecule::AtomInserted);
+    _molecule->signOff(this, molecule::AtomRemoved);
+  }
   /*_atom->signOff(this, AtomObservable::IndexChanged);
   _atom->signOff(this, AtomObservable::PositionChanged);
@@ -196,5 +297,7 @@
 
 void GLMoleculeObject_molecule::subjectKilled(Observable *publisher)
-{}
+{
+  isSignedOn = false;
+}
 
 void GLMoleculeObject_molecule::recieveNotification(Observable *publisher, Notification_ptr notification)
@@ -249,5 +352,5 @@
 {
   // Initialize all of the mesh objects that we have as children.
-//  GLMoleculeObject::initialize(view, painter);
+  GLMoleculeObject::initialize(view, painter);
    foreach (QObject *obj, children()) {
      GLMoleculeObject *meshobj = qobject_cast<GLMoleculeObject *>(obj);
@@ -261,5 +364,46 @@
   // draw either molecule's mesh or all atoms and bonds
   if (m_visible) {
-    GLMoleculeObject::draw(painter, cameraPlane);
+    painter->modelViewMatrix().push();
+
+    // Apply the material and effect to the painter.
+    QGLMaterial *material;
+    if (m_hovering)
+        material = m_hoverMaterial;
+    else if (m_selected)
+        material = m_selectionMaterial;
+    else
+        material = m_material;
+
+    ASSERT(material, "GLMoleculeObject::draw: chosen material is NULL");
+
+    painter->setColor(material->diffuseColor());
+    painter->setFaceMaterial(QGL::AllFaces, material);
+    if (m_effect)
+        painter->setUserEffect(m_effect);
+    else
+        painter->setStandardEffect(QGL::LitMaterial);
+
+    // Mark the object for object picking purposes.
+    int prevObjectId = painter->objectPickId();
+    if (m_objectId != -1)
+        painter->setObjectPickId(m_objectId);
+
+    m_mesh[0]->draw(painter);
+
+    // Draw a box around the mesh, if selected.
+    if (m_selected)
+      drawSelectionBox(painter);
+
+    // Turn off the user effect, if present.
+    if (m_effect)
+        painter->setStandardEffect(QGL::LitMaterial);
+
+    // Revert to the previous object identifier.
+    painter->setObjectPickId(prevObjectId);
+
+    // Restore the modelview matrix.
+    painter->modelViewMatrix().pop();
+
+    //    GLMoleculeObject::draw(painter, cameraPlane);
   } else {
     // Draw all of the mesh objects that we have as children.
@@ -415,4 +559,13 @@
 }
 
+void GLMoleculeObject_molecule::setVisible(bool value)
+{
+  // first update the mesh if we are going to be visible now
+  if (value)
+    updateMesh(createMoleculeMesh(_molecule, parent()));
+  // then emit onward
+  GLMoleculeObject::setVisible(value);
+}
+
 std::ostream &operator<<(std::ostream &ost, const GLMoleculeObject_molecule::BondIds &t)
 {
@@ -420,2 +573,3 @@
   return ost;
 }
+
Index: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp	(revision 739ee9365702db570a88ff6eecfa0f87be1ec93b)
+++ src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_molecule.hpp	(revision 34e7fdbe244fe3d4cc7ffaf1162683ab8c7eff45)
@@ -30,4 +30,5 @@
   Q_OBJECT
 public:
+  GLMoleculeObject_molecule(QObject *parent, const molecule *molref);
   GLMoleculeObject_molecule(QGLSceneNode *mesh[], QObject *parent, const molecule *molref);
   virtual ~GLMoleculeObject_molecule();
@@ -70,4 +71,6 @@
   void hoverChangedSignalled(GLMoleculeObject *ob);
 
+  void setVisible(bool value);
+
 private:
   void init();
@@ -82,4 +85,7 @@
   //!> states whether selection box is additionally drawn or not
   bool isSelected;
+
+  //!> whether we are signed on to the associated molecule
+  bool isSignedOn;
 
   const molecule *_molecule;
Index: src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp
===================================================================
--- src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp	(revision 739ee9365702db570a88ff6eecfa0f87be1ec93b)
+++ src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp	(revision 34e7fdbe244fe3d4cc7ffaf1162683ab8c7eff45)
@@ -63,5 +63,5 @@
 typedef QGLSceneNode *MeshList[GLMoleculeObject::DETAILTYPES_MAX];
 
-QGLSceneNode *createShapeMesh(Shape &shape, QObject *parent)
+static QGLSceneNode *createShapeMesh(Shape &shape, QObject *parent)
 {
   size_t NumPointsonSurface = 200;
Index: src/UIElements/Views/Qt4/QtMoleculeList.cpp
===================================================================
--- src/UIElements/Views/Qt4/QtMoleculeList.cpp	(revision 739ee9365702db570a88ff6eecfa0f87be1ec93b)
+++ src/UIElements/Views/Qt4/QtMoleculeList.cpp	(revision 34e7fdbe244fe3d4cc7ffaf1162683ab8c7eff45)
@@ -148,5 +148,4 @@
     molItem->setSelected(World::getInstance().isSelected(*iter));
 
-
     // increase group occurrence
     int count = groupItem->text(4).toInt() + 1;
