Benoît Jacob [Sat, 22 Jul 2006 09:31:50 +0000 (09:31 +0000)]
Required: OpenBabel SVN revision 1534 or later
Make use again of OBMol::Center() and don't check anymore for weird bond
orders since Geoff fixed the cml-parsing
Fixed selection of atoms. Though, I've got a weird segfault when I
highlight 4 atoms or more, I don't understand what's happening. Atoms
are now highlighted in white because blue is taken by Nitrogen (OB's
color scheme), what do you think Carsten? I don't know what to do about
Hydrogen.
Re-enabled USE_DISPLAY_LISTS. With Mesa 6.5 (as provided with xorg 7.1)
I don't have problems, so maybe that was fixed between Mesa 6.2 and 6.5.
If anyone here has problems like "bonds are rendered too bright", please
tell me.
Some cosmetic changes in VertexArray.
Updated TODO.
CCMAIL: geoff@geoffhutchison.net
M kalzium/ideas/TODO
M kalzium/src/kalziumglwidget.h
M kalzium/src/kalziumglhelperclasses.h
M kalzium/src/moleculeview.cpp
M kalzium/src/kalziumglwidget.cpp
M kalzium/src/kalziumglhelperclasses.cpp
Benoît Jacob [Thu, 20 Jul 2006 12:39:14 +0000 (12:39 +0000)]
Prerequisite: you'll need OpenBabel SVN revision at least 1525.
Reorganization everywhere, especially:
- Make much more use of OpenBabel, especially for the geometry-stuff
- Molecule rendering style and related data is now stored using the
MolStyle struct.
- Big reorganization in the way display lists are used, when this
option is enabled. It is currently disabled, though, because of what
might be a bug in Mesa3d.
New Features:
- draw multiple bonds
- support for van der Waals radius. Different atoms are now rendered
with different sizes.
Optimizations:
- the sphere now uses 2x less memory when not using display
lists (achieved by using the same unique array as vertex&normal arrays)
Other changes:
- improved specular color computation in Color::applyAsMaterials()
- reorganized styles, removed "lines" style (looked useless, was
inconsistent with multiple bonds)
- when the uses clicks "cancel" in the Load molecule dialog, don't try
to load the molecule with filename "".
- lots more that I can't list
CCMAIL: geoff@geoffhutchison.net
M src/kalziumglwidget.h
M src/kalziumglhelperclasses.h
M src/moleculeview.cpp
M src/kalziumglwidget.cpp
M src/kalziumglhelperclasses.cpp
M src/moleculeviewerwidget.ui
Benoît Jacob [Mon, 3 Jul 2006 15:31:13 +0000 (15:31 +0000)]
Changes in Kalzium's 3D renderer:
- Display Lists are back. Enable by #defining USE_DISPLAY_LISTS
(currently enabled).
Advantage: makes rendering faster
Inconvenient: uses more memory
TODO: measure how much more memory it uses.
Vertex arrays are now automatically converted into (nested) display
lists when this option is set. This prevents vertex array data from
being redundantly copied into the display list.
- Now use OB's GetRGB function to get the color of atoms
- Implement our own molecule centering code. Neither OBMol::Center() nor
OBMol::Translate() did work for me (but maybe I'm stupid).
- reorganization in the VertexArray class ( more to come )
M src/kalziumglwidget.h
M src/kalziumglhelperclasses.h
M src/kalziumglwidget.cpp
M src/kalziumglhelperclasses.cpp
Benoît Jacob [Sun, 2 Jul 2006 11:35:46 +0000 (11:35 +0000)]
main change: added TextRenderer class (and CharRenderer helper class)
TextRenderer comment (sorry if this sounds too verbose, I just though it'd be
useful to explain why I didn't just use QGLWidget::renderText()) :
/** This class renders text inside a QGLWidget. It replaces the functionality
* of QGLWidget::renderText(). The advantages over renderText() include:
* - supports any font, any character encoding supported by Qt
* (renderText is 8-bit-only and can only use "OpenGL-compatible" fonts)
* - does not use any library outside Qt (renderText uses FreeType on X11)
* - renders characters as textured quads instead of calling glDrawPixels,
* which does not make much of a difference on MesaGL, but can be a lot
* faster and safer with other (buggy) OpenGL implementations. It will also
* allow to add more graphical effects in the future, like rotation,
* if we ever need that.
* - the characters are stored as 8bpp Alpha, which takes 4 times less
* memory than the 32bpp RGBA used by renderText.
* - the characters are rendered on-the-fly on the first time they appear
* in a QString being printed. This is achieved using a QHash to test whether
* a character has already been rendered.
M src/kalziumglwidget.h
M src/kalziumglhelperclasses.h
M src/moleculeview.cpp
M src/kalziumglwidget.cpp
M src/kalziumglhelperclasses.cpp
Carsten Niehaus [Wed, 28 Jun 2006 20:50:14 +0000 (20:50 +0000)]
Adding autorotation and the slots for zoomin/out. Benoit, I added the code but have no idea how to do it propery (no 3d-knowledge). I added long comments for you there.
Benoît Jacob [Wed, 28 Jun 2006 15:10:35 +0000 (15:10 +0000)]
fix selection of multiple atoms (Carsten: I apologize for the lack of
documentation of my rendering code. Currently you have to call
m_sphere.select() before you can draw a sphere. I could change that now
to make it more easy to use, but it's not the right time to do it
because a lot of things are going to change when we'll implement
rendering different atoms with different sizes).
also begin implementation of text renderer for the GL widget. The
problem with QGLWidget::renderText is that it only works for ASCII text
(possibly 8-bit-extended, though I don't know how to set the character
encoding, but in any case no unicode) . Thus no
safe i18n is possible. Even if it's not necessary to display the message
"please load molecule", I thought it'd be nice to have the possibility
to display whatever text we want in the QGLWidget. But if you think it's
futile, I'll drop it.
Benoit
M kalzium/src/kalziumglwidget.h
M kalzium/src/kalziumglhelperclasses.h
M kalzium/src/kalziumglwidget.cpp
Carsten Niehaus [Wed, 28 Jun 2006 11:32:28 +0000 (11:32 +0000)]
* Make it possible to select more than 1 atoms. 1 selected atom is now
just a special case of many atoms (QList<Atom*> with just one member
* Currently the selection is hardcoded to atom 2 and 6, I am now
coding the QTreeWidget-code
* Benoit: The sphere is not drawn, only the bond it seems... No clue why
I don't know the structure of the GL-code :)
Benoît Jacob [Mon, 26 Jun 2006 22:01:09 +0000 (22:01 +0000)]
Big reorganization in kalziumglhelperclasses
By the way, maybe we shoud rename these files kalziumglhelpers, because
there's not only classes there, but also functions (all within a
namespace I called KalziumGLHelpers).
Another change is, I removed support for caching with GL display lists.
The reason is, it was getting more and more complicated, and it would
really have been a pain to handle atoms with different radii. (The main
problem is that in principle, GL display lists are incompatible with
glVertexPointer).
Carsten, I tried to do as you asked, display "Please load a molecule" at
KalziumGLWidget startup, but I hit the weirdness of
QGLWidget::renderText(), and I had to give up. Googling for that showed
me that many people had the same problems, but I couldn't find a
solution. I'll ask kde-devel, I think.
Benoit
M kalzium/src/kalziumglwidget.h
M kalzium/src/kalziumglhelperclasses.h
M kalzium/src/kalziumglwidget.cpp
M kalzium/src/kalziumglhelperclasses.cpp
Carsten Niehaus [Mon, 26 Jun 2006 13:47:58 +0000 (13:47 +0000)]
Benoit, kalziumglwidget.h/cpp grew just to big, that is why I
moved the code into kalziumglhelperclasses.h/cpp, onle the GLWidget
itself stays in src/kalziumglwidget.cpp.
But for some cpp-magic-reasons I needed to remove two inline-calls,
don't ask me why. Furhtermore,
template<class T> void GLVector3<T>::construct_ortho_basis_given_first_vector
is not longer found when linking, not the slightest idea why... The
other methods of GLVector are found when linking...
Benoît Jacob [Mon, 26 Jun 2006 10:18:33 +0000 (10:18 +0000)]
Changes in kalziumglwidget:
- added FPS (frames per second) counter. Enable it by #defining
USE_FPS_COUNTER. (Currently enabled).
- added option to cache the rendering of the molecule using a GL display
list. This improves speed, especially for rendering complex
molecules; I have measured a speed increase above +35% in some cases
(depends also on the style and the widget size). Enable it by
#defining USE_DISPLAY_LIST. (Currently enabled).
Change in latticedialog:
- I allowed myself to comment out ui.glWidget->update(); in
LatticeDialog::slotUpdateView() because normally this is being
taken care of by slotSetMolecule; also I think that for a GL widget,
one should call updateGL() instead of update(); not 100% sure here.
Carsten, I didn't see the "blank widget" bug in the lattice viewer;
have you already solved it?
M kalzium/src/kalziumglwidget.h
M kalzium/src/kalziumglwidget.cpp
M kalzium/src/latticedialog.cpp
Benoît Jacob [Sun, 25 Jun 2006 13:08:39 +0000 (13:08 +0000)]
Add intelligent (so to speak) level-of-detail handling in Kalzium's
OpenGL engine. For instance smaller spheres will be drawn with smaller
detail level.
Carsten Niehaus [Sat, 24 Jun 2006 21:04:21 +0000 (21:04 +0000)]
Many OpenGL-fixes from Benoit.
Benoit, feel free to commit yourself from now on!
Benoit, is it possible that you forgot to center the molecule? They are rotating here like they did in the very first version of your code... But the reason might be that I am now using OpenBabel 2.1...
Carsten Niehaus [Sat, 24 Jun 2006 14:16:55 +0000 (14:16 +0000)]
Benoit, please copy test.cml to /home/kde4/ and then test the latticeviewer. Somehow I will need a new view-type for crystals. I want it to look a bit like this
Carsten Niehaus [Sat, 17 Jun 2006 21:06:47 +0000 (21:06 +0000)]
Changes by Benoit:
- implemented highlighting of selected atom (paints it in a blue color that is
influenced by the original color)
- now uses GLColor struct to handle color stuff
- in big-spheres style, use smaller spheres (tell me what you think of this)
- some slotChooseStylePreset reorganization
Carsten Niehaus [Fri, 16 Jun 2006 09:23:32 +0000 (09:23 +0000)]
* Using M_PI and not a selfdefined pi.
* Update the view after the molecule has been changed
* Wouldn't it make sense to really only set m_molecule in the slotSetMolecule()
and have a second slot/method in which we'd recalculate things?
Carsten Niehaus [Wed, 14 Jun 2006 16:59:18 +0000 (16:59 +0000)]
* Add Benoit in the credit-section
* Adding apidox and some compile warning-fixes
* Make use of the ui, well, the plugin still does not link and I have not the faintest idea why
Carsten Niehaus [Mon, 12 Jun 2006 15:05:06 +0000 (15:05 +0000)]
* Ok, make the dialog more sane, adding some slots so that Benoit can continue
* Benoit: You'll notice some changes in the GL-classes. I added 2 members and 2 slots.
In the moleculewidget I removed everything but the constructor. I hope that works
fine for you :)