/* * Draw the stool * Stool's base height is 0 (on the floor) * Dimensions: * Seat diameter: 11 3/4 " * Width: 14 5/8 " * Depth: 19 5/8 " * Min. seat height: 24 3/4 " * Max. seat height: 29 1/8 " */ void Stool::draw(MatrixStack &mViewStack) { mViewStack.push(); // position stool with feet on the floor mViewStack.active = glm::translate(mViewStack.active, glm::vec3(0.0f, STOOL_HEIGHT, 0.0f)); // seat and stem rendering mViewStack.push(); // used in height adjustment controls mViewStack.active = glm::translate(mViewStack.active, glm::vec3(0.0f, heightAdjust, 0.0f)); drawSeatAndStem(mViewStack); mViewStack.pop(); // leg rendering drawLeg(mViewStack, 0); drawLeg(mViewStack, 90); drawLeg(mViewStack, 180); drawLeg(mViewStack, 270); // draw lower ring drawRing(mViewStack); // draw upper disks drawDisk(mViewStack, TOP_DISK_RAD, 23.75f); drawDisk(mViewStack, BOT_DISK_RAD, 21.25f); mViewStack.pop(); }
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 chair::init(){ Texture=image_tex->loadBMP_custom("./textures/top.bmp"); Texture2=image_tex->loadBMP_custom("./textures/Chairtop.bmp"); support->setTexture(Texture2); drawLegSupport(); drawSupport(); drawLeg(); drawTop(); }
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 drawLegz() { //draw left legs mvstack.push(model_view); drawLeg(0); model_view *= Translate(-.5, 0, 0); drawLeg(0); model_view *= Translate(1, 0, 0); drawLeg(0); model_view = mvstack.pop(); //draw right legs mvstack.push(model_view); drawLeg(1); model_view *= Translate(-.5, 0, 0); drawLeg(1); model_view *= Translate(1, 0, 0); drawLeg(1); model_view = mvstack.pop(); }
void Table::drawTable() { glPushMatrix(); glColor3f(1.0, 1.0, 1.0); Image* image = loadBMP("res/wood.bmp"); GLuint _textureId = Texture::loadTexture(image); delete image; glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, _textureId); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBegin(GL_QUADS); glDisable(GL_COLOR_MATERIAL); GLfloat param[4] = { 0.992157, 0.941176, 0.807843, 1.0 }; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, param); glMaterialf(GL_FRONT, GL_SHININESS, 0); //Front glNormal3f(0.0f, 0.0f, 1.0f); glTexCoord2f(0.0f, -0.2f); glVertex3f(-6.0f, -0.5f, 9.0f); glTexCoord2f(1.0f, -0.2f); glVertex3f(6.0f, -0.5f, 9.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(6.0f, 0.0f, 9.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-6.0f, 0.0f, 9.0f); //Right glNormal3f(1.0f, 0.0f, 0.0f); glTexCoord2f(1.2f, 1.0f); glVertex3f(6.0f, -0.5f, -9.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(6.0f, 0.0f, -9.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(6.0f, 0.0f, 9.0f); glTexCoord2f(1.2f, 0.0f); glVertex3f(6.0f, -0.5f, 9.0f); //Back glNormal3f(0.0f, 0.0f, -1.0f); glTexCoord2f(0.0f, 1.2f); glVertex3f(-6.0f, -0.5f, -9.0f); glTexCoord2f(1.0f, 1.2f); glVertex3f(6.0f, -0.5f, -9.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(6.0f, 0.0f, -9.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-6.0f, 0.0f, -9.0f); //Left glNormal3f(-1.0f, 0.0f, 0.0f); glTexCoord2f(2.2f, 2.2f); glVertex3f(-6.0f, -0.5f, -9.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-6.0f, 0.0f, -9.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(-6.0f, 0.0f, 9.0f); glTexCoord2f(0.0f, 2.2f); glVertex3f(-6.0f, -0.5f, 9.0f); //Top glNormal3f(0.0f, 1.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(6.0f, 0.0f, 9.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-6.0f, 0.0f, 9.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-6.0f, 0.0f, -9.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(6.0f, 0.0f, -9.0f); //Bottom glNormal3f(0.0f, -1.0f, 0.0f); glTexCoord2f(1.2f, 0.0f); glVertex3f(6.0f, -0.5f, 9.0f); glTexCoord2f(2.2f, 0.0f); glVertex3f(-6.0f, -0.5f, 9.0f); glTexCoord2f(2.2f, 1.0f); glVertex3f(-6.0f, -0.5f, -9.0f); glTexCoord2f(1.2f, 1.0f); glVertex3f(6.0f, -0.5f, -9.0f); param[0] = 0; param[1] = 0; param[2] = 0; param[3] = 0; glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, param); glEnable(GL_COLOR_MATERIAL); glEnd(); glDisable(GL_TEXTURE_2D); glPopMatrix(); //front right leg drawLeg(3.0f, 7.0f); //front left leg drawLeg(-4.0f, 7.0f); //back right leg drawLeg(3.0f, -6.0f); //back left leg drawLeg(-4.0f, -6.0f); }
void drawBee(void) { //Draw head mvstack.push(model_view); //glPushMatrix(); set_colour(0,0,1); model_view *= Scale(0.5f, 0.5f, 0.5f); //glScalef(0.5,0.5,0.5); model_view *= Translate(-3.0f, 0.0f, 0.0f); //glTranslatef(-3,0,0); drawSphere(); model_view = mvstack.pop(); //glPopMatrix(); //Draw body mvstack.push(model_view); //glPushMatrix(); set_colour(0,0,0); model_view *= Scale(2.0f, 1.0f, 1.0f); //glScalef(2,1,1); drawCube(); model_view = mvstack.pop(); //glPopMatrix(); //Draw left wing mvstack.push(model_view); //glPushMatrix(); set_colour(0.25,0.25,0.25); model_view *= Translate(0.0f, 0.5f, 0.5f); //glTranslatef(0,0.5,0.5); model_view *= RotateX(-pathWings); //glRotatef(-pathWings,1,0,0); model_view *= Translate(0.0f, 0.0f, 1.25f); //glTranslatef(0,0,1.25); model_view *= Scale(1.0f, 0.125f, 2.5f); //glScalef(1,0.125,2.5); drawCube(); model_view = mvstack.pop(); //glPopMatrix(); //Draw right wing mvstack.push(model_view); //glPushMatrix(); set_colour(0.25,0.25,0.25); model_view *= Translate(0.0f, 0.5f, -0.5f); //glTranslatef(0,0.5,-0.5); model_view *= RotateX(pathWings); //glRotatef(pathWings,1,0,0); model_view *= Translate(0.0f, 0.0f, -1.25f); //glTranslatef(0,0,-1.25); model_view *= Scale(1.0f, 0.125f, 2.5f); //glScalef(1,0.125,2.5); drawCube(); model_view = mvstack.pop(); //glPopMatrix(); //Draw legs mvstack.push(model_view); //glPushMatrix(); model_view *= Translate(-1.0f, -0.65f, -0.85f); //glTranslatef(-1,-0.65,-0.85); for(int legs = 0; legs < 3; legs++) { model_view *= Translate(0.5f, 0.0f, 0.0f); //glTranslatef(0.5,0,0); drawLeg(); } model_view *= RotateY(180); //glRotatef(180,0,1,0); model_view *= Translate(-0.5f, 0.0f, -1.7f); //glTranslatef(-0.5,0,-1.7); for(int legs = 0; legs < 3; legs++) { model_view *= Translate(0.5f, 0.0f, 0.0f); //glTranslatef(0.5,0,0); drawLeg(); } model_view = mvstack.pop(); //glPopMatrix(); //Draw butt mvstack.push(model_view); //glPushMatrix(); set_colour(1,1,0); model_view *= Translate(2.5f, 0.0f, 0.0f); //glTranslatef(2.5,0,0); model_view *= Scale(1.5f, 0.75f, 0.75f); //glScalef(1.5,0.75,0.75); drawSphere(); model_view = mvstack.pop(); //glPopMatrix(); }
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(); }