#ifndef _FrameBufferObject_H__ #define _FrameBufferObject_H__ #include #include "common.h" namespace CHCDemoEngine { /** This class implements a wrapper for a color buffer object */ class ColorBufferObject { public: enum FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32 }; enum WRAP_TYPE{ WRAP_REPEAT, WRAP_CLAMP_TO_EDGE }; enum FILTER_TYPE { FILTER_NEAREST, FILTER_LINEAR, FILTER_MIPMAP_LINEAR }; ColorBufferObject(int w, int h, FORMAT c, WRAP_TYPE wrapType, FILTER_TYPE filterType, bool useMipMap, bool useMultiSampling, int attachment_idx); unsigned int GetTexture() const {return mTexId;} protected: unsigned int mId; unsigned int mTexId; }; /** This class implements a wrapper for a frame buffer object */ class FrameBufferObject { public: enum DEPTH_FORMAT { DEPTH_NONE, DEPTH_16, DEPTH_24, DEPTH_32 }; /** constructor requesting an opengl occlusion query. */ FrameBufferObject(int w, int h, DEPTH_FORMAT d); /** Creates and adds a color buffer to the current frame buffer object. Returns the index that allows to retrieve the color buffer object. */ int AddColorBuffer(ColorBufferObject::FORMAT col, ColorBufferObject::WRAP_TYPE wrapType, ColorBufferObject::FILTER_TYPE filterType, bool useMipMap, bool useMultiSampling); /** Returns the color buffer object on position i. */ ColorBufferObject *GetColorBuffer(int i) const { return mColorBuffers[i]; } /** Binds this frame buffer object. */ void Bind() const; /** Releases any bound frame buffer object. */ static void Release(); protected: std::vector mColorBuffers; unsigned int mId; unsigned int mDepthId; int mHeight; int mWidth; }; } // namespace #endif // _FrameBufferObject_H__