//Jackie Weber /* My object for the Object Library table(...) takes four parameters 1) float tablePostLeftX 2) float tablePostRightX 3) float tablePostTopZ 4) float tablePostBottomZ These are the positions of the table legs. This is assuming a normal coordinate system with a normal (down the z axis) camera view. The size of the top of the table is: tablePostRightX-tablePostLeftX tablePostTopZ-tablePostBottomZ y=4* Color of table legs is brown, top is white/ twTriple brown={150.0/255.0,75.0/255.0,0}; /* x and z specify the origin along their respective axes Origin: x,0,z Orientation: normal axes Size: Color: */ static void tablePosts(float x,float z){ //glEnable(GL_TEXTURE_2D); twTriple brown={150.0/255.0,75.0/255.0,0}; // I had to add this here. twColor(brown,0.5,30); //glBindTexture(GL_TEXTURE_2D, textureIDs[1]); float frontLowerRightX=x-.5; float frontLowerLeftX=x+.5; glBegin(GL_QUADS); glNormal3f(0,0,1); // glTexCoord2f(0,0); glVertex3f(x-.5,3.0, z+.5); //glTexCoord2f(0,1); glVertex3f (x-.5,0.0, z+.5); //glTexCoord2f(1,1); glVertex3f (x+.5,0.0,z+.5); // glTexCoord2f(1,0); glVertex3f (x+.5,3.0,z+.5); glNormal3f(1,0,0); //glTexCoord2f(0,0); glVertex3f(x+.5,3,z+.5); //glTexCoord2f(0,1); glVertex3f(x+.5,0,z+.5); //glTexCoord2f(1,1); glVertex3f(x+.5,0,z-.5); //glTexCoord2f(1,0); glVertex3f(x+.5,3,z-.5); glNormal3f(0,0,-1); //glTexCoord2f(0,0); glVertex3f(x-.5,3.0, z-.5); //glTexCoord2f(0,1); glVertex3f (x-.5,0.0, z-.5); //glTexCoord2f(1,1); glVertex3f (x+.5,0.0,z-.5); //glTexCoord2f(1,0); glVertex3f (x+.5,3.0,z-.5); glNormal3f(-1,0,0); //glTexCoord2f(0,0); glVertex3f(x-.5,3,z+.5); //glTexCoord2f(0,1); glVertex3f(x-.5,0,z+.5); // glTexCoord2f(1,1); glVertex3f(x-.5,0,z-.5); //glTexCoord2f(1,0); glVertex3f(x-.5,3,z-.5); glEnd(); } /* x1 is the right edge of the table; x2 is the left side, z1 is top and z2 is bottom Origin: halfway between x1 and x2, y=3.5, and halfway between z1 and z2 Orientation: normal axes Size: in the x direction, x1-x2+1,z1-z2-1 Color: White */ static void tableTop(float x1,float x2,float z1,float z2){ glDisable(GL_TEXTURE_2D); twColorName(TW_WHITE); glTranslatef((x1+x2)/2.0,3.5,(z1+z2)/2.0); glPushMatrix(); glScalef(x1-x2+1,1,z1-z2-1); glutSolidCube(1); glPopMatrix(); } /* Note: this function has no push and pop. This makes it easier to place things on top of the table. Origin: halfway between tablePostLeftX and tablePostRightX, halfway between tablePostTopZ and tablePostBottomZ (tablePostBottomA being a lower number on the z axis, so it's farther from the viewer with the typical original view), y=0 Orientation: normal coordinate system Size: tablePostRightX-tablePostLeftX, tablePostTopZ-tablePostBottomZ, y=4 (tablepostheight (3) + tableTopHeight(1)) Colors: tablePosts are brown, tableTop is white */ void jweber2Table(float tablePostLeftX,float tablePostRightX,float tablePostTopZ,float tablePostBottomZ){ glDisable(GL_TEXTURE_2D); tablePosts(tablePostLeftX,tablePostTopZ);//tableposts for table tablePosts(tablePostRightX,tablePostTopZ); tablePosts(tablePostLeftX,tablePostBottomZ); tablePosts(tablePostRightX,tablePostBottomZ); tableTop(tablePostRightX-1,tablePostLeftX+1,tablePostTopZ,tablePostBottomZ);//top of table - tableposts changed in the X direction so directly over tableposts and not between them in the x direction }