[vtkusers] using vtk3DSImporter with C++
beth at portugalmail.pt
beth at portugalmail.pt
Fri Sep 29 08:40:54 EDT 2006
Hi,
I'm trying to create a conversor from 3D Studio format to VTK format file.
To start, I picked the sample code in:
/Examples/IO/Python/flamingo.py (vtk Examples)
and translated it to C++.
I compiled it, and no errors at all.
The problem is in execution time. I received these 2 errors:
unresolved external symbol "__declspec(dllimport) public: static class
vtkRenderLargeImage * __cdecl vtkRenderLargeImage::New(void)" (__imp_?
New at vtkRenderLargeImage@@SAPAV1 at XZ)
Conversor.obj : error LNK2001: unresolved external symbol "__declspec
(dllimport) public: static class vtk3DSImporter * __cdecl vtk3DSImporter::New
(void)" (__imp_?New at vtk3DSImporter@@SAPAV1 at XZ)
both classes - vtk3DSImporter and vtkRenderLargeImage can't be found in run
time.
My CMakeList file looks like this:
------------------------------------
PROJECT (Conversor)
FIND_PACKAGE(VTK REQUIRED)
IF(NOT VTK_USE_RENDERING)
MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires VTK_USE_RENDERING.")
ENDIF(NOT VTK_USE_RENDERING)
INCLUDE(${VTK_USE_FILE})
ADD_EXECUTABLE(conversor conversor.cxx)
TARGET_LINK_LIBRARIES(conversor vtkRendering)
---------------------------------------
My C++ code looks like this:
-----------------------------------------
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtk3DSImporter.h"
#include "vtkRenderLargeImage.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkPNGWriter.h"
#include "vtkCamera.h"
int main( int argc, char *argv[] )
{
// We'll import some data to start. Since we are using an importer,
// we've got to give it a render window and such. Note that the render
// window size is set fairly small.
vtkRenderer *ren = vtkRenderer::New();
ren->SetBackground(0.1, 0.2, 0.4);
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren);
renWin->SetSize(125, 125);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtk3DSImporter *importer = vtk3DSImporter::New();
importer->SetRenderWindow(renWin);
importer->SetFileName("$VTK_DATA_ROOT/Data/Viewpoint/iflamigm.3ds");
importer->ComputeNormalsOn();
importer->Read();
// We'll set up the view we want.
ren->GetActiveCamera()->SetPosition(0, 1, 0);
ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);
ren->GetActiveCamera()->SetViewUp(0, 0, 1);
// Let the renderer compute a good position and focal point.
ren->ResetCamera();
ren->GetActiveCamera()->Dolly(1.4);
ren->ResetCameraClippingRange();
vtkRenderLargeImage *renderLarge = vtkRenderLargeImage::New();
renderLarge->SetInput(ren);
renderLarge->SetMagnification(4);
// We write out the image which causes the rendering to occur. If you
// watch your screen you might see the pieces being rendered right
// after one another.
vtkPNGWriter *writer = vtkPNGWriter::New();
writer->SetInputConnection(renderLarge->GetOutputPort());
writer->SetFileName("largeImage.png");
writer->Write();
// interact with data
iren->Initialize();
renWin->Render();
iren->Start();
// Clean up
ren->Delete();
renWin->Delete();
iren->Delete();
renderLarge->Delete();
importer->Delete();
writer->Delete();
return 0;
}
------------------------------------------------------
What should I do?
Thanks for any help...
Best regards,
Elizabeth
__________________________________________________________
Porque insiste em pagar o dobro?
Compare o preço da sua ligação à Internet
http://acesso.portugalmail.pt/maisbarato
More information about the vtkusers
mailing list