home *** CD-ROM | disk | FTP | other *** search
/ 3DS Max Model 2 / 3dsModelCD2.iso / ALTEROS / setup.exe / #setuppath# / PLUGINS / GLC.X3D / CPP / SELECT_MATERIAL < prev    next >
Encoding:
Text File  |  2002-04-04  |  733 b   |  29 lines

  1. void MyMaterial(GLenum mode,GLfloat *f,GLfloat alpha)
  2. {
  3.  GLfloat d[4];
  4.  d[0]=f[0];
  5.  d[1]=f[1];
  6.  d[2]=f[2];
  7.  d[3]=alpha;
  8.  glMaterialfv (GL_FRONT_AND_BACK,mode,d);
  9. }
  10. /*
  11.  *  SelectMaterial uses OpenGL commands to define facet colors.
  12.  *
  13.  *  Returns:
  14.  *    Nothing
  15.  */
  16.  
  17. void SelectMaterial(int i)
  18. {
  19.   //
  20.   // Define the reflective properties of the 3D Object faces.
  21.   //
  22.   glEnd();
  23.   GLfloat alpha=materials[i].alpha;
  24.   MyMaterial (GL_AMBIENT, materials[i].ambient,alpha);
  25.   MyMaterial (GL_DIFFUSE, materials[i].diffuse,alpha);
  26.   MyMaterial (GL_SPECULAR, materials[i].specular,alpha);
  27.   MyMaterial (GL_EMISSION, materials[i].emission,alpha);
  28.   glMaterialf (GL_FRONT_AND_BACK,GL_SHININESS,materials[i].phExp);
  29.