Hello ,
Is there an easy way to draw a 3D rectangle and specify its color and dimensions.
I have seen the following but could not get it to work. I do not think I am doing the right thing
Box3D Box1 = new Box3D(new Vector3D(200, 200, 200), new Vector3D(400, 400, 400));
smgr.VideoDriver.Draw3DBox(Box1, new Color(100, 0, 255, 255));
3D box or cube Basic question
The code you've written should display a wireframe representing the box, but you need to set the world transformation and the material before you draw it. In C++ the code would look something like this...
Travis
Code: Select all
const core::aabbox3df box(-10, -10, -10, 10, 10, 10);
// transformation matrix
core::matrix4 matrix;
matrix.setTranslation(core::vector3df(20, 20, 20));
// material that ignores lighting
video::SMaterial material;
material.Lighting = false;
while (device->run())
{
if (driver->beginScene(true, true, video::SColor(255, 100, 100, 100))
{
// render the scene
smgr->drawAll();
// render the gui
gui->drawAll();
// begin render the box
driver->setTransform(video::ETS_WORLD, matrix);
driver->setMaterial(material);
driver->draw3DBox(box, video::SColor(255, 0, 255, 255));
// end rendering box
driver->endScene();
}
}
device->drop();