[Chimera-users] WebGL viewer

Thomas Hrabe thrabe at sanfordburnham.org
Sat Dec 27 11:29:52 PST 2014

Hi everyone,

I am trying to implement a EM density viewer in a HTML page based on the chimera webgl & html export feature.
The original page chimera exports when you save a webgl / html scene has been modified to load multiple JSON objects with densities as they come from chimera.
The bar at the bottom of the page essentially performs a coarse density sliding similar to chimera.
Almost all works great but what I am missing is how to connect the rotation that was applied to one model and to propagate it to all other models.
What is happening now is that when one rotates one model and slides the bar, the next model will not be rotated but will be in it’s original position.

Here’s my page I am currently working on

I tried catching the mouse event with a loop, but it seems it fails to propagate the rotation to the other models.
Check the block at line 916 in the code

  try {
    var rotMat = vsphere(mouse_position, new_position);
    var camera = this.camera;
    var matrix = new Mat4;
    matrix.$translate(camera.target[0], camera.target[1],
    matrix.$translate(-camera.target[0], -camera.target[1],
    for (var i = 0, models = this.scene.models, l = models.length; i < l; ++i) {
      var elem = models[i];
      elem.matrix = matrix.mulMat4(elem.matrix);

Thank you in advance for your help,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20141227/1cf28071/attachment.html>

More information about the Chimera-users mailing list