[vtkusers] questions on vtk in win32

Roland Schwarz roland.schwarz at chello.at
Tue Mar 12 14:00:42 EST 2002


What I've found out so far:

The example, showing MFC binding simply seems to be outdated.

You can get rid of the access violatins the following way:

In the destructor of
SampleView release the resources:

CSampleView::~CSampleView()
{
    vtkPropCollection *propc;
    vtkProp *prop;
    propc = this->Renderer->GetProps();
    propc->InitTraversal();
    while (prop = propc->GetNextProp()) {
        this->Renderer->RemoveProp(prop);
    }
}

I think an even better place would be in the handler of the WM_DESTROY
message,
since releasing the resources might access the Window handle, which normally
has gone
when the destuctor is seen.

The problem is, that you may not destroy
vtkRenderer, vtkRenderInteractor and vtkRenderWindow without releasing its
graphic resources.
The above code will do just that.

If you do not do it like above, the release of the graphic resources is
delayed (glDisplayLists in this case)
is delayed until you destroy the mapper object, which is in the scope of
SampleDoc.
When you later try to destroy SampleDoc, the Window (which has long gone
away at this stage) is
needed again and a crash is the result.

I am not quite sure what would be the best practice. I just yet ordered a
copy of the User Manual,
hopefully getting more insight into the intende correct usage of the
objects.

However I'll try to post a overhauled version of the example if some one is
interested in this.
( I would like some vtk-insider having some comments on this. )


> And what is the function of "ALL_Build" in each folder generated bu CMak?
> When I build the win32SampleMfc project generated by Cmake (using cmake in
this example alone ), there is  "Performing Custom Build Step on ALL_BUILD"
and never stop and response again.
>

When the project consists of subprojects (as is the case with VTK library)
Setting ALL_BUILD as the current project
and starting a rebuild will compile complete library.

Roland







More information about the vtkusers mailing list