[vtkusers] How to enable capping for Cone ?

kenichiro yoshimi rccm.kyoshimi at gmail.com
Sat Jun 24 03:33:10 EDT 2017


Hi Girish,

Rendering translucent geometry is incorrectly done.  Would you see if
the following helps?
https://lorensen.github.io/VTKExamples/site/Cxx/Visualization/CorrectlyRenderTranslucentGeometry/

Thanks,
yoshimi

2017-06-23 19:24 GMT+09:00 Girish Lande <girish.lande at agiliad.com>:
> Hi Experts,
>
> I am trying to draw Cone with its base closed.
> For that I am calling CappingOn() function provided for same.
> But it doesn't seem to work. I can't think of what can be missing here.
>
> Following is my code.
>
>
> #include "stdafx.h"
>
> #include <vtkAutoInit.h>
> VTK_MODULE_INIT(vtkRenderingOpenGL2)
> VTK_MODULE_INIT(vtkRenderingFreeType);
>
> #include <vtkConeSource.h>
> #include <vtkPolyData.h>
> #include <vtkSmartPointer.h>
> #include <vtkPolyDataMapper.h>
> #include <vtkActor.h>
> #include <vtkRenderWindow.h>
> #include <vtkRenderer.h>
> #include <vtkRenderWindowInteractor.h>
> #include <vtkInteractorStyleTrackballCamera.h>
> #include <vtkProperty.h>
>
> int main(int, char *[])
> {
> //Create a cone
> vtkSmartPointer<vtkConeSource> coneSource =
> vtkSmartPointer<vtkConeSource>::New();
> coneSource->SetResolution(100);
> coneSource->SetCapping(true);
> coneSource->Update();
>
> //Create a mapper and actor
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInputConnection(coneSource->GetOutputPort());
>
> vtkSmartPointer<vtkActor> actor =
> vtkSmartPointer<vtkActor>::New();
> actor->SetMapper(mapper);
> actor->GetProperty()->SetOpacity(0.5);
>
> //Create a renderer, render window, and interactor
> vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New();
> vtkSmartPointer<vtkRenderWindow> renderWindow =
> vtkSmartPointer<vtkRenderWindow>::New();
> renderWindow->AddRenderer(renderer);
> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
> vtkSmartPointer<vtkRenderWindowInteractor>::New();
> renderWindowInteractor->SetRenderWindow(renderWindow);
>
> //Add the actors to the scene
> renderer->AddActor(actor);
>
> vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
> vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
> renderWindowInteractor->SetInteractorStyle(style);
>
>
> //Render and interact
> renderWindow->SetSize(800, 800);
> renderWindow->Render();
> renderWindowInteractor->Start();
>
> return EXIT_SUCCESS;
> }
>
>
>
>
> --
> thanks & regards,
> Girish
>
>
> -------------------------------------------------------------------------------------------------------------------------
> Disclaimer: This email message including any attachments is confidential,
> and may be privileged and proprietary to Agiliad. If you are not the
> intended recipient, please notify us immediately by replying to this message
> and destroy all copies of this message including any attachments. You are
> NOT authorized to read, print, retain, copy, disseminate, distribute, or use
> this message or any part thereof. Thank you.
> ------------------------------------------------------------------------------------------------------------------------
> _______________________________________________
> 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:
> http://public.kitware.com/mailman/listinfo/vtkusers
>


More information about the vtkusers mailing list