[vtkusers] Second Try: Big performance hit when window gets too big
Sean McInerney
seanm at nmr.mgh.harvard.edu
Tue Sep 28 14:37:30 EDT 2004
Hi Dave,
I did a little testing with your included code on an old UltraSparc
running at 440MHz with only about 16M of video memory. I even added some
geometry to each window with about 32896 points each (with normals) ...
... no problems ... (FYI modified code and CMakeLists.txt is attached)
Blame DirectDraw and burn your Windows license.
-Sean
David Edwards wrote:
> Hi,
>
> I really need to get an answer to this question, so I'm posting it again:
> I've got a VTK-heavy commercial program we're trying to get out the
> door, but we've hit a show-stopper performance problem. When we open too
> many windows (sometimes as few as 3), the performance slows to a crawl.
>
> I've simplified the problem in the following code. This makes 6 windows
> with single renderers and displays them. That's all. No actors.
> * If you set SIZE to a small number like 100, you can grab and pan the
> windows with no performance hit.
> * If you set SIZE to a larger number (for my system, it is 800), panning
> any window is VERY slow.
>
> Since this is directly related to the window size, I'm wondering if the
> video memory is filling up, causing page faults, but querying the video
> memory (using direct draw) shows there's plenty of memory left.
>
> Many thanks in advance for your help on this pressing problem.
>
> - David Edwards
> Rigaku/MSC
> Orem Utah
>
> Here's the example code:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> // First include the required header files for the VTK classes we are
> using.
> #include "vtkConeSource.h"
> #include "vtkRenderWindow.h"
> #include "vtkRenderer.h"
> #include "vtkRenderWindowInteractor.h"
> // DirectDraw include
> // NOTE: Also must link ddraw.lib and dxguid.lib
> #include "ddraw.h"
>
> #define SIZE 800
>
> vtkRenderWindow* NewRenderWindow()
> {
> vtkRenderer *ren= vtkRenderer::New();
> ren->SetBackground( 0.1, 0.2, 0.4 );
>
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer( ren );
> renWin->SetSize( SIZE, SIZE );
> return renWin;
> }
>
> void PrintVideoMemory()
> {
> LPDIRECTDRAW lpDD ;
> DirectDrawCreate(NULL, &lpDD, NULL);
> LPDIRECTDRAW2 lpDD2;
> DDSCAPS ddsCaps;
> DWORD dwTotal;
> DWORD dwFree;
> lpDD->QueryInterface(IID_IDirectDraw2, (void**)&lpDD2);
> ZeroMemory(&ddsCaps, sizeof(ddsCaps)); // Initialize the structure
> ddsCaps.dwCaps = DDSCAPS_TEXTURE;
> lpDD2->GetAvailableVidMem(&ddsCaps, &dwTotal, &dwFree);
> // Print the free and total memory
> printf("FREE: %d TOTAL: %d\n",dwFree,dwTotal);
> }
>
> // Make 6 render windows (with single renderers) to test performance hit
> // when the windows get to be over a certain size.
> int main( int argc, char *argv[] )
> {
> PrintVideoMemory();
> vtkRenderWindow* renWin = NewRenderWindow();
> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
>
> for( int i=0; i<5; i++ ) {
> renWin = NewRenderWindow();
> renWin->Render();
> PrintVideoMemory();
> }
>
> iren->Initialize();
> iren->Start();
>
> return 0;
> }
>
>
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on-topic.
> Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040928/9df80911/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vtktest.cxx
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040928/9df80911/attachment.asc>
More information about the vtkusers
mailing list