00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * 00008 * Mark Alexander 00009 * Side Effects 00010 * 123 Front Street West, Suite 1401 00011 * Toronto, Ontario 00012 * Canada M5J 2M2 00013 * 416-504-9876 00014 * 00015 * NAME: RE_RasterWindow.h 00016 * 00017 * COMMENTS: 00018 * Allows for easy OpenGL rendering to a raster. This is a 00019 * convenience class that combines all the elements required. To use: 00020 * 00021 * RE_RasterWindow capture; 00022 * PXL_Raster *image; 00023 * 00024 * capture.begin(40, 40); 00025 * // render a bunch of stuff in OGL to (0,0)->(39,39) 00026 * image = capture.end(); 00027 * 00028 */ 00029 #ifndef RE_RASTER_WINDOW_H 00030 #define RE_RASTER_WINDOW_H 00031 00032 class PXL_Raster; 00033 class RE_Render; 00034 00035 #include "RE_API.h" 00036 #include "RE_Types.h" 00037 #include <PXL/PXL_Raster.h> 00038 00039 class re_PBuffer; 00040 00041 class RE_API RE_RasterWindow 00042 { 00043 public: 00044 RE_RasterWindow(); 00045 ~RE_RasterWindow(); 00046 00047 // After calling begin() to initialize your drawing area, start 00048 // drawing using OpenGL to the area (0, 0) - (w-1, h-1). Returns NULL if 00049 // it is not possible to open a offscreen rendering area matching the type 00050 // specified. 00051 00052 // Be sure to use the RE_Render * passed back from begin() until 00053 // end() is called. Note that 'type' determines the data format for the 00054 // raster returned in end(), and not the format of the window. 00055 // 00056 RE_Render *begin(RE_Render *r, int w, int h, 00057 PXL_DataFormat type = PXL_INT8, 00058 bool alphatoo = true, 00059 bool zbuffer = false, 00060 bool stencil = false); 00061 00062 // The raster will remain empty until end() is called. begin() and end() 00063 // must always be paired. This performs a GL wait, so you don't have to 00064 // flush or wait. You are responsible for ownership of the raster. 00065 // 00066 PXL_Raster *end(); 00067 00068 private: 00069 re_PBuffer *myPBuffer; 00070 RE_Render *myRender; 00071 RE_Render *myPrevRender; 00072 int myPrevRenderCount; 00073 int myWidth, myHeight; 00074 PXL_DataFormat myFormat; 00075 bool myAlphaFlag; 00076 RE_RenderBuf myPrevBuffer; 00077 }; 00078 00079 00080 00081 #endif
1.5.9