/[xmakemol]/xmakemol/gl_funcs.c
ViewVC logotype

Diff of /xmakemol/gl_funcs.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.58 by MPHodges, Mon Mar 17 20:17:06 2003 UTC revision 1.59 by MPHodges, Tue Apr 1 22:00:41 2003 UTC
# Line 542  void gl_render_atom (int i) Line 542  void gl_render_atom (int i)
542          }          }
543        else        else
544          {          {
545            gluSphere (gl_quadric,            if (gl_use_lighting)
546                       atom_size,              {
547                       gl_no_atom_segments,                gluSphere (gl_quadric,
548                       gl_no_atom_segments);                           atom_size,
549                             gl_no_atom_segments,
550                             gl_no_atom_segments);
551                }
552              else
553                {
554                  double get_smallest_cov_rad (void);
555                  double line_width;
556    
557                  line_width = 0.1 * get_atom_scale () * get_smallest_cov_rad ();
558    
559                  if (vector_flag && (atoms[i].has_vector > 0))
560                    {
561                      /* Can't use a disk if there is a vector */
562    
563                      gluSphere (gl_quadric,
564                                 atom_size - line_width,
565                                 gl_no_atom_segments,
566                                 gl_no_atom_segments);
567    
568                      glColor3f (0.0, 0.0, 0.0);
569    
570                      /* Move slightly forward */
571    
572                      glTranslatef (0.0, 0.0, 0.01);
573    
574                      gluDisk (gl_quadric,
575                               0,
576                               atom_size,
577                               gl_no_atom_segments,
578                               1);
579                    }
580                  else
581                    {
582                      gluDisk (gl_quadric,
583                               0,
584                               atom_size,
585                               gl_no_atom_segments,
586                               1);
587    
588                      glColor3f (0.0, 0.0, 0.0);
589    
590                      /* Move slightly forward */
591    
592                      glTranslatef (0.0, 0.0, 0.01);
593    
594                      gluDisk (gl_quadric,
595                               atom_size - line_width,
596                               atom_size,
597                               gl_no_atom_segments,
598                               1);
599                    }
600                }
601          }          }
602      }      }
603    else    else
# Line 648  void gl_render_bond (int i, Line 700  void gl_render_bond (int i,
700                       int j)                       int j)
701  {  {
702    enum render_stereo_types get_gl_render_stereo(void);/* aro */    enum render_stereo_types get_gl_render_stereo(void);/* aro */
703      double get_smallest_cov_rad (void);
704      void update_canvas_bond_points (int, int, Boolean, double);
705    
706    double angle, b[3], bond_radius, length, mod_b;    int k;
707      double angle, b[3], bond_radius, length, mod_b, line_width;
708    GLfloat red, green, blue;    GLfloat red, green, blue;
709    
710    /* We want the radius, ie half the width which represents the    /* We want the radius, ie half the width which represents the
# Line 684  void gl_render_bond (int i, Line 739  void gl_render_bond (int i,
739    glColorMaterial (GL_FRONT, GL_DIFFUSE);    glColorMaterial (GL_FRONT, GL_DIFFUSE);
740    glColor3f (red, green, blue);    glColor3f (red, green, blue);
741    
742    glPushMatrix ();    if (gl_use_lighting)
743        {
744          glPushMatrix ();
745    
746    glTranslatef (atoms[i].x, atoms[i].y, atoms[i].z);        glTranslatef (atoms[i].x, atoms[i].y, atoms[i].z);
747    
748    glRotatef (180.0, 0.0, 0.0, 1.0);        glRotatef (180.0, 0.0, 0.0, 1.0);
749    glRotatef (angle, b[1], -1.0 * b[0], 0.0);        glRotatef (angle, b[1], -1.0 * b[0], 0.0);
750    
751    /* length of bond segment */        /* length of bond segment */
752    
753    length = (mod_b * atoms[i].cov_rad /        length = (mod_b * atoms[i].cov_rad /
754              (atoms[i].cov_rad + atoms[j].cov_rad));              (atoms[i].cov_rad + atoms[j].cov_rad));
755          
756          gluCylinder (gl_quadric,
757                       bond_radius,
758                       bond_radius,
759                       length,
760                       gl_no_bond_segments,
761                       1);
762    
763    gluCylinder (gl_quadric,        glPopMatrix ();
764                 bond_radius,      }
765                 bond_radius,    else
766                 length,      {
767                 gl_no_bond_segments,        line_width = 0.1 * get_atom_scale () * get_smallest_cov_rad ();
768                 1);        
769          /* FIXME: we don't need to update the canvas_bond_points, but
770             this will do the cartesian_bond_points that we need */
771    
772    glPopMatrix ();        update_canvas_bond_points (i, j, False, line_width);
773    
774          glBegin (GL_POLYGON);
775    
776          k = 0;
777    
778          glVertex3f (cartesian_bond_points[k][0],
779                      cartesian_bond_points[k][1],
780                      cartesian_bond_points[k][2]);
781    
782          k = 1;
783    
784          glVertex3f (cartesian_bond_points[k][0],
785                      cartesian_bond_points[k][1],
786                      cartesian_bond_points[k][2]);
787    
788          k = 4;
789    
790          glVertex3f (cartesian_bond_points[k][0],
791                      cartesian_bond_points[k][1],
792                      cartesian_bond_points[k][2]);
793    
794          k = 5;
795    
796          glVertex3f (cartesian_bond_points[k][0],
797                      cartesian_bond_points[k][1],
798                      cartesian_bond_points[k][2]);
799    
800          glEnd ();
801    
802          /* Outline */
803    
804          glColor3f (0.0, 0.0, 0.0);
805    
806          update_canvas_bond_points (i, j, False, 0.0);
807    
808          glTranslatef (0.0, 0.0, -0.01);
809    
810          glBegin (GL_POLYGON);
811    
812          k = 0;
813    
814          glVertex3f (cartesian_bond_points[k][0],
815                      cartesian_bond_points[k][1],
816                      cartesian_bond_points[k][2]);
817    
818          k = 1;
819    
820          glVertex3f (cartesian_bond_points[k][0],
821                      cartesian_bond_points[k][1],
822                      cartesian_bond_points[k][2]);
823    
824          k = 4;
825    
826          glVertex3f (cartesian_bond_points[k][0],
827                      cartesian_bond_points[k][1],
828                      cartesian_bond_points[k][2]);
829    
830          k = 5;
831    
832          glVertex3f (cartesian_bond_points[k][0],
833                      cartesian_bond_points[k][1],
834                      cartesian_bond_points[k][2]);
835    
836          glEnd ();
837    
838        }
839  }  }
840    
841  void gl_render_hbonds (void)  void gl_render_hbonds (void)
# Line 899  void gl_render_vectors (void) Line 1030  void gl_render_vectors (void)
1030      }      }
1031    
1032    glColorMaterial (GL_FRONT, GL_DIFFUSE);    glColorMaterial (GL_FRONT, GL_DIFFUSE);
   glColor3f (0.5, 0.5, 0.5);  
