void character (void) { glPushMatrix(); glDisable(GL_LIGHTING); glTranslatef(0, -4.5, -14); glPushMatrix(); // Body glColor3f(1.0, 0.7, 0.3); GLUquadricObj *quadratic; quadratic=gluNewQuadric(); gluSphere(quadratic,2.5f,32,32); glPopMatrix(); glTranslatef(0, +3.5, 0); glColor3f(1.0, 0.6, 0.0); gluSphere(quadratic,1.0f,32,32); glPushMatrix(); // Arm 1 drawArm(quadratic); glPopMatrix(); glPushMatrix(); // Arm 2 glRotatef(180, 0.0, 1.0, 0.0); drawArm(quadratic); glPopMatrix(); glEnable(GL_LIGHTING); glPopMatrix(); }
void drawRobot() { glPushMatrix(); glTranslatef (0, 0, -BodyH/2); drawBody(); glPopMatrix(); //Head glPushMatrix(); glTranslatef (0, 0, BodyH/2); glRotatef (HeadAngle, 0.0, 0.0, 1.0); drawHead(); glPopMatrix(); //Arms glPushMatrix(); glRotatef (ArmVertAngle, 1.0, 0.0, 0.0); glRotatef (ArmLatAngle, 0.0, 1.0, 0.0); drawArm(); glPopMatrix(); glPushMatrix(); glRotatef (-ArmVertAngle, 1.0, 0.0, 0.0); glRotatef (ArmLatAngle, 0.0, 1.0, 0.0); drawArm(); glPopMatrix(); //Legs glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle+90, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle+180, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); glPushMatrix(); glTranslatef (0, 0, -BodyH/2); glRotatef (LegRotAngle+270, 0.0, 0.0, 1.0); glRotatef (-LegVertAngle, 1.0, 0.0, 0.0); drawLeg(); glPopMatrix(); }
void Person::drawPerson() { /* Draw torso Draw head Draw right arm Draw left arm Draw right leg Draw left leg*/ ////////////////////////////////////////////////////// glPushMatrix();//(0,0) glPushMatrix(); glTranslatef(-75,0,0);//Move to center of torso bottom: -3", 0" drawTorso(); glPopMatrix(); glPushMatrix(); glTranslatef(0, 300, 0);//Move to top of torso, 0", 30" glPushMatrix(); glTranslatef(0, 60, 0);//move to center of head: 0", 36" drawHead(); glPopMatrix(); glPopMatrix(); glPushMatrix(); //Right arm glTranslatef(150,10,0); glRotatef(20,0,0,1); drawArm(); glPopMatrix(); glPushMatrix(); //left arm glScalef(-1,1,0); glTranslatef(150,10,0); glRotatef(20,0,0,1); drawArm(); glPopMatrix(); glPushMatrix(); //Draw Right leg glTranslatef(15, 0, 0); glTranslatef(0, -300, 0); drawLeg(); glPopMatrix(); glPushMatrix(); //Draw left leg glScalef(-1,1,0); glTranslatef(15, 0, 0); glTranslatef(0, -300, 0); drawLeg(); glPopMatrix(); glPopMatrix(); }//end drawPerson
//-------------------------------------------------------------- void LeapVisualizer::drawHand (Hand & hand,ofxLeapMotion & leap){ if (hand.isValid()){ drawFingers (hand,leap); drawPalm (hand,leap); drawArm (hand,leap); } }
void renderModels() { drawAxes(); drawXYGrid(10); V = computeVfromM(); // TRACE("M = " << M); // TRACE("V = " << V); // testComputation(); glEnable(GL_LIGHTING); drawCabin(); drawJoint(O); drawArm(O, V); drawJoint(V); drawArm(V, M); drawJoint(M); glDisable(GL_LIGHTING); }
void ArmGLWidget::drawArm() { if (this->armConfiguration == 'w') { drawArm(wristAngles); } else if (this->armConfiguration == 'a') { drawArm (astroAngles); } else if (this->armConfiguration == 's') { drawArm(shovelAngles); } else { // Something interesting... for (int i = 0; i < 25; i++) { this->drawRandomTube(50); } } }
void drawEntireBody(){ // Draw our hinged object // Push the current transformation matrix on the stack glPushMatrix(); glPushMatrix(); { glTranslatef(bodyPositionX, 0.0, 0.0); // Scale to size of body glScalef(BODY_WIDTH, BODY_LENGTH, 1.0); // Set the colour to green glColor3f(0.0, 1.0, 0.0); // Draw the body Point bodyPoints[] = { // top left, right points {-NECK_WIDTH/2, 0.5f}, {NECK_WIDTH/2, 0.5f}, // middle right point {BELLY_WIDTH/2, -0.4f}, // bottom right point {BOTTOM_WIDTH/2, -0.7f}, // bottom left point {-BOTTOM_WIDTH/2, -0.7f}, // middle left point {-BELLY_WIDTH/2, -0.4f}}; drawPolygon(6, bodyPoints); drawArm(); drawLeg(1.0, leg1Rotation, foot1Rotation); drawLeg(-1.0, leg2Rotation, foot2Rotation); drawHead(); } glPopMatrix(); // Retrieve the previous state of the transformation stack glPopMatrix(); }
void ofxIndustrialRobotVisualizer::drawArm4(){ ofSetColor(0, 0, 255); drawArm(4, 250, 250); }
void ofxIndustrialRobotVisualizer::drawArm3(){ ofSetColor(0, 255, 255); drawArm(3, 200, 200); }
void ofxIndustrialRobotVisualizer::drawArm2(){ ofSetColor(0, 255, 0); drawArm(2, 300, 300); }
void ofxIndustrialRobotVisualizer::drawArm1(){ ofSetColor(255, 255, 0); drawArm(1, 300, 300); }
void ofxIndustrialRobotVisualizer::drawArm0(){ ofSetColor(255, 0, 0); drawArm(0, 400, 400); }
/*** シミュレーションループ ***/ void simLoop(int pause) { Pcontrol(); // P制御 dWorldStep(world, 0.01); // 動力学計算 drawArm(); // ロボットの描画 }
void ArmGLWidget::paintGL() { // Render the scene (drawing code goes here!) glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); int width = this->width(); int height= this->height(); float h = height/2; float w = width/2; if (h==0) h = 1; // Whole Screen (cross lines) glViewport (0, 0, width, height); glMatrixMode (GL_PROJECTION); glLoadIdentity (); glOrtho (-1, 1, -1, 1, -1, 1); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); glBegin(GL_LINES); glVertex2f (-1, 0); glVertex2f (1, 0); glVertex2f (0, -1); glVertex2f (0, 1); glEnd(); // 3D View glViewport (w, h, w, h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluPerspective (60, (((float)w)/h), 1, 3000); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); glTranslatef(translate[0], translate[1], translate[2]); //glRotatef (tip, 1, 0, 0); //glRotatef (turn, 0, 1, 0); //glPushMatrix(); //glTranslatef (distances.x, distances.y, distances.z); //drawBox(.5, 2, .5); //drawBox(.5, .5, 2); //drawBox(2, .5, .5); //glPopMatrix(); drawArm(); // Width for orthographic viewport float scale = 75; // Top View glViewport (0, h, w, h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); //gluPerspective (60, (((float)w)/h), 1, 3000); glOrtho(-scale * (((float)w)/h), scale * (((float)w)/h), -scale, scale, -1000, 1000); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); glTranslatef(-50, 0, -200); glRotatef(90, 1, 0, 0); drawArm(); // Side View glViewport (0, 0, w, h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); //gluPerspective (60, (((float)w)/h), 1, 3000); glOrtho(-scale * (((float)w)/h), scale * (((float)w)/h), -scale, scale, -1000, 1000); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); glTranslatef(-50, 0, -200); drawArm(); // Front View glViewport (w, 0, w, h); glMatrixMode (GL_PROJECTION); glLoadIdentity (); //gluPerspective (60, (((float)w)/h), 1, 3000); glOrtho(-scale * (((float)w)/h), scale * (((float)w)/h), -scale, scale, -1000, 1000); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); glTranslatef(0, 0, -200); glRotatef(-90, 0, 1, 0); drawArm(); }
void Robot::draw() const { // Retrieve the current (interpolated) pose of the robot. Pose pose = getPose(); // You can set the robot to be whatever color you like. // By default it is white. glPushMatrix(); glMatrixMode(GL_MODELVIEW); //BODY glColor4d(1, 1, 1, 1); glTranslatef(pose.x_, pose.y_,pose.z_); glRotatef(pose.angles_[BODY_ANGLE], 0, 0, 1); drawCuboid(BODY_X,BODY_LEN,BODY_Z); //HEAD glPushMatrix(); glTranslatef(0,BODY_LEN/2,0); glRotatef(pose.angles_[HEAD_ANGLE], 0, 0, 1); glTranslatef(0,.3,0); drawCuboid(.6,.6,.6); glPopMatrix(); // ARMS!! //Right glPushMatrix(); glTranslatef(0, BODY_LEN/2.0, BODY_Z/2.0 + UARM_WIDTH/2.0); //Move to shoulder joint from center of body drawArm(pose, RIGHT_SHOULDER, RIGHT_ELBOW); glPopMatrix(); //Left glPushMatrix(); glTranslatef(0, BODY_LEN/2.0, - (BODY_Z/2.0 + UARM_WIDTH/2.0)); //Move to shoulder joint from center of body drawArm(pose, LEFT_SHOULDER, LEFT_ELBOW); glPopMatrix(); //LEGS //RIGHT glPushMatrix(); glTranslatef(0, -1, .25); drawLeg(pose, RIGHT_HIP, RIGHT_KNEE, RIGHT_ANKLE); glPopMatrix(); //LEFT glPushMatrix(); glTranslatef(0, -1, -.25); drawLeg(pose, LEFT_HIP, LEFT_KNEE, LEFT_ANKLE); glPopMatrix(); //WINGS //RIGHT glPushMatrix(); glTranslatef(-BODY_X/2.0,BODY_LEN/2.0 -.2,BODY_Z/2.0 - .2); drawWing(pose, RIGHT_WING_MID_Y, RIGHT_WING_Y, RIGHT_WING_Z); glPopMatrix(); //LEFT glPushMatrix(); glTranslatef(-BODY_X/2.0,BODY_LEN/2.0 -.2, -BODY_Z/2.0 + .2); drawWing(pose, LEFT_WING_MID_Y, LEFT_WING_Y, LEFT_WING_Z); glPopMatrix(); //Body matrix glPopMatrix(); }