void Car::draw() { glMatrixMode(GL_MODELVIEW); glPushMatrix(); glColor3f(1,1,1);//blanco glutSolidCube(chassisSize); glPopMatrix(); for (int i=0; i<4; i++){ GLdouble posX,posZ, rim; switch (i){ case 0: posX = -0.3 * carSize; posZ = 0.3 * carSize; rim = posZ + 0.1 * wheelWith; break; case 1: posX = 0.3 * carSize; posZ = 0.3 * carSize; rim = posZ + 0.1 * wheelWith; break; case 2: posX = -0.3 * carSize; posZ = -0.3 * carSize - wheelWith; rim = posZ - 0.1 * wheelWith; break; case 3: posX = 0.3 * carSize; posZ = -0.3 * carSize - wheelWith; rim = posZ - 0.1 * wheelWith; break; } //Tires glPushMatrix(); glColor3f(0,0,0);//negro glRotated(90,0,1,0); // Tuerce las ruedas para que no vaya de lado glTranslated(posX,-0.3*carSize,posZ);//-radioRueda,0,0.1*x); glRotated(wheelPosition,0,0,1); glutSolidCylinder(wheelRatius, wheelWith, nWheelFaces,1); glPopMatrix(); //Rims glPushMatrix(); glColor3f(1,1,1);//blanco glRotated(90,0,1,0); // Tuerce las ruedas para que no vaya de lado glTranslated(posX,-0.3*carSize,rim);//-radioRueda,0,0.1*x); glRotated(wheelPosition,0,0,1); glutSolidCylinder(wheelRatius*0.9, wheelWith*1.1, 3,1); glPopMatrix(); } glPopMatrix(); }
//Desenha a mesa void drawTable() { //Desenha a tᢵa da mesa glPushMatrix(); rotaciona(); glColor3f(0.5f, 0.35f, 0.05f); glTranslatef(75.0f, -16.0f, 75.0f); glScalef(100.0f,2.0f,100.0f); glutSolidCube(1); glPopMatrix(); //Desenha as pernas da mesa glPushMatrix(); rotaciona(); glColor3f(0.5f, 0.35f, 0.05f); glTranslatef(30.0f,-87.0f,30.0f); glScalef(1.0f,1.0f,1.0f); glRotatef(-90.0f,1.0f,0.0f,0.0f); glutSolidCylinder(5.0f,70.0f,20.0f,10.0f); glPopMatrix(); glPushMatrix(); rotaciona(); glColor3f(0.5f, 0.35f, 0.05f); glTranslatef(120.0f,-87.0f,30.0f); glScalef(1.0f,1.0f,1.0f); glRotatef(-90.0f,1.0f,0.0f,0.0f); glutSolidCylinder(5.0f,70.0f,20.0f,10.0f); glPopMatrix(); glPushMatrix(); rotaciona(); glColor3f(0.5f, 0.35f, 0.05f); glTranslatef(120.0f,-87.0f,120.0f); glScalef(1.0f,1.0f,1.0f); glRotatef(-90,1.0,0,0); glutSolidCylinder(5.0f,70.0f,20.0f,10.0f); glPopMatrix(); glPushMatrix(); rotaciona(); glColor3f(0.5f, 0.35f, 0.05f); glTranslatef(30.0f,-87.0f,120.0f); glScalef(1.0f,1.0f,1.0f); glRotatef(-90.0f,1.0f,0.0f,0.0f); glutSolidCylinder(5.0f,70.0f,20.0f,10.0f); glPopMatrix(); }
void Tree::FractalTree(int branch, int depth, int x, int y, int z) { if(depth < MaxDepth) { glColor3f(0.4, 0.2, 0); glRotatef(data[branch][depth][0], data[branch][depth][1], data[branch][depth][2], 0); glTranslatef(x, y, z - height); glutSolidCylinder(0.05, height, 5, 2); glPushMatrix(); glRotatef(rand() / (float)RAND_MAX * 10, 0, rand() / (float)RAND_MAX, 0); for(int i = 0; i < MaxLeaf; i++) { glPushMatrix(); glColor3f(0, rand()/(float)RAND_MAX * 0.5 + 0.5, 0); float pos = leafData[branch][depth][i][0]; glTranslatef(leafData[branch][depth][i][1], leafData[branch][depth][i][2], -pos); glutSolidSphere(LeafWidth, 3, 2); glPopMatrix(); } glPopMatrix(); FractalTree(branch, depth + 1, x, y, z); } }
void draw_piston(void) { glPushMatrix(); glRotatef(-90.0f, 1.0f, 0.0f, 0.0f); glutSolidCylinder(0.2f, 7.0f, 100, 100); glPopMatrix(); glPushMatrix(); glRotatef(90, 0.0, 1.0f, 0.0f); glutSolidCylinder(0.2f, 1.0f, 100, 100); glPopMatrix(); glPushMatrix(); glRotatef(90, 0.0f, 1.0f, 0.0f); glTranslatef(0.0f, 0.0f, -0.3f); glutSolidCylinder(0.3f, 0.5f, 100, 100); glPopMatrix(); }
int DrawCylinder(Vec3d v,pdColor c,double r,double len,double theta,double phi){ glPushMatrix(); glColor4d(c.r,c.g,c.b,c.a); GLfloat material[] = {(float)c.r,(float)c.g,(float)c.b,(float)c.a}; glMaterialfv(GL_FRONT_AND_BACK , GL_AMBIENT_AND_DIFFUSE , material); glTranslated(v.x,v.y,v.z); glutSolidCylinder(r,len,100,100); glPopMatrix(); return 0; }
void DrawCylinder(float radius,float height,Vector3 center,Vector3 axis) { Vector3 pos=Vector3(0,0,height/2); float theta=Vector3::anglebetweeninradian(axis,Vector3(0,0,1)); pos.Rotate(Vector3(0,0,0),Vector3(axis.Y(),axis.X(),0),theta); center-=pos; glPushMatrix(); glTranslatef(center.X(),center.Y(),center.Z()); glRotatef(theta/PIdiv180,axis.Y(),axis.X(),0); glutSolidCylinder(radius,height,50,50); glPopMatrix(); }
void GlCheckerPiece::Draw() { glUseProgram(0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glColor3fv(&mColor[0]); auto Model = glm::translate(glm::mat4(1.0f), mPosition); mMvp = *mSystem * Model; glMultMatrixf(&mMvp[0][0]); glutSolidCylinder(mRadius, mHeight, mSlices, mStacks); }
static void pillar(double x, double y, double z) { /* Draw first pillar by Translating */ int heighest = 1; if(x > y) { heighest = y; } else if(y > x){ heighest = x; } else if (x == y) { heighest = x; } glPushMatrix() ; glScalef(y,x,1); glutSolidCylinder(0.125/heighest,1,20,20); glPopMatrix(); }
void Tree::Render() { glColor3f(0.4, 0.2, 0); glRotatef(90, 1, 0, 0); glTranslatef(0, 0, -height); glutSolidCylinder(0.05, height, 5, 2); for(int i = 0; i < MaxBranch; i++) { glPushMatrix(); FractalTree(i, 0, 0, height, 0); glPopMatrix(); } glEnd(); }
void drawArm(Point p1, Point p2) { glColor3f(1.f, 0.5, 0.25); float vX = p2.x - p1.x, vY = p2.y - p1.y, vZ = p2.z - p1.z, flatNorm = static_cast<float>(sqrt(vX * vX + vY * vY)), norm = static_cast<float>(sqrt(vX * vX + vY * vY + vZ * vZ)), shift = jointRadius / norm; glPushMatrix(); glTranslatef(p1.x + vX * shift, p1.y + vY * shift, p1.z + vZ * shift); // We use spherical coordinates if (vY >= 0) glRotatef(static_cast<float>(acos(vX / flatNorm) / M_PI) * 180, 0, 0, 1); else glRotatef(-static_cast<float>(acos(vX / flatNorm) / M_PI) * 180, 0, 0, 1); glRotatef(static_cast<float>(acos(vZ / norm) / M_PI) * 180, 0, 1, 0); glutSolidCylinder(armRadius, norm - 2 * jointRadius, 30, 8); glPopMatrix(); }
/* * The main window's display callback renders a small bluish world * with a flagpole, flying an eerily familiar banner. */ void cb_display( void ) { int msec = glutGet( GLUT_ELAPSED_TIME ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glPushMatrix(); glRotated( msec / 50.0, 0, 1, 0 ); glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, plan_diff ); glMateriali( GL_FRONT, GL_SHININESS, 100 ); glMaterialfv( GL_FRONT, GL_SPECULAR, plan_spec ); glutSolidSphere( 3, 20, 20 ); glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, pole_diff ); glMaterialfv( GL_FRONT, GL_SPECULAR, pole_spec ); glutSolidCylinder( .1, FLAG_HEIGHT, 6, 3 ); glTranslated( 0, 0, FLAG_HEIGHT ); write_string( "Hello\nWorld!" ); glPopMatrix(); glPushMatrix(); std::stringstream ss; ss << msec; write_string("HEY"); glPopMatrix(); glutSwapBuffers( ); glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer); for (int i = 0; i < height/2; i++) { for (int j = 0; j < width; j++) { int top = (i*width + j) * 3; int bottom = ((height-i-1)*width + j) * 3; rgbData temp(&buffer[top]); ((rgbData*) &buffer[bottom])->copyTo(&buffer[top]); temp.copyTo(&buffer[bottom]); } } AVPacket* pkt = encoder->encodeRgbData(buffer); fflush(stdout); fwrite(pkt->data, 1, pkt->size, ffmpeg); av_free_packet(pkt); }
void Tree::drawTree(float size) { glPushMatrix(); glRotatef(90, -1, 0 ,0); glColor3f(basecolor.x,basecolor.y,basecolor.z); if (DrawType<=2) glutSolidCylinder(size/15, size, sphereLOD, sphereLOD); else { glPushMatrix(); glScalef(2./15.,2./15.,2); glutSolidCube(size); glPopMatrix(); } glTranslatef(0,0,size); glColor3f(leafcolor.x,leafcolor.y,leafcolor.z); if (DrawType<=2) glutSolidSphere(size/3, sphereLOD, sphereLOD); else glutSolidCube(2*size/3); glPopMatrix(); }
static void RenderCylinder() { #ifdef __PPCGEKKO__ glutSolidCylinder(12); #else glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_NORMAL_ARRAY); glVertexPointer(3, GL_FLOAT, 2*3*sizeof(float), gCylinderData); glNormalPointer(GL_FLOAT, 2*3*sizeof(float), gCylinderData+3); glDrawArrays(GL_TRIANGLE_STRIP, 0, 13*2); glVertexPointer(3, GL_FLOAT, 2*3*sizeof(float), gCylinderDataCapsTop); glNormalPointer(GL_FLOAT, 2*3*sizeof(float), gCylinderDataCapsTop+3); glDrawArrays(GL_TRIANGLES, 0, 36); glVertexPointer(3, GL_FLOAT, 2*3*sizeof(float), gCylinderDataCapsBottom); glNormalPointer(GL_FLOAT, 2*3*sizeof(float), gCylinderDataCapsBottom+3); glDrawArrays(GL_TRIANGLES, 0, 36); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_NORMAL_ARRAY); #endif }
void RobotArmBottom::renderRobotArmBottom() { glutSolidCylinder(.20,1.0,100,100); }
void Ellipse::draw(){ glPushMatrix(); glScalef(_radiusX, _radiusY, 1e-3); glutSolidCylinder(1.0,1.0,25,25); glPopMatrix(); }
/* * These one-liners draw particular objects, fetching appropriate * information from the above globals. They are just thin wrappers * for the FreeGLUT objects. */ static void drawSolidTetrahedron(void) { glutSolidTetrahedron (); } static void drawWireTetrahedron(void) { glutWireTetrahedron (); } static void drawSolidCube(void) { glutSolidCube(orad); } /* orad doubles as size input */ static void drawWireCube(void) { glutWireCube(orad); } /* orad doubles as size input */ static void drawSolidOctahedron(void) { glutSolidOctahedron (); } static void drawWireOctahedron(void) { glutWireOctahedron (); } static void drawSolidDodecahedron(void) { glutSolidDodecahedron (); } static void drawWireDodecahedron(void) { glutWireDodecahedron (); } static void drawSolidRhombicDodecahedron(void) { glutSolidRhombicDodecahedron (); } static void drawWireRhombicDodecahedron(void) { glutWireRhombicDodecahedron (); } static void drawSolidIcosahedron(void) { glutSolidIcosahedron (); } static void drawWireIcosahedron(void) { glutWireIcosahedron (); } static void drawSolidSierpinskiSponge(void) { glutSolidSierpinskiSponge (depth, offset, orad);} /* orad doubles as size input */ static void drawWireSierpinskiSponge(void) { glutWireSierpinskiSponge (depth, offset, orad); } /* orad doubles as size input */ static void drawSolidTorus(void) { glutSolidTorus(irad,orad,slices,stacks); } static void drawWireTorus(void) { glutWireTorus (irad,orad,slices,stacks); } static void drawSolidSphere(void) { glutSolidSphere(orad,slices,stacks); } /* orad doubles as size input */ static void drawWireSphere(void) { glutWireSphere(orad,slices,stacks); } /* orad doubles as size input */ static void drawSolidCone(void) { glutSolidCone(orad,orad,slices,stacks); } /* orad doubles as size input */ static void drawWireCone(void) { glutWireCone(orad,orad,slices,stacks); } /* orad doubles as size input */ static void drawSolidCylinder(void) { glutSolidCylinder(orad,orad,slices,stacks); } /* orad doubles as size input */
void DesenhaGuidon(GLfloat espessura,GLfloat tamanhoCilindro){ glColor3f(1.0,1.0,1.0); glutSolidCylinder(espessura,tamanhoCilindro,100.0,1.0); }
/*!***************************************************************************** ******************************************************************************* \note myDrawGLElement \date August 7, 1992 \remarks draws a GL element of a particular length in z direction ******************************************************************************* Function Parameters: [in]=input,[out]=output \param[in] num : ID number of element (just for info) \param[in] length: length of element \param[in] flag : draw joint element (yes, not) ******************************************************************************/ static void myDrawGLElement(int num, double length, int flag) { static int firsttime = TRUE; double width=0.03; double head_width = 0.3; double hand_width = 0.07; double foot_width = 0.1; double torso_width = 0.3; double belly_width = 0.25; double thumb_width = 0.02; double shoulder_width = 0.4; static int pelvis,b_tr,b_taa,b_tfe; static int l_haa, l_hfe, l_hfr, l_kfe, l_ar, l_afe, l_aaa; static int r_haa, r_hfe, r_hfr, r_kfe, r_ar, r_afe, r_aaa; static int b_hn, b_ht, b_hr; static int head,left_eye,right_eye; static int r_sfe, r_saa, r_hr, r_eb, r_wr, r_wfe, r_waa; static int l_sfe, l_saa, l_hr, l_eb, l_wr, l_wfe, l_waa; GLfloat gray[4]={(float)0.8,(float)0.8,(float)0.8,(float)opacity}; GLfloat green[4]={(float)0.1,(float)0.5,(float)0.5,(float)opacity}; GLfloat red[4]={(float)1.0,(float)0.25,(float)0.25,(float)opacity}; GLfloat blue[4]={(float)0.1,(float)0.1,(float)1.0,(float)opacity}; GLfloat black[4]={(float)0.,(float)0.,(float)0.0,(float)opacity}; GLfloat white[4]={(float)1.,(float)1.,(float)1.0,(float)opacity}; GLfloat yellow[4]={(float)1.0,(float)0.8,(float)0.7,(float)opacity}; int isphere = 10; if (solid) glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); else glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); if (firsttime) { firsttime = FALSE; char *lab_root; char fname[300]; lab_root = getenv("LAB_ROOT"); sprintf(fname,"%s/hermesCore/3D/Pelvis.obj",lab_root); pelvis = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/B_TR.obj",lab_root); b_tr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/B_TAA.obj",lab_root); b_taa = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/B_TFE.obj",lab_root); b_tfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_HFE.obj",lab_root); l_hfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_HAA.obj",lab_root); l_haa = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_HFR.obj",lab_root); l_hfr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_KFE.obj",lab_root); l_kfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_AR.obj",lab_root); l_ar = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_AFE.obj",lab_root); l_afe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_AAA.obj",lab_root); l_aaa = displayListFromObjFileFlag(fname,0.0256,FALSE); sprintf(fname,"%s/hermesCore/3D/L_HFE.obj",lab_root); r_hfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_HAA.obj",lab_root); r_haa = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_HFR.obj",lab_root); r_hfr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_KFE.obj",lab_root); r_kfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_AR.obj",lab_root); r_ar = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_AFE.obj",lab_root); r_afe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/R_AAA.obj",lab_root); r_aaa = displayListFromObjFileFlag(fname,0.0256,FALSE); sprintf(fname,"%s/hermesCore/3D/B_HN.obj",lab_root); b_hn = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/B_HT.obj",lab_root); b_ht = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/B_HR.obj",lab_root); b_hr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/humanoidHeadLeftEye.obj",lab_root); left_eye = displayListFromObjFile(fname,0.0256); sprintf(fname,"%s/hermesCore/3D/humanoidHeadRightEye.obj",lab_root); right_eye = displayListFromObjFile(fname,0.0256); sprintf(fname,"%s/hermesCore/3D/humanoidHead.obj",lab_root); head = displayListFromObjFile(fname,0.0256); sprintf(fname,"%s/hermesCore/3D/R_SFE.obj",lab_root); r_sfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/R_SAA.obj",lab_root); r_saa = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/R_HR.obj",lab_root); r_hr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/R_EB.obj",lab_root); r_eb = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/R_WR.obj",lab_root); r_wr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/R_WFE.obj",lab_root); r_wfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/R_WAA.obj",lab_root); l_waa = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_SFE.obj",lab_root); l_sfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_SAA.obj",lab_root); l_saa = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_HR.obj",lab_root); l_hr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_EB.obj",lab_root); l_eb = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_WR.obj",lab_root); l_wr = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_WFE.obj",lab_root); l_wfe = displayListFromObjFileFlag(fname,0.0256,TRUE); sprintf(fname,"%s/hermesCore/3D/L_WAA.obj",lab_root); r_waa = displayListFromObjFileFlag(fname,0.0256,TRUE); } if (flag==1 && num != 35 && num != 37) { glTranslated(0.0,0.0,length); if (num==999) {/* the base coordinate system */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); glColor4fv(blue); } else if (num > 38) { glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); } else { glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); glColor4fv(green); } if (num == B_HN || num == B_HT) { if (solid) glutSolidSphere(0.25*width,isphere,isphere); else glutWireSphere(0.25*width,isphere,isphere); } else { if (solid) glutSolidSphere(0.25*width,isphere,isphere); else glutWireSphere(0.25*width,isphere,isphere); } glTranslated(0.0,0.0,-length); } switch (num) { case BASE: break; case L_SAA: /* L_SFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)135.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(-0.002,-0.005,0.290); glCallList(l_sfe); break; case L_HR: /* L_SAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glRotated((GLdouble)180.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(-0.2,-0.005,0.490); glCallList(l_saa); break; case L_EB: /* L_HR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); //glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(-0.222,-0.005,0.495); glCallList(l_hr); break; case L_WR: /* L_EB */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(-0.223,-0.005,0.240); glCallList(l_eb); break; case L_WFE: /* L_WR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(-0.223,-0.000,0.2150); glCallList(l_wr); break; case L_WAA: /* L_WFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)-90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(-0.22,-0.000,-0.017); glCallList(l_wfe); break; case 108: /* L_WAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.220,-0.020,-0.017); glCallList(l_waa); break; case R_SAA: /* R_SFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)135.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.0,-0.005,0.290); glCallList(r_sfe); break; case R_HR: /* R_SAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.2,-0.005,0.490); glCallList(r_saa); break; case R_EB: /* R_HR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); //glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.222,-0.005,0.490); glCallList(r_hr); break; case R_WR: /* R_EB */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.223,-0.005,0.2350); glCallList(r_eb); break; case R_WFE: /* R_WR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)0.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.223,-0.000,0.2150); glCallList(r_wr); break; case R_WAA: /* R_WFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(0.22,-0.000,-0.017); glCallList(r_wfe); break; case 115: /* R_WAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(-0.220,-0.020,-0.017); glCallList(r_waa); break; break; case B_TR: /* pelvis */ glPushMatrix(); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); //glTranslated(0.0,0.0,0.1); glCallList(pelvis); glPopMatrix(); // draw IMU glTranslated(-IMU_X_OFFSET,IMU_Y_OFFSET,0.0); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); glColor4fv(red); glScaled(0.02,0.01,0.04); if (solid) glutSolidCube(1.0); else glutWireCube(1.0); break; case B_TAA: /* B_TR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); //glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.0,0.0,0.1725); glCallList(b_tr); break; case B_TFE: /* B_TAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(0.0,0.0,0.1725); glCallList(b_taa); break; case B_HN: /* B_TFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(-0.004,-0.005,0.1725); // strange lateral offset .... glCallList(b_tfe); break; case L_HFE: /* L_HAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.09,0.0,0.0); glCallList(l_haa); break; case L_HFR: /* L_HFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); //glRotated((GLdouble)90.,(ppGLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.09,0.0,0.0); glCallList(l_hfe); break; case L_KFE: /* L_HFR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)-8.5,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(0.09,-0.06,-0.01); glCallList(l_hfr); break; case L_AR: /* L_KFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(0.09,0.0,-0.404); glCallList(l_kfe); break; case L_AFE: /* L_AR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(0.09,0.0,-0.404); glCallList(l_ar); break; case L_AAA: /* L_AFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(0.09,0.0,-0.784); glCallList(l_afe); break; case 128: /* L_AAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glScaled(MAG,MAG,1.0); glTranslated(0.08,0.0,-0.78); glCallList(l_aaa); break; case R_HFE: /* R_HAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.095,0.0,0.0); glCallList(r_haa); break; case R_HFR: /* R_HFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); //glRotated((GLdouble)90.,(ppGLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(0.09,0.0,0.0); glCallList(r_hfe); break; case R_KFE: /* R_HFR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)-8.5,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(0.09,-0.06,-0.01); glCallList(r_hfr); break; case R_AR: /* R_KFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(0.09,0.0,-0.404); glCallList(r_kfe); break; case R_AFE: /* R_AR */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(0.09,0.0,-0.404); glCallList(r_ar); break; case R_AAA: /* R_AFE */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glTranslated(0.09,0.0,-0.784); glCallList(r_afe); break; case 135: /* R_AAA */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); //glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glScaled(MAG,MAG,1.0); glTranslated(-.08,0.0,-0.78); glCallList(r_aaa); break; case B_HT: /* B_HN */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)180.,(GLdouble)0.,(GLdouble)1.,(GLdouble)0.); glTranslated(-0.004,-0.006,0.56); glCallList(b_hn); break; case B_HR: /* B_HT */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); //glRotated((GLdouble)-90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)-90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(-0.004,-0.006,0.56); glCallList(b_ht); break; case 138: /* the head */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, white); glColor4fv(white); glRotated((GLdouble)90.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(-0.035,-0.04+.12,-0.065); glCallList(head); break; case 35: /* dummies */ case 37: /* dummies */ break; case 137: /* the right eye */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)180.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(-0.072,-0.0545,0.00); glCallList(right_eye); glTranslated(0.072,0.0545,-.022); glPushMatrix(); glScaled(0.02,0.02,0.001); glColor4fv(black); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, black); if (solid) glutSolidCylinder(1.0,1.0,isphere*2,1); else glutWireCylinder(1.0,1.0,isphere*2,1); glPopMatrix(); glTranslated(0.0,0.0,-0.001); glPushMatrix(); glScaled(0.007,0.007,0.001); glColor4fv(white); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, white); if (solid) glutSolidCylinder(1.0,1.0,isphere*2,1); else glutWireCylinder(1.0,1.0,isphere*2,1); glPopMatrix(); glTranslated(0.0,-0.017,0.0); glPushMatrix(); glScaled(0.006,0.006,0.01); glColor4fv(gray); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); if (solid) glutSolidCylinder(1.0,1.0,isphere*2,1); else glutWireCylinder(1.0,1.0,isphere*2,1); glPopMatrix(); break; case 139: /* the left eye */ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); glColor4fv(gray); glRotated((GLdouble)90.,(GLdouble)0.,(GLdouble)0.,(GLdouble)1.); glRotated((GLdouble)180.,(GLdouble)1.,(GLdouble)0.,(GLdouble)0.); glTranslated(0.00,-0.0545,0.0); glCallList(left_eye); glTranslated(0.0,0.0545,-0.022); glPushMatrix(); glScaled(0.02,0.02,0.001); glColor4fv(black); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, black); if (solid) glutSolidCylinder(1.0,1.0,isphere*2,1); else glutWireCylinder(1.0,1.0,isphere*2,1); glPopMatrix(); glTranslated(0.0,0.0,-0.001); glPushMatrix(); glScaled(0.007,0.007,0.001); glColor4fv(white); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, white); if (solid) glutSolidCylinder(1.0,1.0,isphere*2,1); else glutWireCylinder(1.0,1.0,isphere*2,1); glPopMatrix(); glTranslated(0.0,-0.017,0.0); glPushMatrix(); glScaled(0.006,0.006,0.01); glColor4fv(gray); glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, gray); if (solid) glutSolidCylinder(1.0,1.0,isphere*2,1); else glutWireCylinder(1.0,1.0,isphere*2,1); glPopMatrix(); break; case 129: /* dummies of feet */ case 130: case 131: case 132: case 133: case 134: case 122: case 123: case 124: case 125: case 126: case 127: /* glScaled(width/2.,width/2.,length); glTranslated(0.0,0.0,0.5); glColor4fv(gray); if (solid) glutSolidCube(1.0); else glutWireCube(1.0); */ break; case 152: case 155: case 158: case 161: case 164: case 166: case 169: case 172: case 175: case 178: glPushMatrix(); glTranslated(0.0,0.0,length); if (solid) glutSolidSphere(0.25*width,isphere,isphere); else glutWireSphere(0.25*width,isphere,isphere); glPopMatrix(); default: glScaled(width/4,width/4,length); glColor4fv(gray); if (solid) glutSolidCylinder(1.0,1.0,isphere,1); else glutWireCylinder(1.0,1.0,isphere,1); } }
/* * These one-liners draw particular objects, fetching appropriate * information from the above globals. They are just thin wrappers * for the FreeGLUT objects. */ static void drawSolidTetrahedron(void) { glutSolidTetrahedron (); } static void drawWireTetrahedron(void) { glutWireTetrahedron (); } static void drawSolidCube(void) { glutSolidCube(orad); } /* orad doubles as size input */ static void drawWireCube(void) { glutWireCube(orad); } /* orad doubles as size input */ static void drawSolidOctahedron(void) { glutSolidOctahedron (); } static void drawWireOctahedron(void) { glutWireOctahedron (); } static void drawSolidDodecahedron(void) { glutSolidDodecahedron (); } static void drawWireDodecahedron(void) { glutWireDodecahedron (); } static void drawSolidRhombicDodecahedron(void) { glutSolidRhombicDodecahedron (); } static void drawWireRhombicDodecahedron(void) { glutWireRhombicDodecahedron (); } static void drawSolidIcosahedron(void) { glutSolidIcosahedron (); } static void drawWireIcosahedron(void) { glutWireIcosahedron (); } static void drawSolidSierpinskiSponge(void) { glutSolidSierpinskiSponge (depth, offset, orad);} /* orad doubles as size input */ static void drawWireSierpinskiSponge(void) { glutWireSierpinskiSponge (depth, offset, orad); } /* orad doubles as size input */ static void drawSolidTorus(void) { glutSolidTorus(irad,orad,slices,stacks); } static void drawWireTorus(void) { glutWireTorus (irad,orad,slices,stacks); } static void drawSolidSphere(void) { glutSolidSphere(orad,slices,stacks); } /* orad doubles as size input */ static void drawWireSphere(void) { glutWireSphere(orad,slices,stacks); } /* orad doubles as size input */ static void drawSolidCone(void) { glutSolidCone(irad,orad,slices,stacks); } /* irad doubles as base input, and orad as height input */ static void drawWireCone(void) { glutWireCone(irad,orad,slices,stacks); } /* irad doubles as base input, and orad as height input */ static void drawSolidCylinder(void) { glutSolidCylinder(irad,orad,slices,stacks); } /* irad doubles as radius input, and orad as height input */
void drawBuilding7(int closeUp) { // Keystone Glass part float colMat[] = { 0.47, 1, 1}; //float blueMat[] = { 0.5, 0.5, 0.5}; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); if (closeUp) { glScalef(6,6,6); } else { glTranslatef(1.75,0.15,1); glScalef(0.25,0.25,0.25); glRotatef(-90,0,1,0); } //Draw the Glass glEnable(GL_BLEND); glBlendFunc(GL_ONE_MINUS_DST_ALPHA,GL_DST_ALPHA); glBegin(GL_POLYGON); glNormal3f(0,0,1); glVertex3f(1, 0.5, 0); glVertex3f(1,-0.5, 0); glVertex3f(-1, -0.5, 0); glVertex3f(-1,0.5,0); glEnd(); glBegin(GL_POLYGON); glNormal3f(1,0,0); glVertex3f(1, 0.5, 0); glVertex3f(1, 0.5, -1); glVertex3f(1,-0.5, -1); glVertex3f(1,-0.5, 0); glEnd(); glBegin(GL_POLYGON); glNormal3f(-1,0,-1); glVertex3f(-1, 0.5, 0); glVertex3f(-1, -0.5, 0); glVertex3f(-0.75,-0.5, -0.33); glVertex3f(-0.75, 0.5, -0.33); glEnd(); glDisable(GL_BLEND); //Back Wall and floor, to close up the building colMat[0]=0.5; colMat[1]=0.5; colMat[2]=0.5; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); glBegin(GL_POLYGON); glNormal3f(0,0,-1); glVertex3f(1, 0.5, -1); glVertex3f(1,-0.5, -1); glVertex3f(-0.75, -0.5, -0.33); glVertex3f(-0.75,0.5,-0.33); glEnd(); glBegin(GL_POLYGON); glNormal3f(0,-1,0); glVertex3f(1, -0.5, -1); glVertex3f(1,-0.5, 0); glVertex3f(-1, -0.5, 0); glVertex3f(-0.75, -0.5,-0.33); glEnd(); //Add details to the glass colMat[0]=0.5; colMat[1]=0.5; colMat[2]=1; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); glLineWidth(1.5); glNormal3f(0,0,1); for(int i = 0; i < 5; i++) { glBegin(GL_LINES); glVertex3f(-0.8 + (0.4 * i),0.5,0.01); glVertex3f(-0.8 + (0.4 * i),-0.5,0.01); glEnd(); } for(int i = 0; i < 6; i++) { if(i != 3) { glBegin(GL_LINES); glVertex3f(-1,-0.5 + (0.2 * i),0.01); glVertex3f(1,-0.5 + (0.2 * i),0.01); glEnd(); } else { glBegin(GL_LINES); glVertex3f(0.2,-0.5 + (0.2 * i),0.01); glVertex3f(1,-0.5 + (0.2 * i),0.01); glEnd(); } } colMat[0]=0.8; colMat[1]=0.8; colMat[2]=0.8; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); glLineWidth(5); glBegin(GL_LINES); glVertex3f(-1,0.1,0.01); glVertex3f(0.2,0.1,0.01); glEnd(); for(int i = 0; i < 6; i++) { glBegin(GL_LINES); glVertex3f(-1 + (0.4 * i),0.5,0.01); glVertex3f(-1 + (0.4 * i),-0.5,0.01); glEnd(); } // Second glass pane colMat[0]=0.5; colMat[1]=0.5; colMat[2]=1; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); glLineWidth(1.5); glNormal3f(1,0,0); glBegin(GL_LINES); glVertex3f(1.01,0.5,0); glVertex3f(1.01,-0.5,0); glEnd(); glBegin(GL_LINES); glVertex3f(1.01,0.5,-0.2); glVertex3f(1.01,-0.5,-0.2); glEnd(); glBegin(GL_LINES); glVertex3f(1.01,0.5,-0.6); glVertex3f(1.01,-0.1,-0.6); glEnd(); glBegin(GL_LINES); glVertex3f(1.01,0.5,-0.8); glVertex3f(1.01,-0.1,-0.8); glEnd(); for(int i = 0; i < 6; i++) { if(i < 4) { glBegin(GL_LINES); glVertex3f(1.01,0.5 - (0.2*i),0); glVertex3f(1.01,0.5 - (0.2*i),-1); glEnd(); } else { glBegin(GL_LINES); glVertex3f(1.01,0.5 - (0.2*i),0); glVertex3f(1.01,0.5 - (0.2*i),-0.4); glEnd(); } } glBegin(GL_LINES); glVertex3f(1.01, -0.5,-0.5); glVertex3f(1.01,-0.15,-0.5); glVertex3f(1.01,-0.15,-0.9); glVertex3f(1.01,-0.5,-0.9); glVertex3f(1.01,-0.15,-0.5); glVertex3f(1.01,-0.15,-0.9); glVertex3f(1.01,-0.5,-0.7); glVertex3f(1.01,-0.15,-0.7); glEnd(); colMat[0]=0.8; colMat[1]=0.8; colMat[2]=0.8; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); glLineWidth(5); glBegin(GL_LINES); glVertex3f(1.01, 0.5,-0.4); glVertex3f(1.01,-0.5,-0.4); glEnd(); // Third glass pane colMat[0]=0.5; colMat[1]=0.5; colMat[2]=1; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); glLineWidth(1.5); glNormal3f(-1,0,-1); glBegin(GL_LINES); glVertex3f(-1.01,0.5,0); glVertex3f(-1.01,-0.1,0); glEnd(); glBegin(GL_LINES); glVertex3f(-0.93,0.5,-0.11); glVertex3f(-0.93,-0.1,-0.11); glEnd(); glBegin(GL_LINES); glVertex3f(-0.85,0.5,-0.22); glVertex3f(-0.85,-0.1,-0.22); glEnd(); glBegin(GL_LINES); glVertex3f(-0.76,0.5,-0.33); glVertex3f(-0.76,-0.1,-0.33); glEnd(); for(int i = 0; i < 4; i++) { glBegin(GL_LINES); glVertex3f(-1.01,0.5 - (0.2*i),0); glVertex3f(-0.76,0.5 - (0.2*i),-0.33); glEnd(); } glBegin(GL_LINES); glVertex3f(-0.96, -0.5,-0.055); glVertex3f(-0.96,-0.15,-0.055); glVertex3f(-0.89,-0.15,-0.165); glVertex3f(-0.89,-0.5,-0.165); glVertex3f(-0.8,-0.15,-0.275); glVertex3f(-0.8,-0.5,-0.275); glVertex3f(-0.96,-0.15,-0.055); glVertex3f(-0.8,-0.15,-0.275); glEnd(); //Front door roof colMat[0]=0.8; colMat[1]=0.8; colMat[2]=0.8; glMaterialfv(GL_FRONT, GL_DIFFUSE, colMat); glMaterialfv(GL_FRONT, GL_AMBIENT, colMat); glBegin(GL_POLYGON); glNormal3f(0,-1,0); glVertex3f(1.01,-0.1,-0.4); glVertex3f(1.01,-0.1,-1); glVertex3f(1.375,-0.1,-1); glVertex3f(1.375,-0.1,-0.4); glEnd(); glBegin(GL_POLYGON); glNormal3f(0,1,0); glVertex3f(1.01,-0.05,-0.4); glVertex3f(1.01,-0.05,-1); glVertex3f(1.375,-0.05,-1); glVertex3f(1.375,-0.05,-0.4); glEnd(); glBegin(GL_POLYGON); glNormal3f(0,0,1); glVertex3f(1.01,-0.1,-0.4); glVertex3f(1.375,-0.1,-0.4); glVertex3f(1.375,-0.05,-0.4); glVertex3f(1.01,-0.05,-0.4); glEnd(); glBegin(GL_POLYGON); glNormal3f(0,0,-1); glVertex3f(1.01,-0.1,-1); glVertex3f(1.375,-0.1,-1); glVertex3f(1.375,-0.05,-1); glVertex3f(1.01,-0.05,-1); glEnd(); glBegin(GL_POLYGON); glNormal3f(1,0,0); glVertex3f(1.375,-0.1,-0.4); glVertex3f(1.375,-0.05,-0.4); glVertex3f(1.375,-0.05,-1); glVertex3f(1.375,-0.1,-1); glEnd(); glBegin(GL_LINES); glVertex3f(1.375,-0.05,-0.4); glVertex3f(1.01,0.1,-0.4); glEnd(); glBegin(GL_LINES); glVertex3f(1.375,-0.05,-1); glVertex3f(1.01,0.1,-1); glEnd(); //Roof glBegin(GL_POLYGON); glNormal3f(0,-1,0); glVertex3f(1.1,0.5,0.1); glVertex3f(1.1,0.5,-1); glVertex3f(-1.25,0.5,-0.33); glVertex3f(-1.5,0.5,0.1); glEnd(); glBegin(GL_POLYGON); glNormal3f(0,0,1); glVertex3f(1.1,0.5,0.1); glVertex3f(1.1,0.6,0.1); glVertex3f(-1.5,0.6,0.1); glVertex3f(-1.5,0.5,0.1); glEnd(); glBegin(GL_POLYGON); glNormal3f(-1,0,-1); glVertex3f(-1.5,0.5,0.1); glVertex3f(-1.5,0.6,0.1); glVertex3f(-1.25,0.6,-0.33); glVertex3f(-1.25,0.5,-0.33); glEnd(); glBegin(GL_POLYGON); glNormal3f(0,0,-1); glVertex3f(1.1,0.5,-1); glVertex3f(1.1,0.6,-1); glVertex3f(-1.25,0.6,-0.33); glVertex3f(-1.25,0.5,-0.33); glEnd(); glBegin(GL_POLYGON); glNormal3f(1,0,0); glVertex3f(1.1,0.5,0.1); glVertex3f(1.1,0.5,-1); glVertex3f(1.1,0.6,-1); glVertex3f(1.1,0.6,0.1); glEnd(); glBegin(GL_POLYGON); glNormal3f(0,1,0); glVertex3f(1.1,0.6,0.1); glVertex3f(1.1,0.6,-1); glVertex3f(-1.25,0.6,-0.33); glVertex3f(-1.5,0.6,0.1); glEnd(); glLineWidth(7); glBegin(GL_LINES); glNormal3f(0,0,1); glVertex3f(-1.47,0.5,0.07); glVertex3f(-1.47,-0.5,0.07); glEnd(); //Pillar glRotatef(90,1,0,0); glTranslatef(1.05,0.05,-0.5); glutSolidCylinder(0.05,1,100,100); }
static void drawSolidCylinder(void) { glutSolidCylinder(1,1,slices,stacks); }
/* Draw the building to screen */ void Mill::draw_building() { GLfloat test_material[4] = { 1.00, 1.00, 1.00, 1.00 }; GLfloat house_material[4] = { 0.72, 0.72, 0.72, 1.00 }; GLfloat high_roof_material[4] = { 0.55, 0.27, 0.07, 1.00 }; GLfloat window_vert_material[4] = { 0.20, 0.20, 0.20, 1.00 }; GLfloat low_roof_material[4] = { 0.55, 0.27, 0.07, 1.00 }; GLfloat door_material[4] = { 0.50, 0.30, 0.20, 1.00 }; glPushMatrix(); glTranslatef(x, y*-1, z); glTranslatef(0.0, 0.5, 0.0); glTranslatef(-0.15, -0.80, 0.1); glScalef(0.7, 0.5, 0.8); // house glPushMatrix(); //glColor3f(0.72, 0.72, 0.72); glMaterialfv(GL_FRONT, GL_DIFFUSE, house_material); glScalef(0.5, 0.75, 0.5); glutSolidCube(1); glPopMatrix(); glPushMatrix(); //glColor3f(0.72, 0.72, 0.72); glTranslated(0.3, -0.125, 0.0); glScalef(0.75, 0.5, 0.25); glutSolidCube(1); glPopMatrix(); glTranslated(0.0, -0.2, 0.0); // high roof glPushMatrix(); glScaled(0.5, 1.0, 0.6); //glColor3f(0.55, 0.27, 0.07); glMaterialfv(GL_FRONT, GL_DIFFUSE, high_roof_material); glTranslatef(0.0, 0.58, 0.0); glScalef(0.55, 0.2, 0.5); // Right glBegin(GL_POLYGON); glNormal3d(0.5, 0.5, 0.0); glVertex3f(0.0f, 0.5f, 1.0f); glVertex3f(0.0f, 0.5f, -1.0f); glVertex3f(1.0f, 0.0f, -1.0f); glVertex3f(1.0f, 0.0f, 1.0f); glEnd(); // Left glBegin(GL_POLYGON); glNormal3d(-0.5, 0.5, 0.0); glVertex3f(0.0f, 0.5f, 1.0f); glVertex3f(0.0f, 0.5f, -1.0f); glVertex3f(-1.0f, 0.0f, -1.0f); glVertex3f(-1.0f, 0.0f, 1.0f); glEnd(); glPopMatrix(); //Low roof glPushMatrix(); glTranslated(0.45, 0.35, 0.0); glRotated(90, 0.0, 1.0, 0.0); glScaled(0.4, 0.0, 0.5); //glColor3f(0.55, 0.27, 0.07); glMaterialfv(GL_FRONT, GL_DIFFUSE, low_roof_material); glScalef(0.55, 0.2, 0.5); // Right glBegin(GL_POLYGON); glNormal3d(0.0, 0.5, -0.5); glVertex3f(0.0f, 0.5f, 1.0f); glVertex3f(0.0f, 0.5f, -1.0f); glVertex3f(1.0f, 0.0f, -1.0f); glVertex3f(1.0f, 0.0f, 1.0f); glEnd(); // Left glBegin(GL_POLYGON); glNormal3d(0.0, 0.5, 0.5); glVertex3f(0.0f, 0.5f, 1.0f); glVertex3f(0.0f, 0.5f, -1.0f); glVertex3f(-1.0f, 0.0f, -1.0f); glVertex3f(-1.0f, 0.0f, 1.0f); glEnd(); glPopMatrix(); //Wood glPushMatrix(); glTranslated(0.0, 0.0, 0.24); glRotated(45, 1.0, 0.0, 0.0); glScaled(0.2, 0.5, 1.0); glutSolidCylinder(0.1, 0.15, 10, 3); glPopMatrix(); glPushMatrix(); glTranslated(0.05, 0.0, 0.24); glRotated(45, 1.0, 0.0, 0.0); glScaled(0.2, 0.5, 1.0); glutSolidCylinder(0.1, 0.15, 10, 3); glPopMatrix(); glPushMatrix(); glTranslated(0.1, 0.0, 0.24); glRotated(45, 1.0, 0.0, 0.0); glScaled(0.2, 0.5, 1.0); glutSolidCylinder(0.1, 0.15, 10, 3); glPopMatrix(); glPushMatrix(); glTranslated(0.38, -0.2, 0.22); glRotated(45, 0.0, 1.0, 0.0); glScaled(0.2, 0.5, 1.0); glutSolidCylinder(0.1, 0.15, 10, 3); glPopMatrix(); //Window vertical //glColor3d(0.2, 0.2, 0.2); glMaterialfv(GL_FRONT, GL_DIFFUSE, window_vert_material); glPushMatrix(); glTranslated(-0.2, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.14, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //horizontal //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.38, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.22, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); glPushMatrix(); glTranslated(0.1, 0.0, 0.0); //Window vertical //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.2, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.14, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //horizontal //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.38, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.22, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); glPopMatrix(); glPushMatrix(); glTranslated(0.2, 0.0, 0.0); //Window vertical //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.2, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.14, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //horizontal //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.38, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.22, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); glPopMatrix(); glPushMatrix(); glTranslated(0.3, 0.0, 0.0); //Window vertical //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.2, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.14, 0.3, 0.25); glScaled(0.03, 0.3, 0.03); glutSolidCube(0.5); glPopMatrix(); //horizontal //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.38, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.3, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glPushMatrix(); glTranslated(-0.17, 0.22, 0.25); glRotated(90, 0.0, 0.0, 1.0); glScaled(0.03, 0.15, 0.03); glutSolidCube(0.5); glPopMatrix(); //Door //glColor3d(0.5, 0.3, 0.2); glMaterialfv(GL_FRONT, GL_DIFFUSE, door_material); glPushMatrix(); glTranslated(0.2, -0.082, 0.12); glScaled(0.2, 0.35, 0.03); glutSolidCube(0.5); glPopMatrix(); //glColor3d(0.2, 0.2, 0.2); glMaterialfv(GL_FRONT, GL_DIFFUSE, window_vert_material); glPushMatrix(); glTranslated(0.2, -0.082, 0.13); glScaled(0.1, 0.1, 0.03); glutSolidCube(0.5); glPopMatrix(); glPushMatrix(); //glDisable(GL_LIGHTING); glMaterialfv(GL_FRONT, GL_DIFFUSE, test_material); glTranslatef(-0.08, -0.20, -0.12); glScalef(0.65, 0.01, 0.56); draw_plane(this->images.at(11).get_image()); //glEnable(GL_LIGHTING); glPopMatrix(); glPopMatrix(); glPopMatrix(); // Animation checking // Each building will fly in from the sky and continue to fall until it lands on the grid. if (y < -0.50) // If the building's Y position is below -0.50 (grid Y coordinate) { Building::is_animating = true; // The building is animating y = y + 0.05; // Increment the Y value (moving it up). This is because the Y value is inverted in the draw_building function. } else // If the building's Y position is on the ground (or above -0.50) { y = -0.50; // Set the Y coordinate to -0.50 Building::is_animating = false; // Set the animation flag to false. } }
void drawHouse() { glColor3f(rand() / double(RAND_MAX), rand() / double(RAND_MAX), rand() / double(RAND_MAX)); glBegin(GL_QUADS); glVertex3f(2.0f, 2.0f, -2.0f); glVertex3f(-2.0f, 2.0f, -2.0f); glVertex3f(-2.0f, 2.0f, 2.0f); glVertex3f(2.0f, 2.0f, 2.0f); glVertex3f(2.0f, -2.0f, 2.0f); glVertex3f(-2.0f, -2.0f, 2.0f); glVertex3f(-2.0f, -2.0f, -2.0f); glVertex3f(2.0f, -2.0f, -2.0f); glVertex3f(2.0f, 2.0f, 2.0f); glVertex3f(-2.0f, 2.0f, 2.0f); glVertex3f(-2.0f, -2.0f, 2.0f); glVertex3f(2.0f, -2.0f, 2.0f); glVertex3f(2.0f, -2.0f, -2.0f); glVertex3f(-2.0f, -2.0f, -2.0f); glVertex3f(-2.0f, 2.0f, -2.0f); glVertex3f(2.0f, 2.0f, -2.0f); glVertex3f(-2.0f, 2.0f, 2.0f); glVertex3f(-2.0f, 2.0f, -2.0f); glVertex3f(-2.0f, -2.0f, -2.0f); glVertex3f(-2.0f, -2.0f, 2.0f); glVertex3f(2.0f, 2.0f, -2.0f); glVertex3f(2.0f, 2.0f, 2.0f); glVertex3f(2.0f, -2.0f, 2.0f); glVertex3f(2.0f, -2.0f, -2.0f); glEnd(); //крыша glColor3f(0.0f, 0.0f, 1.0f); glBegin(GL_TRIANGLES); glVertex3f(0.0f, 4.0f, 0.0f); glVertex3f(-2.0f, 2.0f, 2.0f); glVertex3f(2.0f, 2.0f, 2.0f); glVertex3f(0.0f, 4.0f, 0.0f); glVertex3f(2.0f, 2.0f, 2.0f); glVertex3f(2.0f, 2.0f, -2.0f); glVertex3f(0.0f, 4.0f, 0.0f); glVertex3f(2.0f, 2.0f, -2.0f); glVertex3f(-2.0f, 2.0f, -2.0f); glVertex3f(0.0f, 4.0f, 0.0f); glVertex3f(-2.0f, 2.0f, -2.0f); glVertex3f(-2.0f, 2.0f, 2.0f); glEnd(); //дверь glBegin(GL_QUADS); glColor3f(0.54f, 0.27f, 0.08f); glVertex3f(-1.5f, 0.0f, 2.01f); glVertex3f(-1.5f, 1.5f, 2.01f); glVertex3f(-0.5f, 1.5f, 2.01f); glVertex3f(-0.5f, 0.0f, 2.01f); glEnd(); //окно glBegin(GL_QUADS); glColor3f(0.1f, 0.1f, 0.1f); glVertex3f(1.5f, 0.5f, 2.01f); glVertex3f(1.5f, 1.5f, 2.01f); glVertex3f(0.5f, 1.5f, 2.01f); glVertex3f(0.5f, 0.5f, 2.01f); glEnd(); glBegin(GL_QUADS); glColor3f(0.8f, 0.8f, 0.9f); glVertex3f(1.4f, 0.6f, 2.011f); glVertex3f(1.4f, 1.4f, 2.011f); glVertex3f(0.6f, 1.4f, 2.011f); glVertex3f(0.6f, 0.6f, 2.011f); glEnd(); //доски glColor3f(0.54f, 0.27f, 0.08f); glTranslatef(2.7f, 0.4f, -2.0f); glutSolidCylinder(0.4f, 4.0f, 32, 32); glTranslatef(0.6f, 0.0f, 0.0f); glutSolidCylinder(0.4f, 4.0f, 32, 32); //типо кошка glTranslatef(-6.0f, -0.0f, 2.0f); glColor3f(0.2f, 0.2f, 0.2f); glutSolidSphere(0.4f, 20, 20); glTranslatef(0.0f, 0.5f, 0.0f); glutSolidSphere(0.2f, 20, 20); //Гусеница мутант glColor3f(0.0f, 1.0f, 0.0f); glTranslatef(-1.0f, 2.0f, -6.0f); glutWireSphere(3.0f, 32, 32); glTranslatef(0.0f, 4.0f, 0.0f); glutWireSphere(3.0f, 32, 32); glTranslatef(4.0f, 0.0f, 0.0f); glutWireSphere(1.0f, 20, 20); glTranslatef(-8.0f, 0.0f, 0.0f); glutWireSphere(1.0f, 20, 20); glTranslatef(4.0f, 4.0f, 0.0f); glutWireSphere(2.0f, 32, 32); //мангал glColor3f(1.0f, 1.0f, 1.0f); glTranslatef(0.0f, 10.0f, 10.0f); glutSolidCube(2.0f); }
void wheel(void) { glPushMatrix(); glTranslatef(0.0f, 0.0f, -0.5f); glutSolidCylinder(1.5f, 0.2f, 100, 100); glPopMatrix(); glPushMatrix(); glTranslatef(0.0f, 0.0f, -0.4f); glutSolidCylinder(1.0f, 0.2f, 100, 100); glPopMatrix(); glutSolidTorus(0.3,3.0,100,100); /*Spokes at 60 degrees */ glPushMatrix(); glRotatef(60, 0.0f, 0.0f, 1.0f); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(-60, 0.0f, 0.0f, 1.0f); glTranslatef(0.0, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(-120.0, 0.0, 0.0, 1.0); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(120, 0.0f, 0.0f, 1.0f); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); /*Spokes at 30 degrees */ glPushMatrix(); glRotatef(150, 0.0f, 0.0f, 1.0f); glTranslatef(0.0, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(-150, 0.0f, 0.0f, 1.0f); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(30, 0.0f, 0.0f, 1.0f); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(-30, 0.0f, 0.0f, 1.0f); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(90, 0.0f, 0.0f, 1.0f); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(180, 0.0, 0.0, 1.0); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); glPushMatrix(); glRotatef(-90, 0.0f, 0.0f, 1.0f); glTranslatef(0.0f, 1.4f, -0.3f); glPushMatrix(); glRotatef(-10, -1.0f, 0.0f, 0.0f); glScalef(0.4f, 3.2f, 0.1f); cube(); glPopMatrix(); glPopMatrix(); }