// Right hand effector's draw function. void RightVirtualHand::draw() { // Always start with glPushMatrix to avoid matrix multiplications done here from // affecting other portions of the scene. glPushMatrix(); // Set to center of effector. glMultMatrixf(getCenterMatrix().v); // Scale to make 1 ft. cube into a 0.5 ft. cube to match interaction distance. // glScalef(0.5, 0.5, 0.5); // Draw the right hand red. // glColor3f(1.0, 0.0, 0.0); // Create the 1 ft. cube. // glutSolidCube(1.0); // Superimpose slightly larger black wireframe cube to make it easier to see shape. // glColor3f(0.0, 0.0, 0.0); // glutWireCube(1.01); glRotatef(180,0,1,0); glRotatef(90,0,0,1); glScalef(-1,1,1); loadedOBJ.draw(); // Always finish with glPopMatrix to match glPushMatrix above. glPopMatrix(); }
// Left hand effector's draw function. void LeftVirtualHand::draw() //const { // Always start with glPushMatrix to avoid matrix multiplications done here from // affecting other portions of the scene. glPushMatrix(); // Set to center of effector. glMultMatrixf(getCenterMatrix().v); // Scale to make 1 ft. cube into a 2" x 2" rod with current length in ft. glScalef(2.0/12.0, 2.0/12.0, _currentLength); // Draw the left hand red. glColor3f(1.0, 0.0, 0.0); // Create the 1 ft. cube. if(!handy) { glutSolidCube(1.0); } else { loadedOBJ.draw(); } // Superimpose slightly larger black wireframe cube to make it easier to see shape. if(coneselection == true) { glScalef(12.0/2.0, 12.0/2.0, 1/_currentLength); glColor3f(1.0, 1.0, 0.0); //GLdouble base=min(1*_currentLength,10.0f); GLdouble base=_currentLength/2.0; GLdouble height=1*_currentLength; GLint slices =50; GLint stacks =50; glTranslatef(0.0,0.0,-height/2.0f); glutSolidCone(base,height,slices,stacks); glTranslatef(0.0,0.0,height/2.0f); glScalef(2.0/12.0, 2.0/12.0, _currentLength); } glColor3f(0.0, 0.0, 0.0); //TODO fix the bug that the color is left as red here and draws a red square if (!handy) { glColor3f(0.0, 0.0, 0.0); glutWireCube(1.01); } // Always finish with glPopMatrix to match glPushMatrix above. glPopMatrix(); }