void tcHookInfo::Draw() { static int nFrameCount = 0; wxASSERT(mpSS); //if ((nFrameCount++ % 4) != 0) return; // use to skip draw updates StartDraw(); tcGameObject* pHookedObj; mpSS->GetPlatformState(mnHookID, pHookedObj); bool drawTruth = (pHookedObj != 0) && (pHookedObj->IsOwnAlliance() || pHookedObj->IsEditMode()); if (drawTruth) { DrawOwn(pHookedObj); } else { // attempt to draw track if either null pHookedObj or different alliance DrawTrack(mnHookID); } FinishDraw(); }
void tcAircraftInfoPopup::Draw() { //unsigned currentCount = tcTime::Get()->Get30HzCount(); //unsigned age = currentCount - birthCount; Update(); StartDraw(); Vec4 color(1, 1, 1, 1); //float x = 0.5f * float(mnWidth); float y = 0.5f * float(mnHeight); DrawRectangleR(0, 0, float(mnWidth), float(mnHeight), Vec4(0, 0, 0, 0.5f), FILL_ON); DrawTextR(infoText.c_str(), 5.0f, y, monospacedFont.get(), color, fontSize, LEFT_CENTER, float(mnWidth)-10.0f); FinishDraw(); }
void TunnelSegment::Draw( void ) { GLfloat x, y, z, new_z; GLfloat nX, nY; GLfloat S, T, Tnew; int stack, slice; float teta; if ( ! enabled ) return; PrepDraw(); if ( list < 0 ) { glNewList( list = 1, GL_COMPILE ); z = 0; T = 0; for( stack=0 ; stack < NSTACKS ; stack++ ) { Tnew = T + (double) SREP / (double) NSTACKS; glBegin( GL_QUAD_STRIP ); S = 0; new_z = z + length / NSTACKS; for( teta = 0, slice = 0 ; slice <= NSLICES ; slice++ ) { nX = cos( teta ); nY = sin( teta ); x = radius * cos( teta ); y = radius * sin( teta ); glNormal3f( nX, nY, 0.0 ); glTexCoord2f( S, T ); glVertex3f( x, y, z ); glNormal3f( nX, nY, 0.0 ); glTexCoord2f( S, Tnew ); glVertex3f( x, y, new_z ); // 1er segment est -z teta += 2.0 * pi / (double) NSLICES; S += (double) SREP / (double) NSLICES; } glEnd(); z = new_z; T =Tnew; } glEndList(); } else glCallList( list ); FinishDraw(); }
void Sphere::Draw( void ) { if ( ! enabled ) return; PrepDraw(); gluSphere( quad, radius, slices, stacks ); FinishDraw(); }
void csGraphics2D::ClearAll (int color) { if (!BeginDraw ()) return; Clear (color); FinishDraw (); Print (); }
void OpenGLObject::Draw( void ) { if ( ! enabled ) return; PrepDraw(); FinishDraw(); }
void Cylinder::Draw( void ) { if ( ! enabled ) return; PrepDraw(); gluCylinder( quad, top_radius, bottom_radius, height, slices, stacks ); FinishDraw(); }
void Disk::Draw( void ) { if ( ! enabled ) return; PrepDraw(); gluDisk( quad, inner_radius, outer_radius, slices, loops ); FinishDraw(); }
void Ellipsoid::Draw( void ) { if ( ! enabled ) return; PrepDraw(); glScaled( x_distortion, y_distortion, z_distortion ); gluSphere( quad, max_radius, slices, stacks ); FinishDraw(); }
void Hole::Draw( void ) { double rx, ry, angle, angle_step = Pi / 128.0; if ( ! enabled ) return; PrepDraw(); glBegin( GL_POLYGON ); glVertex2f( width, height ); glVertex2f( width, 0.0 ); for ( angle = - angle_step; angle <= 0.5 * Pi + angle_step; angle += angle_step ) { rx = radius * cos( angle ); ry = radius * sin( angle ); glVertex2f( rx, ry ); } glVertex2f( 0.0, height ); glVertex2f( width, height ); glEnd(); glBegin( GL_POLYGON ); glVertex2f( - width, height ); glVertex2f( 0.0, height ); for ( angle = 0.5 * Pi - angle_step; angle <= Pi + angle_step; angle += angle_step ) { rx = radius * cos( angle ); ry = radius * sin( angle ); glVertex2f( rx, ry ); } glVertex2f( - width, 0.0 ); glVertex2f( - width, height ); glEnd(); glBegin( GL_POLYGON ); glVertex2f( - width, - height ); glVertex2f( - width, 0.0 ); for ( angle = Pi - angle_step; angle <= 1.5 * Pi + angle_step; angle += angle_step ) { rx = radius * cos( angle ); ry = radius * sin( angle ); glVertex2f( rx, ry ); } glVertex2f( 0.0, - height ); glVertex2f( - width, - height ); glEnd(); glBegin( GL_POLYGON ); glVertex2f( width, - height ); glVertex2f( 0.0, - height ); for ( angle = 1.5 * Pi - angle_step; angle <= 2.0 * Pi + angle_step; angle += angle_step ) { rx = radius * cos( angle ); ry = radius * sin( angle ); glVertex2f( rx, ry ); } glVertex2f( width, 0.0 ); glVertex2f( width, - height ); glEnd(); FinishDraw(); }
void tcContainerGui::Draw() { StartDraw(); size_t nSlots = slots.size(); for (size_t n=0; n<nSlots; n++) { tcContainerSlot& slot = slots[n]; DrawRectangleR(slot.loc, Vec4(1, 1, 0, 1), tc3DWindow2::FILL_OFF); } DrawSelectionBox(); FinishDraw(); }
void Patch::Draw( void ) { double x = width / 2.0; double y = length / 2.0; double z = 0.0; if ( ! enabled ) return; PrepDraw(); if ( texture ) { GLfloat u, v; glEnable( GL_TEXTURE_2D ); texture->Use(); glBegin(GL_QUADS); if ( texture->u_length ) u = umag * width / texture->u_length; else u = umag; if ( texture->v_length ) v = vmag * length / texture->v_length; else v = vmag; glNormal3d( 0.0, 0.0, - 1.0 ); glTexCoord2f(0.0f, 0.0f); glVertex3d( - x, - y, z ); glTexCoord2f(0.0f, v); glVertex3d( - x, y, z ); glTexCoord2f( u, v); glVertex3d( x, y, z ); glTexCoord2f( u, 0.0); glVertex3d( x, - y, z ); glEnd(); glDisable( GL_TEXTURE_2D ); } else { glBegin(GL_QUADS); glNormal3d( 0.0, 0.0, - 1.0 ); glVertex3d( - x, - y, z ); glVertex3d( - x, y, z ); glVertex3d( x, y, z ); glVertex3d( x, - y, z ); glEnd(); } FinishDraw(); }
void Assembly::Draw( void ) { if ( ! enabled ) return; PrepDraw(); for ( int i = 0; i < components; i++ ) { component[i]->Draw(); // Restore the color, in case the component changed it. // This does not work in the case where the assembly is supposed to use // the parent color. Need to find a way to push the color on the stack // or to query the color and save it to restore it later. if ( color[3] != USE_PARENT_COLOR ) glColor4fv( color ); } FinishDraw(); }
void Circle::Draw( void ) { double rx, ry, angle, angle_step = Pi / 10.0; if ( ! enabled ) return; PrepDraw(); glBegin( GL_POLYGON ); for ( angle = 0.0; angle < 2.0 * Pi; angle += angle_step ) { rx = radius * cos( angle ); ry = radius * sin( angle ); glVertex2f( rx, ry ); } glEnd(); FinishDraw(); }
void Frustrum::Draw( void ) { if ( ! enabled ) return; PrepDraw(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable( GL_LIGHTING ); draw_polygons(); glDisable( GL_LIGHTING ); glColor4fv( OpenGLColors[ RED ] ); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE ); draw_end(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable( GL_LIGHTING ); FinishDraw(); }
void tcOOBView::Draw() { //static int frameCount = 0; //if ((frameCount++ % 5) !=0 ) return; StartDraw(); if (displayMode == SHOW_OWN) { DrawOwn(); } else if (displayMode == SHOW_TRACKS) { DrawTracks(); } /* DrawRectangleR(0, 0, mnWidth, mnHeight, Vec4(0, 0, 0, 0.6f), FILL_ON);*/ FinishDraw(); }
void tcSoundConsole::Draw() { StartDraw(); if (textBox->Redraw()) { unsigned int counter = tcTime::Get()->Get30HzCount(); if (counter - lastEffect > 4) { tcSound::Get()->PlayEffect(soundEffect); lastEffect = counter; } } if (!IsBackgroundEnabled()) { DrawRectangleR(0, 0, mnWidth, mnHeight, Vec4(0, 0, 0, 0.5f), FILL_ON); } FinishDraw(); }
void Extrusion::Draw( void ) { double l2 = length / 2.0; int i, j; Vector3 delta, normal; if ( ! enabled ) return; PrepDraw(); /* Draw the ends first. */ glBegin( GL_POLYGON ); glNormal3d( 0.0, 0.0, - 1.0 ); for ( i = 0; i < vertices; i++ ) glVertex3d( vertex[i][X], vertex[i][Y], l2 ); glEnd(); glBegin( GL_POLYGON ); glNormal3d( 0.0, 0.0, 1.0 ); for ( i = vertices - 1; i >= 0; i-- ) glVertex3d( vertex[i][X], vertex[i][Y], - l2 ); glEnd(); /* Now draw the facets. */ for ( i = 0; i < vertices; i++ ) { j = ( i + 1 ) % vertices; // subtract_vectors( vertex[i], vertex[j], delta ); delta[0] = vertex[i][0] - vertex[j][0]; delta[1] = vertex[i][1] - vertex[j][1]; delta[2] = 0.0; ComputeCrossProduct( normal, delta, kVector ); NormalizeVector( normal ); glBegin( GL_POLYGON ); glNormal3dv( normal ); glVertex3d( vertex[i][X], vertex[i][Y], - l2 ); glVertex3d( vertex[i][X], vertex[i][Y], l2 ); glVertex3d( vertex[j][X], vertex[j][Y], l2 ); glVertex3d( vertex[j][X], vertex[j][Y], - l2 ); glEnd(); } FinishDraw(); }
void WindowFrame::Draw( void ) { double x = width / 2.0; double y = height / 2.0; double z = 0.0; if ( ! enabled ) return; PrepDraw(); glBegin(GL_QUADS); glNormal3d( 0.0, 0.0, - 1.0 ); glVertex3d( - x - thickness, - y - thickness, z ); glVertex3d( - x - thickness, y + thickness, z ); glVertex3d( - x, y, z ); glVertex3d( - x, - y, z ); glVertex3d( x, - y, z ); glVertex3d( x, y, z ); glVertex3d( x + thickness, y + thickness, z ); glVertex3d( x + thickness, - y - thickness, z ); glVertex3d( - x - thickness, - y - thickness, z ); glVertex3d( - x, - y, z ); glVertex3d( x, - y, z ); glVertex3d( x + thickness, - y - thickness, z ); glVertex3d( - x, y, z ); glVertex3d( - x - thickness, y + thickness, z ); glVertex3d( x + thickness, y + thickness, z ); glVertex3d( x, y, z ); glEnd(); FinishDraw(); }
void tcGameOutcomePopup::Draw() { //unsigned currentCount = tcTime::Get()->Get30HzCount(); //unsigned age = currentCount - birthCount; if (CloseRequested()) { DestroyWindow(); return; } Update(); StartDraw(); Vec4 color(1, 1, 1, 1); Vec4 titleColor(1, 1, 0.4f, 1); float x = 0.5f * float(mnWidth); float y = 0.5f * float(mnHeight); DrawRectangleR(0, 0, float(mnWidth), float(mnHeight), Vec4(0, 0, 0, 0.5f), FILL_ON); DrawTextR("GAME OVER", x, 15.0, defaultFont.get(), titleColor, fontSize + 6.0f, CENTER_CENTER, float(mnWidth)-10.0f); DrawTextR(messageText.c_str(), 5.0f, y, defaultFont.get(), color, fontSize + 2.0f, LEFT_CENTER, float(mnWidth)-10.0f); FinishDraw(); }
void tcLauncherPopup::Draw() { if (GetForceClose(platformId, launcherIdx)) DestroyWindow(); unsigned currentCount = tcTime::Get()->Get30HzCount(); unsigned age = currentCount - birthCount; if (age % 1 == 0) redraw = true; if (!redraw) return; StartDraw(); UpdateTorpedoLauncher(); redraw = false; Vec4 color(1, 1, 1, 1); float x = 10.0f; float y = 12.0f; tcPlatformObject* obj = dynamic_cast<tcPlatformObject*>(simState->GetObject(platformId)); DrawRectangleR(0, 0, float(mnWidth), float(mnHeight), Vec4(0, 0, 0, 0.6f), FILL_ON); if (!obj) { DrawTextR("CONTROL UNAVAILABLE", x, y, defaultFont.get(), color, fontSize, CENTER_CENTER); FinishDraw(); return; } tcLauncher* launcher = obj->GetLauncher(launcherIdx); if (!launcher) { DrawTextR("LAUNCHER ERROR", x, y, defaultFont.get(), color, fontSize, CENTER_CENTER); FinishDraw(); return; } wxString s; wxSize textSize; s = wxString::Format("%s : %s x %d\n", launcher->displayName.c_str(), launcher->GetChildClassName().c_str(), launcher->mnCurrent); DrawTextR(s.c_str(), x, y, defaultFont.get(), color, fontSize, LEFT_CENTER); if (launcher->GetLauncherStatus() == tcLauncher::LAUNCHER_READY) { launchButton->SetFillColors(Vec4(0.2f, 0.5f, 0.2f, 1.0f), Vec4(0.4f, 1.0f, 0.4f, 1.0f), Vec4(0.4f, 1.0f, 0.4f, 1.0f)); } else { launchButton->SetFillColors(Vec4(0.5f, 0.2f, 0.2f, 1.0f), Vec4(1.0f, 0.4f, 0.4f, 1.0f), Vec4(1.0f, 0.4f, 0.4f, 1.0f)); } if (launcher->usePassive) { activePassiveButton->SetCaption("Passive"); } else { activePassiveButton->SetCaption("Active"); } FinishDraw(); }
void TunnelJunction::Draw( void ) { GLfloat *T; GLfloat dT; GLfloat Xold[NSLICES+1], Yold[NSLICES+1], Zold[NSLICES+1]; GLfloat x, y, z; GLfloat nXold[NSLICES+1], nYold[NSLICES+1], nZold[NSLICES+1], nX, nY, nZ; GLfloat S, Tnew; int stack, slice; float teta, phi; if ( ! enabled ) return; PrepDraw(); // Initialisation des Xolds (premier cercle de pts, phi=0) for(teta=0, slice=0 ; slice<=NSLICES ; slice++) { nXold[slice] = sin( teta ); nYold[slice] = - cos( teta ); nZold[slice] = 0; Xold[slice] = RSEG * sin( teta ); Yold[slice] = - RSEG * cos( teta ); Zold[slice] = 0; teta += 2.0 * pi / NSLICES; } phi = pi / 2.0 / NSTACKS; for(stack=0 ; stack<NSTACKS ; stack++) { glBegin(GL_QUAD_STRIP); Tnew = *T + dT * pi * RSEG / NSTACKS; S = 0; for( teta=0, slice=0; slice <= NSLICES ; slice++ ) { nX = sin(teta); nY = - cos( teta ) * cos( phi ); nZ = - cos( teta )* sin( phi ); x = RSEG * sin( teta ); y = - RSEG * ( cos( phi ) * ( 1.0 + cos(teta) ) - 1.0); z = - RSEG * sin( phi ) * ( 1.0 + cos( teta ) ); glNormal3f( nXold[slice], nYold[slice], nZold[slice] ); glTexCoord2f(S, *T); glVertex3f( Xold[slice], Yold[slice], Zold[slice] ); glNormal3f( nX, nY, nZ ); glTexCoord2f( S, Tnew ); glVertex3f( x, y, z ); nXold[slice] = nX; nYold[slice] = nY; nZold[slice] = nZ; Xold[slice] = x; Yold[slice] = y; Zold[slice] = z; S += (GLfloat) SREP / NSLICES; teta += 2.0 * pi / NSLICES; } glEnd(); phi += 90.0/NSTACKS; *T = Tnew; } FinishDraw(); }
void tcNumberWidget<T>::Draw() { if (!mbActive) return; StartDraw(); UpdateAutoChange(); // clear keyboardWait if timeout reached if (keyboardWait) { unsigned t = tcTime::Get()->Get30HzCount(); unsigned dt = t - lastKeypressTime; if (dt >= keyboardTimeout) { keyboardWait = false; afterDecimalPoint = 0; isNegative = false; SendUpdate(); } } // non-image drawing Vec4 backgroundColor; Vec4 textColor; if (keyboardWait) { backgroundColor = keyboardWaitColor; textColor = activeTextColor; } else if (isMouseOver) { backgroundColor = mouseOverColor; textColor = activeTextColor; } else { backgroundColor = restingColor; textColor = restingTextColor; } DrawRectangle(0, 0, mnWidth, mnHeight, backgroundColor, FILL_ON); //DrawRectangle(0, 0, mnWidth, mnHeight, Vec4(1, 1, 1, backgroundAlpha), FILL_OFF); float x = float(mnWidth) - 3.0f; float y = 0.0f; //0.5f * float(mnHeight); // draw caption to the left of the window area DrawText(caption.c_str(), xcaption, ycaption, defaultFont.get(), activeTextColor, captionFontSize, tc3DWindow2::AlignmentType(captionAlignment)); wxString modifiedFormatString(formatString); if (keyboardWait) { if (afterDecimalPoint <= 1) { modifiedFormatString = "%.0f"; } else { modifiedFormatString = wxString::Format("%%.%df", afterDecimalPoint-1); } } wxString s = wxString::Format(modifiedFormatString.c_str(), val); DrawText(s.c_str(), x, y, defaultFont.get(), textColor, fontSize, RIGHT_BASE_LINE); FinishDraw(); }
void tcOptionsView::Draw() { static unsigned int drawCount = 0; std::string activeTab = GetTab(); StartDraw(); wxASSERT(mpOptions); UpdateButtonInfo(); std::vector<tcOptions::OptionInfo>& optionList = mpOptions->maOptionInfo; for(size_t k=0; k<buttonInfo.size(); k++) { if (!buttonInfo[k].isSlider) { int optionIdx = buttonInfo[k].optionIdx; int valueIdx = buttonInfo[k].valueIdx; tcString sText = optionList[optionIdx].mzCaption[valueIdx]; float x = (float)buttonInfo[k].textX; float y = (float)buttonInfo[k].textY; DrawText(sText.c_str(), x, y, defaultFont.get(), Vec4(0.86f, 0.86f, 1.0f, 1.0f), fontSize, LEFT_CENTER); if (optionList[optionIdx].mnValue == valueIdx) { DrawButton(buttonInfo[k].buttonX, buttonInfo[k].buttonY, 1); } else { DrawButton(buttonInfo[k].buttonX, buttonInfo[k].buttonY, 0); } } else { int optionIdx = buttonInfo[k].optionIdx; tcString sText = optionList[optionIdx].mzCaption[0]; bool thisSliderActive = sliderDragActive && (sliderIdx == k); float sliderVal = thisSliderActive ? sliderDragValue : optionList[optionIdx].floatVal; float sliderMin = optionList[optionIdx].floatMin; float sliderMax = optionList[optionIdx].floatMax; float sliderFraction = (sliderVal - sliderMin) / (sliderMax - sliderMin); float xText = (float)buttonInfo[k].textX; float yText = (float)buttonInfo[k].textY; float xBar = (float)buttonInfo[k].buttonX; float yBar = (float)buttonInfo[k].buttonY; DrawText(sText.c_str(), xText, yText, defaultFont.get(), Vec4(0.86f, 0.86f, 1.0f, 1.0f), fontSize, LEFT_CENTER); float xThumb = xBar + sliderFraction*sliderBarWidth; tcRect thumbRect(xThumb-2.0f, xThumb+2.0f, yBar-8.0f, yBar+8.0f); buttonInfo[k].thumbRect = thumbRect; // draw slider here DrawSlider(xBar, yBar, thumbRect, sliderVal, thisSliderActive); } } FinishDraw(); }
void tcStoresGui::Draw() { tcStores* stores = GetStores(); if (stores == 0) DestroyWindow(); //if (drawCount++ % 4 != 0) return; // update draw every 4th frame StartDraw(); UpdateGui(); bool blinkOn = tcTime::Get()->Get30HzCount() % 30 < 15; // draw caption tcGameObject* parent = stores->GetParent(); const Vec4 captionColor(1.0f, 1.0f, 1.0f, 1.0f); const char* unitName = parent->mzUnit.c_str(); const std::string& storesDisplayName = stores->GetDisplayName(); float guiWidth = float(mnWidth); wxString captionText = wxString::Format("%s\n%s", unitName, storesDisplayName.c_str()); DrawTextR(captionText.c_str(), 10.0f, 2.0f, defaultFont.get(), captionColor, 16.0f, LEFT_TOP, guiWidth - 20.0f); // draw weight/volume/count capacity status wxString fillStatus = stores->GetFilledStatusString(); DrawTextR(fillStatus.c_str(), 10.0f, float(mnHeight) - 10.0f, defaultFont.get(), captionColor, 10.0f, LEFT_CENTER, guiWidth - 10.0f); // calculate slots to draw based on page info size_t startIdx = currentPage * slotsPerPage; size_t stopIdx = startIdx + slotsPerPage; size_t nSlots = slots.size(); if (stopIdx > nSlots) stopIdx = nSlots; if ((startIdx+1) > nSlots) startIdx = nSlots - 1; // won't draw anyway if nSlots==0 // draw slots and items for (size_t n=startIdx; n<stopIdx; n++) { tcContainerSlot& slot = slots[n]; tcStoresContainerItem* item = dynamic_cast<tcStoresContainerItem*>(slot.GetItem()); bool isMouseOver = slot.IsMouseOver(); if (item) { int drawState = item->GetDrawState(); bool doDraw = (drawState == tcContainerItem::NORMAL) || ((drawState == tcContainerItem::BLINK) && blinkOn); boost::shared_ptr<tcGeometry> icon = slot.GetIcon(); DrawGeometryR(icon.get(), slot.loc.XCenter(), slot.loc.YCenter()); Vec4 color; if (!isMouseOver) color.set(0.6f, 0.6f, 0.6f, 1.0f); else color.set(1.0f, 1.0f, 1.0f, 1.0f); if (doDraw) { // draw quantity label DrawTextR(item->GetQuantityLabel(), slot.loc.GetRight() + 5.0f, slot.loc.GetTop() - 0.0f, defaultFont.get(), color, 12.0f, LEFT_BASE_LINE); // draw item name float left = slot.loc.GetRight() + 36.0f; float maxWidth = guiWidth - left - 10.0f; DrawTextR(item->GetItemName().c_str(), left, slot.loc.GetTop() - 0.0f, defaultFont.get(), color, 14.0f, LEFT_BASE_LINE, maxWidth); } // draw description caption if mouse is over slot //if (isMouseOver) //{ // const Vec4 color(1.0f, 1.0f, 1.0f, 1.0f); // float left = slot.loc.GetLeft(); // float maxWidth = guiWidth - left - 10.0f; // DrawTextR(item->GetItemName().c_str(), left, slot.loc.GetTop() + 15.0f, defaultFont.get(), // color, 14.0f, LEFT_BASE_LINE, maxWidth); //} // draw expanded rectangle for slot border tcRect r = slot.loc; r.Expand(1.0, 1.0); if (isMouseOver) { DrawRectangleR(r, Vec4(1, 1, 1, 1), tc3DWindow2::FILL_OFF); } else { DrawRectangleR(r, Vec4(0.5, 0.5, 0.5, 1), tc3DWindow2::FILL_OFF); } } } // draw page boxes for (size_t n=0; n<pageBoxes.size(); n++) { int fillMode = (n == currentPage) ? tc3DWindow2::FILL_ON : tc3DWindow2::FILL_OFF; Vec4 color(0.5, 0.5, 0.5, 0.5); if (n == mouseOverPage) color.set(1, 1, 1, 1); DrawRectangleR(pageBoxes[n], color, fillMode); } FinishDraw(); }
void Bar::Draw( void ) { double x = width / 2.0; double y = thickness / 2.0; double z = length / 2.0; if ( ! enabled ) return; PrepDraw(); // Consider the position to be the end of the bar, not the middle. glTranslated( 0.0, 0.0, z ); glBegin( GL_POLYGON ); glNormal3d( 0.0, 0.0, - 1.0 ); glVertex3d( - x, y, - z ); glVertex3d( - x, y, z ); glVertex3d( x, y, z ); glVertex3d( x, y, - z ); glEnd(); glBegin( GL_POLYGON ); glNormal3d( 0.0, 0.0, 1.0 ); glVertex3d( - x, - y, - z ); glVertex3d( x, - y, - z ); glVertex3d( x, - y, z ); glVertex3d( - x, - y, z ); glEnd(); if ( capped ) { glBegin( GL_POLYGON ); glNormal3d( 0.0, - 1.0, 0.0 ); glVertex3d( - x, - y, z ); glVertex3d( - x, y, z ); glVertex3d( x, y, z ); glVertex3d( x, - y, z ); glEnd(); glBegin( GL_POLYGON ); glNormal3d( 0.0, 1.0, 0.0 ); glVertex3d( - x, - y, - z ); glVertex3d( x, - y, - z ); glVertex3d( x, y, - z ); glVertex3d( - x, y, - z ); glEnd(); } glBegin( GL_POLYGON ); glNormal3d( - 1.0, 0.0, 0.0 ); glVertex3d( x, - y, - z ); glVertex3d( x, y, - z ); glVertex3d( x, y, z ); glVertex3d( x, - y, z ); glEnd(); glBegin( GL_POLYGON ); glNormal3d( 1.0, 0.0, 0.0 ); glVertex3d( - x, - y, - z ); glVertex3d( - x, - y, z ); glVertex3d( - x, y, z ); glVertex3d( - x, y, - z ); glEnd(); FinishDraw(); }