void Draw_Legs(GL2 gl2) {
	  if(!render_meshes) {/*
	    int i,j;

	    for(i=0;i<6;++i) {
	      Leg leg=legs[i];

	      gl2.glDisable(GL2.GL_LIGHTING);

	      switch(i) {
	      case 0:  gl2.glColor3f(1,0,0);  break;
	      case 1:  gl2.glColor3f(0,1,0);  break;
	      case 2:  gl2.glColor3f(0,0,1);  break;
	      case 3:  gl2.glColor3f(1,1,0);  break;
	      case 4:  gl2.glColor3f(0,1,1);  break;
	      case 5:  gl2.glColor3f(1,0,1);  break;
	      }
	      
	      // last point of contact
	      gl2.glBegin(GL2.GL_LINE_LOOP);
	      gl2.glVertex3f(leg.lpoc.x+0.5f, leg.lpoc.y-0.5f, 0);
	      gl2.glVertex3f(leg.lpoc.x+0.5f, leg.lpoc.y+0.5f, 0);
	      gl2.glVertex3f(leg.lpoc.x-0.5f, leg.lpoc.y+0.5f, 0);
	      gl2.glVertex3f(leg.lpoc.x-0.5f, leg.lpoc.y-0.5f, 0);
	      gl2.glEnd();
	      gl2.glBegin(GL2.GL_LINES);
	      gl2.glVertex3f(leg.npoc.x-1.0f, leg.npoc.y, 0);
	      gl2.glVertex3f(leg.npoc.x+1.0f, leg.npoc.y, 0);
	      gl2.glVertex3f(leg.npoc.x, leg.npoc.y-1.0f, 0);
	      gl2.glVertex3f(leg.npoc.x, leg.npoc.y+1.0f, 0);
	      gl2.glEnd();

	      // next point of contact
	      gl2.glBegin(GL2.GL_LINE_LOOP);
	      gl2.glVertex3f(leg.npoc.x+0.75f, leg.npoc.y-0.75f, 0);
	      gl2.glVertex3f(leg.npoc.x+0.75f, leg.npoc.y+0.75f, 0);
	      gl2.glVertex3f(leg.npoc.x-0.75f, leg.npoc.y+0.75f, 0);
	      gl2.glVertex3f(leg.npoc.x-0.75f, leg.npoc.y-0.75f, 0);
	      gl2.glEnd();

	      gl2.glBegin(GL2.GL_LINES);
	      Vector3f under = new Vector3f(leg.ankle_joint.pos);
	      under.z=0;
	      gl2.glVertex3f(leg.ankle_joint.pos.x,leg.ankle_joint.pos.y,leg.ankle_joint.pos.z);
	      gl2.glVertex3f(under.x,under.y,under.z);
	      gl2.glEnd();

	      leg.pan_joint.Draw(gl2,2);
	      leg.tilt_joint.Draw(gl2,1);
	      leg.knee_joint.Draw(gl2,3);

	      gl2.glEnable(GL2.GL_LIGHTING);
	      
	      // shoulder
	      //gl2.glBegin(GL2.GL_LINE_LOOP);
	      gl2.glBegin(GL2.GL_QUADS);
	      gl2.glColor3f(0,1,0);
	      gl2.glNormal3f( -leg.pan_joint.up.x,-leg.pan_joint.up.y,-leg.pan_joint.up.z );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );

	      gl2.glNormal3f( leg.pan_joint.up.x,leg.pan_joint.up.y,leg.pan_joint.up.z );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glEnd();

	      gl2.glBegin(GL2.GL_QUADS);
	      gl2.glColor3f(0,1,0);
	      gl2.glNormal3f( leg.pan_joint.forward.x,leg.pan_joint.forward.y,leg.pan_joint.forward.z );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );

	      gl2.glNormal3f( -leg.pan_joint.forward.x,-leg.pan_joint.forward.y,-leg.pan_joint.forward.z );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glEnd();

	      gl2.glBegin(GL2.GL_QUADS);
	      gl2.glColor3f(0,1,0);
	      gl2.glNormal3f( leg.pan_joint.left.x,leg.pan_joint.left.y,leg.pan_joint.left.z );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f + leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );

	      gl2.glNormal3f( -leg.pan_joint.left.x,-leg.pan_joint.left.y,-leg.pan_joint.left.z );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glVertex3f( leg.pan_joint.pos + leg.pan_joint.forward * 3.232f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * 5.0 );
	      gl2.glVertex3f( leg.pan_joint.pos - leg.pan_joint.forward * 1.000f - leg.pan_joint.left * 1.5f + leg.pan_joint.up * -1.0 );
	      gl2.glEnd();
	      

	      // femur
	      gl2.glNormal3f( leg.tilt_joint.left.x,leg.tilt_joint.left.y,leg.tilt_joint.left.z);
	      Vector3f pivot = new Vector3f(leg.tilt_joint.up);
	      pivot.scale(5);
	      pivot.add(leg.tilt_joint.pos);
	      gl2.glBegin(GL2.GL_TRIANGLE_STRIP);
	      gl2.glColor4f(1,0,0,1);
	      for(j=0;j<=16;++j) {
	    	  float js=(float)Math.sin(j*(float)Math.PI/32.0f);
	    	  float jc=(float)Math.cos(j*(float)Math.PI/32.0f);
	    	  gl2.glVertex3f( pivot - leg.tilt_joint.up * (4.0f * js) + leg.tilt_joint.forward * (4.0f * jc) + leg.tilt_joint.left * 2.0f );
	    	  gl2.glVertex3f( pivot - leg.tilt_joint.up * (6.0f * js) + leg.tilt_joint.forward * (6.0f * jc) + leg.tilt_joint.left * 2.0f );
	      }
	      gl2.glEnd();
	      gl2.glBegin(GL2.GL_TRIANGLE_STRIP);
	      for(j=0;j<=16;++j) {
	    	  float js=(float)Math.sin(j*(float)Math.PI/32.0f);
	    	  float jc=(float)Math.cos(j*(float)Math.PI/32.0f);
	    	  gl2.glVertex3f( pivot - leg.tilt_joint.up * (4.0f * js) + leg.tilt_joint.forward * (4.0f * jc) + leg.tilt_joint.left * -2.0f );
	    	  gl2.glVertex3f( pivot - leg.tilt_joint.up * (6.0f * js) + leg.tilt_joint.forward * (6.0f * jc) + leg.tilt_joint.left * -2.0f );
	      }
	      gl2.glEnd();

	      if(leg.active) {
	        // femur outline
	        gl2.glDisable(GL2.GL_LIGHTING);
	        Vector3f pivot( leg.tilt_joint.pos + leg.tilt_joint.up * 5.5f );
	        gl2.glBegin(GL2.GL_LINE_LOOP);
	        gl2.glColor3f(1,1,0);
	        for(j=0;j<=16;++j) {
	          float js=sin(j*PI/32);
	          float jc=cos(j*PI/32);
	          gl2.glVertex3fv( pivot - leg.tilt_joint.up * (4.0f * js) + leg.tilt_joint.forward * (4.0f * jc) + leg.tilt_joint.left * 2.0f );
	        }
	        for(j=16;j>=0;--j) {
	          float js=sin(j*PI/32);
	          float jc=cos(j*PI/32);
	          gl2.glVertex3fv( pivot - leg.tilt_joint.up * (6.0f * js) + leg.tilt_joint.forward * (6.0f * jc) + leg.tilt_joint.left * 2.0f );
	        }
	        gl2.glEnd();
	        gl2.glBegin(GL2.GL_LINE_LOOP);
	        gl2.glColor3f(1,1,0);
	        for(j=0;j<=16;++j) {
	          float js=sin(j*PI/32);
	          float jc=cos(j*PI/32);
	          gl2.glVertex3fv( pivot - leg.tilt_joint.up * (4.0f * js) + leg.tilt_joint.forward * (4.0f * jc) + leg.tilt_joint.left * -2.0f );
	        }
	        for(j=16;j>=0;--j) {
	          float js=sin(j*PI/32);
	          float jc=cos(j*PI/32);
	          gl2.glVertex3fv( pivot - leg.tilt_joint.up * (6.0f * js) + leg.tilt_joint.forward * (6.0f * jc) + leg.tilt_joint.left * -2.0f );
	        }
	        gl2.glEnd();
	        gl2.glEnable(GL2.GL_LIGHTING);
	      }

	      // tibia
	      gl2.glNormal3fv(leg.knee_joint.left );
	      gl2.glBegin(GL2.GL_POLYGON);
	      gl2.glColor4f(0,0,1,1);
	      gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up *  1.1f + leg.knee_joint.forward * -3.0f );
	      gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up *  1.1f + leg.knee_joint.forward *  0.0f );
	      gl2.glVertex3fv( leg.knee_joint.pos                             + leg.knee_joint.forward * 10.0f );
	      gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up * -1.1f + leg.knee_joint.forward *  0.0f );
	      gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up * -1.1f + leg.knee_joint.forward * -3.0f );
	      gl2.glEnd();

	      if(leg.active) {
	        gl2.glDisable(GL2.GL_LIGHTING);
	        // tibia outline
	        gl2.glBegin(GL2.GL_LINE_LOOP);
	        gl2.glColor3f(1,1,0);
	        gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up *  1.1f + leg.knee_joint.forward * -3.0f );
	        gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up *  1.1f + leg.knee_joint.forward *  0.0f );
	        gl2.glVertex3fv( leg.knee_joint.pos                             + leg.knee_joint.forward * 10.0f );
	        gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up * -1.1f + leg.knee_joint.forward *  0.0f );
	        gl2.glVertex3fv( leg.knee_joint.pos + leg.knee_joint.up * -1.1f + leg.knee_joint.forward * -3.0f );
	        gl2.glEnd();
	        gl2.glEnable(GL2.GL_LIGHTING);
	      }
	    }*/
	  } else {
	    int i;
	    FloatBuffer m = FloatBuffer.allocate(16);

	    for(i=0;i<6;++i) {
	      Leg leg = legs[i];
	      leg.Draw(gl2,i);

	      gl2.glPushMatrix();
	      gl2.glColor3f(0,1,0);
	      gl2.glTranslatef(leg.pan_joint.pos.x,
	                   		leg.pan_joint.pos.y,
	                   		leg.pan_joint.pos.z);
	      gl2.glTranslatef(leg.pan_joint.up.x*2.5f,
	                   		leg.pan_joint.up.y*2.5f,
	                   		leg.pan_joint.up.z*2.5f);

	      if(i<3) {
	        gl2.glTranslatef(leg.pan_joint.forward.x*-1.0f,
	                     leg.pan_joint.forward.y*-1.0f,
	                     leg.pan_joint.forward.z*-1.0f);
	        gl2.glTranslatef(leg.pan_joint.left.x*-1.0f,
	                     leg.pan_joint.left.y*-1.0f,
	                     leg.pan_joint.left.z*-1.0f);
	        m.put( 0,-leg.pan_joint.left.x);
	        m.put( 1,-leg.pan_joint.left.y);
	        m.put( 2,-leg.pan_joint.left.z); 
	        m.put( 4,leg.pan_joint.up.x);
	        m.put( 5,leg.pan_joint.up.y);
	        m.put( 6,leg.pan_joint.up.z);
	        m.put( 8,leg.pan_joint.forward.x); 
	        m.put( 9,leg.pan_joint.forward.y);
	        m.put(10,leg.pan_joint.forward.z);
	      } else {
	        gl2.glTranslatef(leg.pan_joint.forward.x*1.3f,
	                     leg.pan_joint.forward.y*1.3f,
	                     leg.pan_joint.forward.z*1.3f);
	        gl2.glTranslatef(leg.pan_joint.left.x*1.1f,
	                     leg.pan_joint.left.y*1.1f,
	                     leg.pan_joint.left.z*1.1f);
	        
	        m.put( 0,leg.pan_joint.left.x);
	        m.put( 1,leg.pan_joint.left.y);
	        m.put( 2,leg.pan_joint.left.z); 
	        m.put( 4,leg.pan_joint.up.x);
	        m.put( 5,leg.pan_joint.up.y);
	        m.put( 6,leg.pan_joint.up.z);
	        m.put( 8,-leg.pan_joint.forward.x); 
	        m.put( 9,-leg.pan_joint.forward.y);
	        m.put(10,-leg.pan_joint.forward.z);
	      }
	      m.put( 3,0);
	      m.put( 7,0);
	      m.put(11,0);
	      m.put(12,0);
	      m.put(13,0);
	      m.put(14,0);
	      m.put(15,1);
	      gl2.glMultMatrixf(m);

	      if(i<3) model_shoulder_left.Draw(gl2);
	      else    model_shoulder_right.Draw(gl2);
	      gl2.glPopMatrix();

	      // thigh
	      gl2.glPushMatrix();
	      gl2.glColor3f(1,0,0);
	      gl2.glTranslatef(leg.tilt_joint.pos.x,
		                   leg.tilt_joint.pos.y,
		                   leg.tilt_joint.pos.z);
	      gl2.glTranslatef(leg.pan_joint.left.x*2.0f,
		                   leg.pan_joint.left.y*2.0f,
		                   leg.pan_joint.left.z*2.0f);
	      gl2.glTranslatef(leg.pan_joint.forward.x*1.0f,
		                   leg.pan_joint.forward.y*1.0f,
		                   leg.pan_joint.forward.z*1.0f);
	      gl2.glTranslatef(leg.pan_joint.up.x*0.5f,
		                   leg.pan_joint.up.y*0.5f,
		                   leg.pan_joint.up.z*0.5f);

	      m.put( 0,leg.tilt_joint.up.x);
	      m.put( 1,leg.tilt_joint.up.y);
	      m.put( 2,leg.tilt_joint.up.z);
	      m.put( 4,leg.tilt_joint.left.x);
	      m.put( 5,leg.tilt_joint.left.y);
	      m.put( 6,leg.tilt_joint.left.z); 
	      m.put( 8,-leg.tilt_joint.forward.x); 
	      m.put( 9,-leg.tilt_joint.forward.y);
	      m.put(10,-leg.tilt_joint.forward.z);
	      m.put( 3,0);
	      m.put( 7,0);
	      m.put(11,0);
	      m.put(12,0);
	      m.put(13,0);
	      m.put(14,0);
	      m.put(15,1);
	        
	      gl2.glMultMatrixf(m);

	      model_thigh.Draw(gl2);
	      gl2.glPopMatrix();
	      
	      gl2.glPushMatrix();
	      gl2.glColor3f(1,0,0);
	      gl2.glTranslatef(leg.tilt_joint.pos.x,
		                   leg.tilt_joint.pos.y,
		                   leg.tilt_joint.pos.z);
	      gl2.glTranslatef(leg.tilt_joint.left.x*-2.0f,
		                   leg.tilt_joint.left.y*-2.0f,
		                   leg.tilt_joint.left.z*-2.0f);
	      gl2.glTranslatef(leg.tilt_joint.forward.x*0.8f,
		                   leg.tilt_joint.forward.y*0.8f,
		                   leg.tilt_joint.forward.z*0.8f);
	      gl2.glTranslatef(leg.tilt_joint.up.x*0.5f,
		                   leg.tilt_joint.up.y*0.5f,
		                   leg.tilt_joint.up.z*0.5f);

	      m.put( 0,leg.tilt_joint.up.x);
	      m.put( 1,leg.tilt_joint.up.y);
	      m.put( 2,leg.tilt_joint.up.z);
	      m.put( 4,-leg.tilt_joint.left.x);
	      m.put( 5,-leg.tilt_joint.left.y);
	      m.put( 6,-leg.tilt_joint.left.z); 
	      m.put( 8,-leg.tilt_joint.forward.x); 
	      m.put( 9,-leg.tilt_joint.forward.y);
	      m.put(10,-leg.tilt_joint.forward.z);
	      m.put( 3,0);
	      m.put( 7,0);
	      m.put(11,0);
	      m.put(12,0);
	      m.put(13,0);
	      m.put(14,0);
	      m.put(15,1);
		    
	      gl2.glMultMatrixf(m);

	      model_thigh.Draw(gl2);
	      gl2.glPopMatrix();

	      // shin
	      gl2.glPushMatrix();
	      gl2.glColor3f(0,0,1);
	      gl2.glTranslatef(leg.knee_joint.pos.x,
	                   leg.knee_joint.pos.y,
	                   leg.knee_joint.pos.z);

	      if(i<3) {
	        gl2.glTranslatef(leg.knee_joint.forward.x*-0.75f,
	                     	 leg.knee_joint.forward.y*-0.75f,
	                     	 leg.knee_joint.forward.z*-0.75f);
	        m.put( 0,-leg.knee_joint.forward.x);
	        m.put( 1,-leg.knee_joint.forward.y);
	        m.put( 2,-leg.knee_joint.forward.z);  
	        m.put( 4,leg.knee_joint.left.x);
	        m.put( 5,leg.knee_joint.left.y);
	        m.put( 6,leg.knee_joint.left.z);
	        m.put( 8,leg.knee_joint.up.x); 
	        m.put( 9,leg.knee_joint.up.y);
	        m.put(10,leg.knee_joint.up.z);
	      } else {
	        gl2.glTranslatef(leg.knee_joint.up.x*2.0f,
	                     	 leg.knee_joint.up.y*2.0f,
	                     	 leg.knee_joint.up.z*2.0f);
	        gl2.glTranslatef(leg.knee_joint.forward.x*-0.75f,
	                     	 leg.knee_joint.forward.y*-0.75f,
	                     	 leg.knee_joint.forward.z*-0.75f);
	        m.put( 0,-leg.knee_joint.forward.x);
	        m.put( 1,-leg.knee_joint.forward.y);
	        m.put( 2,-leg.knee_joint.forward.z);  
	        m.put( 4,-leg.knee_joint.left.x);
	        m.put( 5,-leg.knee_joint.left.y);
	        m.put( 6,-leg.knee_joint.left.z);
	        m.put( 8,-leg.knee_joint.up.x); 
	        m.put( 9,-leg.knee_joint.up.y);
	        m.put(10,-leg.knee_joint.up.z);
	      }
	      m.put( 3,0);
	      m.put( 7,0);
	      m.put(11,0);
	      m.put(12,0);
	      m.put(13,0);
	      m.put(14,0);
	      m.put(15,1);
		    
	      gl2.glMultMatrixf(m);
	      if(i<3) model_shin_left.Draw(gl2);
	      else    model_shin_right.Draw(gl2);
	      gl2.glPopMatrix();
	    }
	  }
	}