[vtkusers] Rendering and refreshing windowRender in C#

Todd Martin nztoddler at yahoo.com
Wed Nov 21 19:06:43 EST 2018


Hi Lucy 

Try this
 private void MarchingCubes()
{
              marching cubes code ..... 

              renderer.ResetCamera();
              renderWindowControl1.Invalidate();}

Todd Martin, PhD.
Freelance Engineer/Software Architect.
 

    On Wednesday, 21 November 2018, 11:28:54 PM NZDT, Lucy <matusikova.lucia at gmail.com> wrote:  
 
 Hi, 

I created application in C#, that contains renderWindowControl, some
trackbars to set parameters for Marching cubes algorithm and button to
apply. 
After running the app, window will appear, but nothing will be rendered and
after setting parameters, the original window closes, new opens and nothing
happens.

How to render output from polyDataMapper?And how do i update renderwindow so
that it can view change (after setting parameters) in real time?

---- code ----
        public Form1()
        {
            InitializeComponent();
        }

        public void renderWindowControl1_Load(object sender, EventArgs e)
        {
            try
            {
                MarchingCubes();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Exception",
MessageBoxButtons.OK);
            }
        }

        private void applyButton_Click(object sender, EventArgs e)
        {
            MarchingCubes();
        }

        private void MarchingCubes()
        {
              marching cubes code ..... 


            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection(surface.GetOutputPort());
            mapper.ScalarVisibilityOff(); 
            vtkActor actor = vtkActor.New();
            actor.SetMapper(mapper);

            vtkRenderWindow renderWindow =
renderWindowControl1.RenderWindow;
            vtkRenderer renderer =
renderWindow.GetRenderers().GetFirstRenderer();
            renderer.SetBackground(0, 0, 0);
            renderer.AddActor(actor);
        }

Thanks, 
Lucy




--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/vtkusers
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20181122/18132c49/attachment.html>


More information about the vtkusers mailing list