1033    
1034    for (i = 0; i < no_atoms; i++)    for (i = 0; i < no_atoms; i++)
1035      {      {
# Line 927  void gl_render_vector (int i, int j) Line 1057  void gl_render_vector (int i, int j)
1057    vector_arrow_angle = get_vector_arrow_angle ();    vector_arrow_angle = get_vector_arrow_angle ();
1058    vector_arrow_scale = get_vector_arrow_scale ();    vector_arrow_scale = get_vector_arrow_scale ();
1059    vector_scale = get_vector_scale ();    vector_scale = get_vector_scale ();
1060    
1061    /* Draw stem */    /* Draw stem */
1062      glColor3f (0.5, 0.5, 0.5);
1063    
1064    vector[0] = atoms[i].v[j][0] * vector_scale;    vector[0] = atoms[i].v[j][0] * vector_scale;
1065    vector[1] = atoms[i].v[j][1] * vector_scale;    vector[1] = atoms[i].v[j][1] * vector_scale;
# Line 959  void gl_render_vector (int i, int j) Line 1090  void gl_render_vector (int i, int j)
1090    
1091    /* Draw head  */    /* Draw head  */
1092    
1093      glColor3f (0.0, 0.0, 0.0);
1094    
1095    top_radius = height *    top_radius = height *
1096      tan (vector_arrow_angle * DEG2RAD);      tan (vector_arrow_angle * DEG2RAD);
1097    

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26