00001 /* 00002 00003 ************************************************************************* 00004 00005 ArmageTron -- Just another Tron Lightcycle Game in 3D. 00006 Copyright (C) 2006, Armagetron Advanced Development Team 00007 00008 ************************************************************************** 00009 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00023 00024 *************************************************************************** 00025 00026 */ 00027 00028 #ifndef ArmageTron_TEXTURERENDERTARGET_H 00029 #define ArmageTron_TEXTURERENDERTARGET_H 00030 00031 #include "rGLEW.h" 00032 #include "rTexture.h" 00033 #include "rGLuintObject.h" 00034 00036 class rTextureRenderTarget: public rITexture 00037 { 00038 public: 00040 void Clear(); 00041 00042 ~rTextureRenderTarget(); 00043 00045 rTextureRenderTarget( int width, int height ); 00046 00048 void Push(); 00049 00051 void Pop(); 00052 00054 static void Restore(); 00055 00056 bool IsTarget() const 00057 { 00058 return anchor == this; 00059 } 00060 00061 int GetHeight() const 00062 { 00063 return height_; 00064 } 00065 00066 int GetWidth() const 00067 { 00068 return width_; 00069 } 00070 protected: 00071 virtual void OnSelect(bool); 00072 00073 // nothing special to do here 00074 virtual void OnUnload(){} 00075 private: 00076 rGLuintObjectTexture texture_; 00077 rGLuintObjectRenderbuffer depthBuffer_; 00078 rGLuintObjectFramebuffer frameBuffer_; 00079 00080 00081 static rTextureRenderTarget * anchor; 00082 rTextureRenderTarget * previous; 00083 00084 int width_, height_; 00085 GLenum colorMode, depthMode; 00086 public: 00087 }; 00088 00089 #endif 00090 00091