70000103 Change and restore RenderMode Between vdRender StartDraw and EndDraw

Article 70000103
Type Wish
Product Engine
Version 7001
Date Added 10/11/2014
Fixed (10/11/2014)
Submitted by Monoyios O. Demetris

Summary

How can I change and then restoreback the RenderMode between vdRender StartDraw and EndDraw ?

Solution

Added in version 7002

For example draw a box in Wire3d mode regardless of active RenderMode

        doc.OnDraw += new vdDocument.DrawEventHandler(doc_OnDraw);
        vdPolyface pf = new vdPolyface(doc);
        pf.CreateBox(render.View2Worldmatrix.Transform(render.ViewCenter), render.ViewSize * 0.5, render.ViewSize * 0.5, render.ViewSize * 0.5, 0);

        void doc_OnDraw(object sender, vdRender render, ref bool cancel)
        {
            vdRender.Mode rm = render.RenderMode;
            render.RenderMode = vdRender.Mode.Wire3d;
            render.PushPenstyle(Color.LightGray,0.01);
            
            render.DrawPolyface(null, pf.FaceList, pf.VertexList);
            render.PopPenstyle();

            render.RenderMode = rm;
        }

Send comments on this topic.