Discussion:
[vtkusers] Rendering and refreshing windowRender in C#
Lucy
2018-11-21 10:28:47 UTC
Permalink
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
Todd Martin via vtkusers
2018-11-22 00:06:43 UTC
Permalink
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 <***@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

Loading...