1 | #ifndef _FrameBufferObject_H__
|
---|
2 | #define _FrameBufferObject_H__
|
---|
3 |
|
---|
4 | #include <vector>
|
---|
5 | #include "common.h"
|
---|
6 |
|
---|
7 |
|
---|
8 | namespace CHCDemoEngine
|
---|
9 | {
|
---|
10 |
|
---|
11 |
|
---|
12 | /** This class implements a wrapper for a color buffer object
|
---|
13 | */
|
---|
14 | class ColorBufferObject
|
---|
15 | {
|
---|
16 | public:
|
---|
17 |
|
---|
18 | enum FORMAT { BUFFER_UBYTE, BUFFER_FLOAT_16, BUFFER_FLOAT_32 };
|
---|
19 | enum WRAP_TYPE{ WRAP_REPEAT, WRAP_CLAMP_TO_EDGE };
|
---|
20 | enum FILTER_TYPE { FILTER_NEAREST, FILTER_LINEAR, FILTER_MIPMAP_LINEAR };
|
---|
21 |
|
---|
22 | ColorBufferObject(int w, int h,
|
---|
23 | FORMAT c,
|
---|
24 | WRAP_TYPE wrapType,
|
---|
25 | FILTER_TYPE filterType,
|
---|
26 | bool useMipMap,
|
---|
27 | bool useMultiSampling);
|
---|
28 |
|
---|
29 | protected:
|
---|
30 |
|
---|
31 | unsigned int mId;
|
---|
32 | unsigned int mTexId;
|
---|
33 | };
|
---|
34 |
|
---|
35 |
|
---|
36 | /** This class implements a wrapper for a frame buffer object
|
---|
37 | */
|
---|
38 | class FrameBufferObject
|
---|
39 | {
|
---|
40 | public:
|
---|
41 |
|
---|
42 | enum DEPTH_FORMAT { DEPTH_16, DEPTH_24, DEPTH_32 };
|
---|
43 | /** constructor requesting an opengl occlusion query.
|
---|
44 | */
|
---|
45 | FrameBufferObject(int w, int h, bool useDepth, DEPTH_FORMAT d);
|
---|
46 | /** Creates and adds a color buffer to the current frame buffer object.
|
---|
47 | Returns a pointer to the buffer object
|
---|
48 | */
|
---|
49 | ColorBufferObject *AddColorBuffer(ColorBufferObject::FORMAT col,
|
---|
50 | ColorBufferObject::WRAP_TYPE wrapType,
|
---|
51 | ColorBufferObject::FILTER_TYPE filterType,
|
---|
52 | bool useMipMap,
|
---|
53 | bool useMultiSampling);
|
---|
54 |
|
---|
55 | protected:
|
---|
56 |
|
---|
57 | std::vector<ColorBufferObject *> mColorBuffers;
|
---|
58 |
|
---|
59 | unsigned int mId;
|
---|
60 | unsigned int mDepthId;
|
---|
61 |
|
---|
62 | int mHeight;
|
---|
63 | int mWidth;
|
---|
64 | };
|
---|
65 |
|
---|
66 | } // namespace
|
---|
67 | #endif // _FrameBufferObject_H__ |
---|