Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_OPENGL_FRAMEBUFFEROBJECT_H__
00009 #define __SP_OPENGL_FRAMEBUFFEROBJECT_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #if defined(SP_COMPILE_WITH_OPENGL) || defined(SP_COMPILE_WITH_OPENGLES2)
00015
00016
00017 #include "RenderSystem/spTextureBase.hpp"
00018 #include "RenderSystem/OpenGL/spOpenGLCoreHeader.hpp"
00019
00020
00021 namespace sp
00022 {
00023 namespace video
00024 {
00025
00026
00027 class SP_EXPORT GLFramebufferObject
00028 {
00029
00030 public:
00031
00032 virtual ~GLFramebufferObject();
00033
00034 protected:
00035
00036
00037
00038 GLFramebufferObject();
00039
00040 void createFramebuffer(
00041 GLuint TexID, const dim::size2di &Size, GLenum GLDimension, const EPixelFormats Format,
00042 const ETextureDimensions DimensionType, const ECubeMapDirections CubeMapFace,
00043 u32 ArrayLayer, GLuint DepthBufferSourceID
00044 );
00045
00046 #ifdef SP_COMPILE_WITH_OPENGL
00047
00048 void createFramebufferMultisample(
00049 GLuint TexID, const dim::size2di &Size, GLenum GLDimension, GLenum GLInternalFormat,
00050 s32 Samples, const std::vector<Texture*> &MultiRenderTargets, const EPixelFormats Format,
00051 const ETextureDimensions DimensionType, const ECubeMapDirections CubeMapFace,
00052 u32 ArrayLayer, GLuint DepthBufferSourceID
00053 );
00054
00055 void blitFramebufferMultisample(const dim::size2di &Size, u32 RTCount);
00056
00057 void updateMultiFramebuffer(
00058 const dim::size2di &Size, const EPixelFormats Format, const std::vector<Texture*> &MultiRenderTargets
00059 );
00060
00061 #endif
00062
00063 void setupCubeMapFace(
00064 GLuint TexID, const ECubeMapDirections CubeMapFace,
00065 bool isDepthAttachment, const std::vector<Texture*> &MultiRenderTargets
00066 );
00067 void setupArrayLayer(
00068 GLuint TexID, u32 Layer, bool isDepthAttachment,
00069 const std::vector<Texture*> &MultiRenderTargets
00070 );
00071
00072 void deleteFramebuffer();
00073
00074 private:
00075
00076 friend class GLProgrammableFunctionPipeline;
00077 friend class OpenGLTexture;
00078 friend class OpenGLES2Texture;
00079
00080
00081
00082 void releaseFramebuffer(GLuint &BufferID);
00083 void releaseRenderbuffer(GLuint &BufferID);
00084
00085 void attachFramebufferTexture(
00086 GLuint TexID, GLenum GLDimension, const EPixelFormats Format,
00087 const ETextureDimensions DimensionType, const ECubeMapDirections CubeMapFace, u32 ArrayLayer
00088 );
00089
00090 bool checkFrameBufferErrors();
00091
00092
00093
00094 inline bool isMultiSampled() const
00095 {
00096 return MSFrameBufferID_ != 0;
00097 }
00098
00099
00100
00101 GLuint FrameBufferID_, DepthBufferID_;
00102
00103 GLuint MSFrameBufferID_;
00104 std::vector<GLuint> MSColorBufferID_;
00105
00106 };
00107
00108
00109 }
00110
00111 }
00112
00113
00114 #endif
00115
00116 #endif
00117
00118
00119
00120