Updates

Sorry that I didn’t reply earlier, I had not subscribed until now.

Of course there are a few twists. First, I still can’t really get the
Color class to work, which is too bad.

Could you describe the problems?

It would be great to split
this out and make subclasses for setting colors based on arbitrary
properties of an atom, bond, residue, whatever.

Don’t you like the ability of just writing Color( atom ).applyAsMaterials(); ?
By adding more constructors one could supports bonds or whatever.

The GL selection code also doesn’t currently filter out based on z-
index,

It does! In Kalzium, it consistently selects the nearest atom. Can’t look into
your code right now, but I’d suggest to have a look at the projection
(perspective) matrix you’re using.

Benoit

OK, I put in some initial support for atom selection. Yes, this
basically just duplicates the Kalzium GL widget code. :slight_smile: There’s
also now support for residue and whole-molecule render engines. The
"ResidueSphere" engine is really silly – I just don’t know much
about “ribbon” or “cartoon” views for proteins are supposed to look.

Of course there are a few twists. First, I still can’t really get the
Color class to work, which is too bad. It would be great to split
this out and make subclasses for setting colors based on arbitrary
properties of an atom, bond, residue, whatever.

The GL selection code also doesn’t currently filter out based on z-
index, so it’s a real problem with spheres mode where a lot of
overlapping spheres will get selected.

It’s probably not a bad idea to keep a list of selected atoms/objects
in the GLWidget itself for measurements, etc.

I’m just out of time for today. Next time I’ll try to do more cleanup
and documentation.

Cheers,
-Geoff

On Sep 1, 2006, at 8:40 AM, Benoît Jacob wrote:

It would be great to split
this out and make subclasses for setting colors based on arbitrary
properties of an atom, bond, residue, whatever.

Don’t you like the ability of just writing Color
( atom ).applyAsMaterials(); ?
By adding more constructors one could supports bonds or whatever.

I like this ability – it just doesn’t seem to be changing the color,
while glColor3d() does work. Would there be a missing glEnable() or
something?

The GL selection code also doesn’t currently filter out based on
z-index,

It does! In Kalzium, it consistently selects the nearest atom.
Can’t look into
your code right now, but I’d suggest to have a look at the projection
(perspective) matrix you’re using.

I was commenting on the current state of the Avogadro code, not
OpenGL. Donald fixed that nicely, so there’s regular click-to-select
and drag-a-rectangle_selection.

Cheers,
-Geoff

Le vendredi 01 septembre 2006 16:34, vous avez écrit :

On Sep 1, 2006, at 8:40 AM, Benoît Jacob wrote:

It would be great to split
this out and make subclasses for setting colors based on arbitrary
properties of an atom, bond, residue, whatever.

Don’t you like the ability of just writing Color
( atom ).applyAsMaterials(); ?
By adding more constructors one could supports bonds or whatever.

I like this ability – it just doesn’t seem to be changing the color,
while glColor3d() does work. Would there be a missing glEnable() or
something?

OK, I guess that you aren’t using lighting, right? Then you must use
Color::apply(), not Color::applyAsMaterials().

or perhaps you enabled GL_COLOR_MATERIAL. I didn’t test it, it’s possible that
applyAsMaterials() doesn’t work with it. In this case, just use apply()
instead. Anyway, if glColor3d() does what you want, then apply() will also,
because it does about the same thing. But for nicer lighting/shading effects,
i’d recommend using applyAsMaterials() instead.

Well, tell me if this still doesn’t work.

I was commenting on the current state of the Avogadro code, not
OpenGL. Donald fixed that nicely, so there’s regular click-to-select
and drag-a-rectangle_selection.

good!

Benoit

By the way, for a nice specular color, be sure to do:

glEnable( GL_COLOR_SUM_EXT );
glLightModeli( GL_LIGHT_MODEL_COLOR_CONTROL_EXT,
	GL_SEPARATE_SPECULAR_COLOR_EXT );

in your OpenGL initialization code.

Benoit

I like this ability – it just doesn’t seem to be changing the color,
while glColor3d() does work. Would there be a missing glEnable() or
something?

OK, I guess that you aren’t using lighting, right? Then you must use
Color::apply(), not Color::applyAsMaterials().

or perhaps you enabled GL_COLOR_MATERIAL. I didn’t test it, it’s possible
that applyAsMaterials() doesn’t work with it. In this case, just use
apply() instead. Anyway, if glColor3d() does what you want, then apply()
will also, because it does about the same thing. But for nicer
lighting/shading effects, i’d recommend using applyAsMaterials() instead.

Well, tell me if this still doesn’t work.