<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><style></style><div><font size="2" face="Arial">thanks a lot for help. But is there anyway at all
to use the same picture for texture, but reduce the memory cost? perhaps at the
cost of slower rendering?</font></div>
<div><font size="2" face="Arial"></font> </div>
<div><font size="2" face="Arial">thanks<br><br>tracy<br><br><br><br></font><pre>Assuming your image is one component and a component takes one byte:<br>11083x823/1024/1024=8.7MB.<br>If you have three components (RGB), this is 26.1MB (close to 30MB).<br><br>So, I guess your 1015KB is actually the size of the compressed jpg file...<br><br><br>On Fri, Feb 20, 2009 at 3:16 PM, Tracy Hu <<a href="http://www.vtk.org/mailman/listinfo/vtkusers">tracy.hu at yahoo.com</a>> wrote:<br>><i> I wrote simple code as following to decide how much memory a vtkTexture<br></i>><i> would result.<br></i>><i> without using texture (by commenting out the line<br></i>><i> "actor->SetTexture(pTexture)" ), the process takes 74MB memory,<br></i>><i> using texture(by uncommenting the line "actor->SetTexture(pTexture)" ), the<br></i>><i> process takes 105MB memory.<br></i>><i> the dimension of picture FOREST011.jpg is 11083 X 823, and takes
1,015KB<br></i>><i><br></i>><i> Can somebody give me any idea what's going on, or how to avoid this memory<br></i>><i> expense?<br></i>><i><br></i>><i> thanks a lot<br></i>><i> Tracy<br></i>><i><br></i>><i> int main_vtk(int argc, char* argv[])<br></i>><i> {<br></i>><i> vtkJPEGReader* pJPEGReader = vtkJPEGReader::New();<br></i>><i> pJPEGReader->SetFileName("D:\\FOREST011.jpg");<br></i>><i> pJPEGReader->ReleaseDataFlagOn();<br></i>><i> vtkTexture* pTexture = vtkTexture::New();<br></i>><i> pTexture->SetInputConnection(pJPEGReader->GetOutputPort());<br></i>><i> pTexture->InterpolateOn();<br></i>><i> pTexture->ReleaseDataFlagOn();<br></i>><i> pJPEGReader->Delete();<br></i>><i><br></i>><i> vtkSphereSource *sphere = vtkSphereSource::New();<br></i>><i> vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();<br></i>><i>
mapper->SetInputConnection(sphere->GetOutputPort());<br></i>><i> mapper->ScalarVisibilityOff();<br></i>><i> vtkActor *actor = vtkActor::New();<br></i>><i> actor->SetMapper(mapper);<br></i>><i> actor->GetProperty()->SetColor(0.0, 0.0, 1.0);<br></i>><i> actor->SetTexture(pTexture);<br></i>><i><br></i>><i> vtkRenderer* ren = vtkRenderer::New();<br></i>><i> ren->SetBackground(1, 1, 1);<br></i>><i> ren->AddActor(actor);<br></i>><i><br></i>><i> vtkRenderWindow* renWin = vtkRenderWindow::New();<br></i>><i> renWin->AddRenderer(ren);<br></i>><i><br></i>><i> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<br></i>><i> iren->SetRenderWindow(renWin);<br></i>><i> vtkInteractorStyleTrackballCamera *style =<br></i>><i> vtkInteractorStyleTrackballCamera::New();<br></i>><i>
iren->SetInteractorStyle(style);<br></i>><i><br></i>><i> renWin->SetSize(600,600);<br></i>><i> renWin->SetPosition(600, 100);<br></i>><i> renWin->Render();<br></i>><i><br></i>><i> iren->Initialize();<br></i>><i> iren->Start();<br></i>><i><br></i>><i> return 0;<br></i>><i> }<br></i>><i><br></i>><i><br></i>><i><br></i>><i> _______________________________________________<br></i>><i> Powered by www.kitware.com<br></i>><i><br></i>><i> Visit other Kitware open-source projects at<br></i>><i> <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br></i>><i><br></i>><i> Please keep messages on-topic and check the VTK FAQ at:<br></i>><i> <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br></i>><i><br></i>><i> Follow this link to
subscribe/unsubscribe:<br></i>><i> <a href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a><br></i>><i><br></i>><i><br></i><br><br><br>-- <br>François Bertel, PhD | Kitware Inc. Suite 204<br>1 (518) 371 3971 x113 | 28 Corporate Drive<br> | Clifton Park NY 12065, USA<br></pre>
<!--endarticle-->
<br></div></td></tr></table><br>