<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I wrote simple code as following to decide how much memory a vtkTexture would result. <br>without using texture (by commenting out the line "actor->SetTexture(pTexture)" ), the process takes 74MB memory, <br>using texture(by uncommenting the line "actor->SetTexture(pTexture)" ), the process takes 105MB memory.<br>the dimension of picture FOREST011.jpg is 11083 X 823, and takes 1,015KB<br><br>Can somebody give me any idea what's going on, or how to avoid this memory expense?<br><br>thanks a lot<br>Tracy<br><br>int main_vtk(int argc, char* argv[])<br>{<br> vtkJPEGReader* pJPEGReader = vtkJPEGReader::New();<br> pJPEGReader->SetFileName("D:\\FOREST011.jpg");<br> pJPEGReader->ReleaseDataFlagOn();<br> vtkTexture* pTexture =
vtkTexture::New();<br> pTexture->SetInputConnection(pJPEGReader->GetOutputPort());<br> pTexture->InterpolateOn();<br> pTexture->ReleaseDataFlagOn();<br> pJPEGReader->Delete();<br><br> vtkSphereSource *sphere = vtkSphereSource::New();<br> vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br> mapper->SetInputConnection(sphere->GetOutputPort());<br> mapper->ScalarVisibilityOff();<br> vtkActor *actor = vtkActor::New();<br> actor->SetMapper(mapper);<br> actor->GetProperty()->SetColor(0.0, 0.0, 1.0);<br> actor->SetTexture(pTexture);<br>
<br> vtkRenderer* ren = vtkRenderer::New();<br> ren->SetBackground(1, 1, 1);<br> ren->AddActor(actor);<br><br> vtkRenderWindow* renWin = vtkRenderWindow::New();<br> renWin->AddRenderer(ren);<br><br> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<br> iren->SetRenderWindow(renWin);<br> vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<br> iren->SetInteractorStyle(style);<br> <br> renWin->SetSize(600,600);<br> renWin->SetPosition(600, 100);<br> renWin->Render();<br><br> iren->Initialize();<br>
iren->Start();<br> <br> return 0;<br>}<br><br></td></tr></table><br>