--- a/OpenGLControl.cpp
+++ b/OpenGLControl.cpp
@@ -13,6 +13,49 @@
 {
 	dc = NULL;
 	rotation = 0.0f;
+    m_moving = false;
+
+
+    Transform.M[0]= 1;
+    Transform.M[1]= 0;
+    Transform.M[2]= 0;
+    Transform.M[3]= 0;
+    Transform.M[4]= 0;
+    Transform.M[5]= 1;
+    Transform.M[6]= 0;
+    Transform.M[7]= 0;
+    Transform.M[8]= 0;
+    Transform.M[9]= 0;
+    Transform.M[10]= 1;
+    Transform.M[11]= 0;
+    Transform.M[12]= 0;
+    Transform.M[13]= 0;
+    Transform.M[14]= 0;
+    Transform.M[15]= 1;
+
+    LastRot.M[0]=1;
+    LastRot.M[1]=0;
+    LastRot.M[2]=0;
+    LastRot.M[3]=0;
+    LastRot.M[4]=1;
+    LastRot.M[5]=0;
+    LastRot.M[6]=0;
+    LastRot.M[7]=0;
+    LastRot.M[8]=1;
+    
+    ThisRot.M[0]=1;
+    ThisRot.M[1]=0;
+    ThisRot.M[2]=0;
+    ThisRot.M[3]=0;
+    ThisRot.M[4]=1;
+    ThisRot.M[5]=0;
+    ThisRot.M[6]=0;
+    ThisRot.M[7]=0;
+    ThisRot.M[8]=1;
+
+    m_zoom = -8;
+                                                            
+ 
 }
 
 COpenGLControl::~COpenGLControl()
@@ -30,38 +73,184 @@
 	ON_WM_SIZE()
 	ON_WM_CREATE()
 	ON_WM_ERASEBKGND()
+    ON_WM_MOUSEMOVE()
+    ON_WM_LBUTTONDOWN()
+    ON_WM_LBUTTONUP()
+    ON_WM_MOUSEWHEEL()
 	//}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
 // Behandlungsroutinen für Nachrichten COpenGLControl 
