Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

PsRenderer.h

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007         Adapted from
00008 
00009         Copyright (c) Mark J. Kilgard, 1997.
00010 
00011         This program is freely distributable without licensing fees
00012         and is provided without guarantee or warrantee expressed or
00013         implied. This program is -not- in the public domain.
00014 
00015         Example showing how to use OpenGL's feedback mode to capture
00016         transformed vertices and output them as Encapsulated PostScript.
00017         Handles limited hidden surface removal by sorting and does
00018         smooth shading (albeit limited due to PostScript).
00019 
00020     This library is free software; you can redistribute it and/or
00021     modify it under the terms of the GNU Lesser General Public
00022     License as published by the Free Software Foundation; either
00023     version 2.1 of the License, or (at your option) any later version.
00024 
00025     This library is distributed in the hope that it will be useful,
00026     but WITHOUT ANY WARRANTY; without even the implied warranty of
00027     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00028     Lesser General Public License for more details.
00029 
00030     You should have received a copy of the GNU Lesser General Public
00031     License along with this library; if not, write to the Free Software
00032     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00033 
00034     $Id:  $
00035 */
00036 
00037 
00038 #ifndef TEDDY__GRAPHICS__PS_RENDERER__H
00039 #define TEDDY__GRAPHICS__PS_RENDERER__H
00040 
00041 
00042 #include "Teddy/Graphics/Device.h"
00043 #include "Teddy/SysSupport/StdIO.h"
00044 
00045 
00046 namespace Teddy    {
00047 namespace Graphics {
00048 
00049 
00050 class PsRenderer {
00051     GLfloat m_PointSize;
00052 
00053 public:
00054     PsRenderer(){}
00055     ~PsRenderer(){}
00056 
00057 public:
00058     void writePs( char *pFilename, GLfloat *pFeedbackBuffer, int NbValues, bool sort );
00059 
00060 private:
00061     static int  compare             ( const void *a, const void *b );
00062     GLfloat    *spewPrimitiveEPS    ( FILE *file, GLfloat *loc );
00063     void        spewWireFrameEPS    ( FILE *file, bool     doSort, GLint    size, GLfloat *buffer );
00064     void        spewUnsortedFeedback( FILE *file, GLint    size,   GLfloat *buffer );
00065     void        spewSortedFeedback  ( FILE *file, GLint    size,   GLfloat *buffer );
00066 };
00067 
00068 struct DepthIndex {
00069     GLfloat *ptr;
00070     GLfloat  depth;
00071 };
00072 
00073 
00074 };  //  namespace Graphics
00075 };  //  namespace Teddy
00076 
00077 
00078 #endif  //  TEDDY__GRAPHICS__VIEW_PS__H
00079