Draw a two-level rectangle on the screen
#include <Visual3d_Layer.hxx>
#include <V3d_LayerMgr.hxx>
#include <Visual3d_ViewManager.hxx>
#include "FTFont.h"
#include "FTGLBitmapFont.h"
Class V3d_textitem:public Visual3d_layeritem {public:
V3d_textitem (const Handle (visual3d_layer) & Thelayer);
void Redrawlayerprs ();
Private
Standard_real myX1;
Standard_real myY1;
Tcollection_asciistring MyText;
Standard_real Myheight;
Handle (Visual3d_layer) Mylayer;
Quantity_color MyColor;
Quantity_color Mysubtitlecolor;
Aspect_typeofdisplaytext MyType;
Tcollection_asciistring Myfontname;
};
V3d_textitem::v3d_textitem (const Handle (visual3d_layer) & Thelayer): Mylayer (Thelayer)
{
if (!mylayer.isnull ()) Mylayer->addlayeritem (this);
}
void V3d_textitem::redrawlayerprs ()
{
}
Interactive_context_->currentviewer ()->initactiveviews ();
Handle (v3d_view) V3d_view = Interactive_context_->currentviewer ()->activeview ();
Handle (visual3d_layer) Anoverlay = Interactive_context_->currentviewer ()->viewer ()->overlayer ();
if (Anoverlay.isnull ())
{
Handle (v3d_layermgr) amgr = new V3d_layermgr (V3d_view); Anoverlay = Amgr->overlay (); V3d_view->setlayermgr (amgr);
}
Anoverlay->begin ();
Anoverlay->drawrectangle (0, 0, 100, 100);
Anoverlay->end ();
A visual3d_layer associated with a v3d, first compiled into a display list, and then rendered.
To draw a two-dimensional rectangle in OCC