-
-
+void COpenGLControl::OnMouseMove(UINT nFlags, CPoint point) 
+{
+    CWnd::OnMouseMove(nFlags, point);
+	// TODO: Add your message handler code here and/or call default
+    //AfxMessageBox("hura");
+	//m_atom_list->SetWindowTextA("hura");
+	//COpenGLControl::OnMouseMove(nFlags, point);
+    if(m_moving) {
+        MousePt.s.X=point.x;
+        MousePt.s.Y=point.y;
+        Quat4fT ThisQuat;
+        m_ArcBall.drag(&MousePt, &ThisQuat);// 
+        Matrix3fSetRotationFromQuat4f(&ThisRot, &ThisQuat);// 
+        Matrix3fMulMatrix3f(&ThisRot, &LastRot);// 
+        Matrix4fSetRotationFromMatrix3f(&Transform, &ThisRot);// 
+    }
+    DrawGLScene();
+}
+void COpenGLControl::OnLButtonDown(UINT nFlags, CPoint point) 
+{	
+    //AfxMessageBox("hura");
+	CWnd::OnLButtonDown(nFlags, point);
+	// redirect mouse messages to this pint from outside window
+	SetCapture();
+    m_moving = true;
+    
+    MousePt.s.X=point.x;
+    MousePt.s.Y=point.y;
+    LastRot = ThisRot;// 
+    m_ArcBall.click(&MousePt);// 
+}
+
+void COpenGLControl::OnLButtonUp(UINT nFlags, CPoint point) 
+{
+	CWnd::OnLButtonUp(nFlags, point);
+	// stop the outside window mouse tracing
+	ReleaseCapture();
+    m_moving = false;
+    Invalidate(TRUE);
+}
+BOOL COpenGLControl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) 
+{
+	// TODO: Add your message handler code here and/or call default
+	CWnd::OnMouseWheel(nFlags, zDelta, pt);
+	if (zDelta > 0)
+	{
+		m_zoom+=0.5;
+	}
+	else
+	{
+        m_zoom-=0.5;
+	}
+	
+    DrawGLScene();
+
+    return TRUE;
+}
 void COpenGLControl::InitGL()
 {
-	glShadeModel(GL_SMOOTH);
-	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-	glClearDepth(1.0f);							
-	//glEnable(GL_DEPTH_TEST);					
-	glDepthFunc(GL_LEQUAL);	
-	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
-}
-
+
+    m_ArcBall.setBounds(200, 200);
+    //ResetView();
+
+    //Init arcBall
+    m_ArcBall.click(&MousePt);
+    openGLDevice.makeCurrent();
+
+    glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
+
+    /* set viewing projection */    
+    glMatrixMode(GL_PROJECTION);
+	glOrtho(-5, 5, -5, 5, 0.1, 100);
+    //gluPerspective(45,size.x/size.y,0.1,100);
+
+
+    /* position viewer */
+    glMatrixMode(GL_MODELVIEW);
+    glTranslatef(0.0f, 0.0f, 0.0f);
+
+    glEnable(GL_COLOR_MATERIAL);
+    glEnable(GL_DEPTH_TEST);
+    glEnable(GL_LIGHTING);
+    glEnable(GL_LIGHT0);
+}
 void COpenGLControl::DrawGLScene()
 {
+        
+    float CenterX=0, CenterY=0, CenterZ=0;
+
+    // Init OpenGL once, but after SetCurrent
+    
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity(); 
+    
+	glOrtho(m_zoom, -1*m_zoom, m_zoom, -1*m_zoom, -30, 100);
+	//glFrustum(-0.5f, 0.5f, -0.5f, 0.5f, 1.0f, 3.0f);
+    //gluPerspective(45,size.x/size.y,0.1,100);    
+    glMatrixMode(GL_MODELVIEW);
+    
+    /* clear color and depth buffers */
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+    
+    glPushMatrix();// 
+    glTranslatef(0,0,m_zoom);
+    glMultMatrixf(Transform.M);
+
+
+
+
+    /*
 	glClear(GL_COLOR_BUFFER_BIT
 		 |  GL_DEPTH_BUFFER_BIT);
-
-
-	glLoadIdentity();
-
+    
+    //glLoadIdentity();
+    //Camera();
+	//glLoadIdentity();
+    */
+
+
+    glEnable(GL_LIGHTING);
+	glEnable(GL_NORMALIZE);
+	glEnable (GL_COLOR_MATERIAL);
 	//***************************
 	// DRAWING CODE
 	//***************************
 
 //	glTranslatef(0.0f,0.0f,-5.0f);
-	glRotatef(rotation,0.0f,1.0f,0.0f);
-
+    //glPushMatrix();
+	//glRotatef(rotation,0.0f,1.0f,0.0f);
+
+    static GLUquadricObj *quadObj3=NULL;
+	static GLUquadricObj *quadObj=NULL;
+
+
+	// sphere matereial
+	//GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
+    GLfloat mat_specular[]={1.0,1.0,1.0,1.0};
+    GLfloat mat_shiness[]={50.0};
+    //GLfloat colourAtom[]={color[0], color[1], color[2], 1.0};
+    //glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE,   colourAtom); 
+    glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
+    glMaterialfv(GL_FRONT,GL_SHININESS,mat_shiness);
+
+	
+  // sphere 
+	if (! quadObj3)
+	{
+		quadObj3 = gluNewQuadric();
+		gluQuadricDrawStyle (quadObj3, GLU_FILL);
+		gluQuadricNormals (quadObj3, GLU_SMOOTH);
+		gluQuadricOrientation (quadObj3, GLU_OUTSIDE);
+	}
+
+
+    for(int i=0;i<m_molecule.GetAtomNb();i++) {
+        Atom *at = m_molecule.GetAtomPointer(i);
+	    glPushMatrix();
+        glColor3f(at->ATproperties.color[0],
+					at->ATproperties.color[1],
+					at->ATproperties.color[2]);
+        
+        
+	    glTranslatef(at->X, at->Y, at->Z);              
+	    gluSphere (quadObj3, 0.2, (GLint) 16, (GLint) 16);
+	    glPopMatrix();                      
+	}
+
+
+    /*
 	glBegin(GL_TRIANGLES);
 		glColor3f(1.0f,0.0f,0.0f);
 		glVertex3f(1.0f,-1.0f,0.0f);
@@ -70,7 +259,7 @@
 		glColor3f(0.0f,0.0f,1.0f);
 		glVertex3f(0.0f,1.0f,0.0f);
 	glEnd();
-
+    */
 /*	glBegin(GL_QUADS);
 		glColor3f(1.0f,0.0f,0.0f);
 		glVertex3f(-1.1f,-1.1,0.0f);
@@ -78,7 +267,10 @@
 		glVertex3f(1.1f,1.1f,0.0f);
 		glVertex3f(-1.1f,1.1f,0.0f);
 	glEnd();*/
-
+    
+    glPopMatrix();
+
+    glFlush();
 	SwapBuffers(dc->m_hDC);
 }
 
@@ -106,6 +298,15 @@
 {
     openGLDevice.makeCurrent();
 }
+void COpenGLControl::setMolecule(Molecule m)
+{
+    m_molecule = m;
+}
+void COpenGLControl::removeMolecule()
+{
+    Molecule m;
+    m_molecule = m;
+}
 void COpenGLControl::OnPaint() 
 {
 	rotation += 0.01f;
@@ -119,6 +320,7 @@
 
 	openGLDevice.makeCurrent();
 
+
 	DrawGLScene();
 }
 
@@ -132,8 +334,10 @@
 	}
 
 
-	glViewport(0,0,cx,cy);	
-
+	glViewport(0,0,cx,cy);
+    m_ArcBall.setBounds(cx, cy);
+
+    /*
 	glMatrixMode(GL_PROJECTION);						
 	glLoadIdentity();						
 
@@ -143,6 +347,7 @@
 
 	glMatrixMode(GL_MODELVIEW);						
 	glLoadIdentity();
+    */
 }