[vtkusers] creating a texture costs extra 30MB memory, pls advise me
Tracy Hu
tracy.hu at yahoo.com
Fri Feb 20 15:16:36 EST 2009
I wrote simple code as following to decide how much memory a vtkTexture would result.
without using texture (by commenting out the line "actor->SetTexture(pTexture)" ), the process takes 74MB memory,
using texture(by uncommenting the line "actor->SetTexture(pTexture)" ), the process takes 105MB memory.
the dimension of picture FOREST011.jpg is 11083 X 823, and takes 1,015KB
Can somebody give me any idea what's going on, or how to avoid this memory expense?
thanks a lot
Tracy
int main_vtk(int argc, char* argv[])
{
vtkJPEGReader* pJPEGReader = vtkJPEGReader::New();
pJPEGReader->SetFileName("D:\\FOREST011.jpg");
pJPEGReader->ReleaseDataFlagOn();
vtkTexture* pTexture = vtkTexture::New();
pTexture->SetInputConnection(pJPEGReader->GetOutputPort());
pTexture->InterpolateOn();
pTexture->ReleaseDataFlagOn();
pJPEGReader->Delete();
vtkSphereSource *sphere = vtkSphereSource::New();
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInputConnection(sphere->GetOutputPort());
mapper->ScalarVisibilityOff();
vtkActor *actor = vtkActor::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(0.0, 0.0, 1.0);
actor->SetTexture(pTexture);
vtkRenderer* ren = vtkRenderer::New();
ren->SetBackground(1, 1, 1);
ren->AddActor(actor);
vtkRenderWindow* renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren);
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();
iren->SetInteractorStyle(style);
renWin->SetSize(600,600);
renWin->SetPosition(600, 100);
renWin->Render();
iren->Initialize();
iren->Start();
return 0;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090220/bc63e112/attachment.htm>
More information about the vtkusers
mailing list