Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

Screen.H

Go to the documentation of this file.
00001 
00015 #ifndef _SCREEN_H_
00016 #define _SCREEN_H_
00017 
00018 #include <GL/gl.h>
00019 #include <Rect.H>
00020 #include <xstl.H>
00021 
00022 namespace xchen
00023 {
00024   class Screen 
00025   {
00026   public:
00027       static void Init(const string fname) { imageName = fname; glPixelStorei(GL_PACK_ALIGNMENT, 1); }
00028 
00029       static void SetSize(int w, int h);
00030       static int GetWidth()                  { return width; }
00031       static int GetHeight()                 { return height; }
00032 
00033       static void SaveImage(const GLViewPort& vp, const char* fname=0);       
00034       static void SaveImage(const char* fname=0, int sx=0, int sy=0, int w=0, int h=0);
00035 
00036   public:
00037       static void glut_reshape_cb(int w, int h)  { SetSize(w,h); }  
00038 
00039   private:
00040       static string imageName;
00041       static int width, height;
00042   };
00043 
00044   inline void Screen :: SaveImage(const GLViewPort& vp, const char* fname)
00045   {
00046     SaveImage(fname, vp.StartX(), vp.StartY(), vp.Width(), vp.Height()); 
00047   }
00048 }
00049 #endif
00050 
00051 
00052 

Generated on Wed Apr 7 21:40:49 2004 by doxygen1.2.18