From dfa7e1dd22e80c403d9a639bdbdf472cd4f74a29 Mon Sep 17 00:00:00 2001 From: Carsten Niehaus Date: Mon, 12 Jun 2006 17:02:10 +0000 Subject: [PATCH] This way we can test with real testfiles. Only problem: The path is still hardcoded svn path=/trunk/KDE/kdeedu/kalzium/src/kalziumglwidget.cpp; revision=550760 --- kalzium/kalziumglwidget.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/kalzium/kalziumglwidget.cpp b/kalzium/kalziumglwidget.cpp index 9cb8b44..4dee5d7 100644 --- a/kalzium/kalziumglwidget.cpp +++ b/kalzium/kalziumglwidget.cpp @@ -15,9 +15,16 @@ #include + #include #include +#include "openbabel2wrapper.h" +#include +#include + +using namespace OpenBabel; + KalziumGLWidget::KalziumGLWidget( QWidget * parent ) : QGLWidget( parent ) { @@ -77,13 +84,21 @@ void KalziumGLWidget::initializeGL() void KalziumGLWidget::paintGL() { + if ( !m_molecule ) + return; + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glLoadIdentity(); glTranslated( 0.0, 0.0, -12.0); glMultMatrixd( RotationMatrix ); - drawSphere(1.0, -1.0, -2.0, 1.5, 1.0, 0.0, 0.0); - drawSphere(-2.0, 1.0, 1.0, 2.5, 0.0, 1.0, 0.0); - drawSphere(2.0, 0.5, 0.0, 1.0, 0.0, 0.0, 1.0); + + FOR_ATOMS_OF_MOL( a, m_molecule ) + { + GLdouble x = ( GLdouble )a->GetX(); + GLdouble y = ( GLdouble )a->GetY(); + GLdouble z = ( GLdouble )a->GetZ(); + drawSphere(x,y,z,1.0, 1.0, 0.0, 0.0); + } } void KalziumGLWidget::resizeGL( int width, int height ) -- 2.47.3