Thomas, in case it will not work (i think that the Dump method requires an actual visible window, without researching further) you can try to use the Aspect_PixMap class.
Code snippet: void ToPixMap(AnsiString Filename, int width, int height) { Handle(Aspect_PixMap) aPixMap = myView->ToPixMap(width,height); aPixMap->Dump(Filename.c_str(),1.); } Fotis On Wed, Dec 9, 2009 at 12:45 PM, Thomas Paviot <tpav...@gmail.com> wrote: > The screenshot OCC feature is implemented in the V3d_View class (the Dump > method). Below is copied/pasted the part of the V3d_View.hxx header that > defines the prototype for this method: > > //! dump the full contents of the view with a <br> > > //! different scale according to the required sheet <br> > //! paper size (format) and the ratio <br> > //! width/height of the view. <br> > //! and returns FALSE when the dump has failed <br> > > //! Warning : the file name extension must be one of <br> > //! ".xwd",".gif",".bmp" both on UNIX or WNT <br> > //! but make becarefull about the time to dump and <br> > > //! resulting file size especially for the A0 format, <br> > //! GIF format generates very small <br> > //! files, BMP and XWD generates big files <br> > //! (4 to 6 times more than GIF). <br> > > //! Time to generates the files is very short with XWD <br> > //! files and 2 or 4 times more for other format. <br> > //! NOTE that you can use after any standard system utility <br> > > //! for editing or sending the image file to a laser printer. <br> > //! (i.e: Microsoft Photo Editor on Windows system <br> > //! or Image Viewer on SUN system) <br> > Standard_EXPORT Standard_Boolean Dump(const Standard_CString aFile,const > Aspect_FormatOfSheetPaper aFormat) ; > > > This is how is implemented the display in pythonOCC (Display3d.cpp file): > > // Create V3dViewer and V3d_View > myV3dViewer = new V3d_Viewer( gd , (short* const)"viewer" ); > printf("Viewer created.\n"); > myV3dViewer->Init(); > myV3dViewer->SetDefaultLights(); > myV3dViewer->SetLightOn(); > myV3dView = myV3dViewer->CreateView(); > myV3dView->SetWindow(myWindow); > > To be created, a V3d_View just requires that the graphic Device is > initialized. The last line ( myV3dView->SetWindow(myWindow);) just tells > that the view should be rendered in myWindow. > > So here is my answer to your question: it might be possible to create a > 'screenshot' (or an OpenGL dump actually) to a file without any X window, by > only creating a graphic device, V3d_Viewer and V3d_View. It's just has to be > tested, which I'm going to do right now. > > Thomas > > 2009/12/9 Simon Loic <simon1l...@gmail.com> > > Good point, although generating the web page for the samples won't be an >> every day activity. >> Normally, it's possible to achieve off-screen rendering with openGL. As >> for pythonOCC, OCC (that use openGL eventually) I don't know if this option >> is available. Tomas will surely know more about it. >> Loïc >> >> >> On Wed, Dec 9, 2009 at 12:19 AM, Bryan Bishop <kanz...@gmail.com> wrote: >> >>> On Tue, Dec 8, 2009 at 5:12 PM, Simon Loic wrote: >>> > One other question remains, how to automatically create screenshots for >>> all >>> > the samples? Shall we add a new function in every sample (eg >>> > CreateScreenShots) ? >>> >>> Does anyone know how to do this *without* requiring X to be installed >>> and running? Right now the screenshot functions require the window to >>> be open, and if you switch to something else while the screenshot is >>> being taken, that other window will be in the way in the saved >>> screenshot. Thanks. >>> >>> - Bryan >>> http://heybryan.org/ >>> 1 512 203 0507 >>> >>> _______________________________________________ >>> Pythonocc-users mailing list >>> Pythonocc-users@gna.org >>> https://mail.gna.org/listinfo/pythonocc-users >>> >> >> >> _______________________________________________ >> Pythonocc-users mailing list >> Pythonocc-users@gna.org >> https://mail.gna.org/listinfo/pythonocc-users >> >> > > _______________________________________________ > Pythonocc-users mailing list > Pythonocc-users@gna.org > https://mail.gna.org/listinfo/pythonocc-users > >
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users