Boxes.

 

Let's create two boxes.

 

The first one with side lengths:

1 on the X axis,

2 on the Y axis,

2.1 on the Z axis,

 

The vertex of the first box will be in the coordinates origin and will have the color number 8 from the palette:

sgCBox* bx1 = sgCreateBox(1,2,2.1);

sgGetScene()->AttachObject(bx1);

bx1->SetAttribute(SG_OA_COLOR,8);

 

The second box with side lengths:

1 on the X axis,

1 on the Y axis,

1 on the Z axis,

 

The color of the second box will be number 0, line thickness and type will be 1, the means of drawing - a wireframe.

Let's move the vertex of the second box to the (1.5, 0, 0) point

sgCBox* bx2 = sgCreateBox(1,1,1);

SG_VECTOR transV = {1.5,0,0};

bx2->InitTempMatrix()->Translate(transV);

bx2->ApplyTempMatrix();

bx2->DestroyTempMatrix();

sgGetScene()->AttachObject(bx2);

bx2->SetAttribute(SG_OA_COLOR,0);

bx2->SetAttribute(SG_OA_LINE_THICKNESS,1);

bx2->SetAttribute(SG_OA_LINE_TYPE,1);

bx2->SetAttribute(SG_OA_DRAW_STATE,SG_DS_FRAME);

 

See also:

sgCBox   sgCBox::Create

sgCObject::InitTempMatrix sgCMatrix::Translate   sgCObject::ApplyTempMatrix   SgCObject::DestroyTempMatrix   sgGetScene sgCScene::AttachObject   sgCObject::SetAttribute

 

Illustration:

boxes