Search code examples
windowsopenglcadmetafile

Is there an efficient way to convert a3d scene to a 2d Enhanced Metafile


I am developing a CAD application using Delphi2010 and OpenGL. Currently, i am working on a module to export the current view to an Image file.

This is pretty straigthforward for raster formats (render scene to offscreen Buffer of desired Dimensions, write buffer to disk), but I also wish to be able to export an axis-aligned 2d-View of my scene to a vector format, preferably Winows EMF.

I was thinking about calculating my transformations and projection in software, or misuse glFeedback functionality. Since i would have to implement my own z-buffering, this approach seems to be rather laborious, not to mention the performance issues i might face rendering a complex scene without hardware acceleration.

Since my Google-fu did not lead to a result, i want to ask if anyone of you has experience with this problem (convert Opengl-3d-scene to 2d-Vectorimage), or if there is any 3rd-party library known to implement this.


Solution

  • This is a very hard task, it involves analytical hidden lines removal, polygon splitting and Z-sorting for final output as explained here: http://www.cs.drexel.edu/~david/Classes/CS430/HWs/p214-weiler.pdf