[vtkusers] Rendering and refreshing windowRender in C#

Lucy matusikova.lucia at gmail.com
Wed Nov 21 05:28:47 EST 2018


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


More information about the vtkusers mailing list