1 /* 2 Copyright (C) 2007, 2010 - Bit-Blot 3 4 This file is part of Aquaria. 5 6 Aquaria is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License 8 as published by the Free Software Foundation; either version 2 9 of the License, or (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 15 See the GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 */ 21 #ifndef FRAMEBUFFER_H 22 #define FRAMEBUFFER_H 23 24 #include "Base.h" 25 26 27 class FrameBuffer 28 { 29 public: 30 FrameBuffer(); 31 ~FrameBuffer(); 32 bool init(int width, int height, bool fitToScreen=false, GLint filter=GL_LINEAR); isInited()33 bool isInited() { return inited; } isEnabled()34 bool isEnabled() { return enabled; } 35 void setEnabled(bool e); 36 void startCapture(); 37 void endCapture(); 38 void bindTexture(); getWidth()39 int getWidth() { return w; } getHeight()40 int getHeight() { return h; } 41 float getWidthP(); 42 float getHeightP(); 43 44 void unloadDevice(); 45 void reloadDevice(); 46 47 #if defined(BBGE_BUILD_SDL) 48 static void resetOpenGL(); 49 #endif 50 51 protected: 52 int _w, _h; 53 bool _fitToScreen; 54 GLuint g_frameBuffer; 55 GLuint g_depthRenderBuffer; 56 GLuint g_dynamicTextureID; 57 int w,h; 58 bool enabled, inited; 59 }; 60 61 #endif 62