How to draw object in depth?

I want draw object in depth, but always in top.

void CTransformObj::DynamicDraw( HDC hdc, CRhinoViewport& vp, const ON_3dPoint& pt )
{
CRhinoDisplayPipeline* dp = vp.DisplayPipeline();
if( dp )
{
CDisplayPipelineMaterial mat;
tmp_mesh.Transform(m_xform);
dp->PushDepthTesting(true);
dp->PushDepthWriting(true);
dp->DrawShadedMesh(tmp_mesh,&mat);
dp->PopDepthTesting();
dp->PopDepthWriting();
}
CRhinoGetPoint::DynamicDraw( hdc, vp, pt );

}

Hi Riodass,

Dynamic drawing in CRhinoGetPoint was not designed for depth buffering. For speed, dynamic drawing routines only draw directly to the so called “front buffer” and are executed inside Rhino’s Overlay channel. The Overlay channel executes any time there are dynamic draw routines active, regardless of whether or not the frame buffer is updated (i.e. there was no middle ground processing whatsoever).

In order to draw anything shaded or depth buffered, it must happen inside the middle ground. And in order to do that, you must create a CRhinoDisplayConduit object that executes inside one of the middle ground channels. It’s most likely you will want to use the PostDrawObjects channel.

Does this help?

– Dale

Thanks dale.