[vtkusers] How to convert vtkWin32OpenGLRenderWindow to image file!

sudeep M. Hooli Sudeep.Hooli at quest-global.com
Mon Apr 25 22:50:20 EDT 2005


Hi all,
            I am new to VTK. I am trying to convert the
vtkWin32OpenGLRenderWindow to an image file. 
            I have written the following code in VC++. When I execute
the code, memory error will occur.
If I go for converting vtkRenderWindow with the same code it works fine.
 
Please guide me about this.
 
Code is as follows:
 
int*   size   = this->renWin->GetSize();
 
            //Setup memory rendering
            this->renWin->SetupMemoryRendering( size[0], size[1],
this->GetDC()->m_hAttribDC);
            this->renWin->Render();
 
            vtkWindowToImageFilter * ImageFilter  =
vtkWindowToImageFilter::New();
            ImageFilter->SetInput(this->renWin);
            ImageFilter->Update();
 
            vtkBMPWriter* bmpWriter=vtkBMPWriter::New();
            bmpWriter->SetInput(ImageFilter->GetOutput());
            bmpWriter->SetFileName("c:\\image.bmp");
            bmpWriter->Write();
 
            ImageFilter->Delete();
            bmpWriter->Delete();
            this->renWin->ResumeScreenRendering();
 
            in above code "renWin" is an instance of
vtkWin32OpenGLRenderWindow.
 
            Thanks in advance,
 
Regards,
Sudeep.
 
 
 
 
  
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050426/5bb6d36f/attachment.htm>


More information about the vtkusers mailing list