16#ifndef OSG_FRAMEBUFFEROBJECT
17#define OSG_FRAMEBUFFEROBJECT 1
24#ifndef GL_EXT_framebuffer_object
25#define GL_EXT_framebuffer_object 1
26#define GL_FRAMEBUFFER_EXT 0x8D40
27#define GL_RENDERBUFFER_EXT 0x8D41
29#define GL_STENCIL_INDEX1_EXT 0x8D46
30#define GL_STENCIL_INDEX4_EXT 0x8D47
31#define GL_STENCIL_INDEX8_EXT 0x8D48
32#define GL_STENCIL_INDEX16_EXT 0x8D49
33#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
34#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
35#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
36#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
37#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
38#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
39#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
40#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
41#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
42#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
43#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
44#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
45#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
46#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
47#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
48#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
49#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
50#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
51#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
52#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
53#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
54#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
55#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
56#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
57#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
58#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
59#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
60#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
61#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
62#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
63#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
64#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
65#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
66#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
67#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
68#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
69#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
70#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
71#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
72#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
73#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
74#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
75#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
76#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
77#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
78#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
79#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
82#ifndef GL_EXT_framebuffer_blit
83#define GL_EXT_framebuffer_blit 1
84#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
85#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
86#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
87#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
90#ifndef GL_EXT_framebuffer_multisample
91#define GL_EXT_framebuffer_multisample 1
92#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
93#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
94#define GL_MAX_SAMPLES_EXT 0x8D57
97#ifndef GL_MAX_SAMPLES_EXT
100#define GL_MAX_SAMPLES_EXT 0x8D57
103#ifndef GL_NV_framebuffer_multisample_coverage
104#define GL_NV_framebuffer_multisample_coverage 1
105#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
106#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
107#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
108#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
111#ifndef GL_EXT_packed_depth_stencil
112#define GL_EXT_packed_depth_stencil 1
113#define GL_DEPTH_STENCIL_EXT 0x84F9
114#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
115#define GL_DEPTH24_STENCIL8_EXT 0x88F0
116#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
130 RenderBuffer(
int width,
int height, GLenum internalFormat,
int samples=0,
int colorSamples=0);
135 inline int getWidth()
const;
136 inline int getHeight()
const;
137 inline void setWidth(
int w);
138 inline void setHeight(
int h);
139 inline void setSize(
int w,
int h);
140 inline GLenum getInternalFormat()
const;
141 inline void setInternalFormat(GLenum format);
142 inline int getSamples()
const;
143 inline int getColorSamples()
const;
144 inline void setSamples(
int samples);
145 inline void setColorSamples(
int colorSamples);
164 inline void dirtyAll()
const;
170 GLenum _internalFormat;
212 return _internalFormat;
217 _internalFormat = format;
228 return _colorSamples;
239 _colorSamples = colorSamples;
250 if (&rb ==
this)
return 0;
251 if (_internalFormat < rb._internalFormat)
return -1;
252 if (_internalFormat > rb._internalFormat)
return 1;
253 if (_width < rb._width)
return -1;
254 if (_width > rb._width)
return 1;
255 if (_height < rb._height)
return -1;
256 if (_height > rb._height)
return 1;
323 typedef std::map<Camera::BufferComponent, FrameBufferAttachment>
AttachmentMap;
351 return _fboID[contextID];
378 inline void dirtyAll();
403 return _attachments.find(attachment_point) != _attachments.end();
408 return _attachments.find(attachment_point)->second;
#define GL_READ_FRAMEBUFFER_EXT
Definition FrameBufferObject:85
#define GL_DRAW_FRAMEBUFFER_EXT
Definition FrameBufferObject:86
#define GL_FRAMEBUFFER_EXT
Definition FrameBufferObject:26
BufferComponent
Definition Camera:326
Definition FrameBufferObject:272
unsigned int getTexture3DZOffset() const
FrameBufferAttachment(Camera::Attachment &attachment)
FrameBufferAttachment(Texture2DArray *target, unsigned int layer, unsigned int level=0)
void attach(State &state, GLenum target, GLenum attachment_point, const GLExtensions *ext) const
FrameBufferAttachment(TextureRectangle *target)
unsigned int getTextureLevel() const
FrameBufferAttachment(Texture1D *target, unsigned int level=0)
FrameBufferAttachment(Texture2D *target, unsigned int level=0)
FrameBufferAttachment(const FrameBufferAttachment ©)
RenderBuffer * getRenderBuffer()
int compare(const FrameBufferAttachment &fa) const
FrameBufferAttachment(Texture2DMultisample *target, unsigned int level=0)
FrameBufferAttachment(RenderBuffer *target)
unsigned int getCubeMapFace() const
unsigned int getTextureArrayLayer() const
void releaseGLObjects(osg::State *=0) const
FrameBufferAttachment(Texture3D *target, unsigned int zoffset, unsigned int level=0)
FrameBufferAttachment(TextureCubeMap *target, unsigned int face, unsigned int level=0)
void createRequiredTexturesAndApplyGenerateMipMap(State &state, const GLExtensions *ext) const
const RenderBuffer * getRenderBuffer() const
void resizeGLObjectBuffers(unsigned int maxSize)
const Texture * getTexture() const
bool isMultisample() const
Definition FrameBufferObject:321
const MultipleRenderingTargets & getMultipleRenderingTargets() const
Definition FrameBufferObject:341
bool hasAttachment(BufferComponent attachment_point) const
Definition FrameBufferObject:401
Camera::BufferComponent BufferComponent
Definition FrameBufferObject:326
virtual void releaseGLObjects(osg::State *=0) const
std::map< Camera::BufferComponent, FrameBufferAttachment > AttachmentMap
Definition FrameBufferObject:323
GLenum convertBufferComponentToGLenum(BufferComponent attachment_point) const
void dirtyAll()
Definition FrameBufferObject:411
void apply(State &state) const
META_StateAttribute(osg, FrameBufferObject, FRAME_BUFFER_OBJECT)
int compare(const StateAttribute &sa) const
void apply(State &state, BindTarget target) const
bool hasMultipleRenderingTargets() const
Definition FrameBufferObject:340
BindTarget
Definition FrameBufferObject:355
const AttachmentMap & getAttachmentMap() const
Definition FrameBufferObject:396
virtual ~FrameBufferObject()
const FrameBufferAttachment & getAttachment(BufferComponent attachment_point) const
Definition FrameBufferObject:406
virtual void resizeGLObjectBuffers(unsigned int maxSize)
std::vector< GLenum > MultipleRenderingTargets
Definition FrameBufferObject:324
void setAttachment(BufferComponent attachment_point, const FrameBufferAttachment &attachment)
bool isMultisample() const
GLuint getHandle(unsigned int contextID) const
Definition FrameBufferObject:349
FrameBufferObject(const FrameBufferObject ©, const CopyOp ©op=CopyOp::SHALLOW_COPY)
Definition GLExtensions:169
Definition FrameBufferObject:424
GLFrameBufferObjectManager(unsigned int contextID)
virtual void deleteGLObject(GLuint globj)
Definition FrameBufferObject:417
GLRenderBufferManager(unsigned int contextID)
virtual void deleteGLObject(GLuint globj)
Definition FrameBufferObject:127
META_Object(osg, RenderBuffer)
int getHeight() const
Definition FrameBufferObject:186
GLuint getObjectID(unsigned int contextID, const GLExtensions *ext) const
void setInternalFormat(GLenum format)
Definition FrameBufferObject:215
RenderBuffer & operator=(const RenderBuffer &)
Definition FrameBufferObject:162
virtual void releaseGLObjects(osg::State *=0) const
static int getMaxSamples(unsigned int contextID, const GLExtensions *ext)
int getColorSamples() const
Definition FrameBufferObject:226
RenderBuffer(const RenderBuffer ©, const CopyOp ©op=CopyOp::SHALLOW_COPY)
void setSize(int w, int h)
Definition FrameBufferObject:203
void setHeight(int h)
Definition FrameBufferObject:197
void setSamples(int samples)
Definition FrameBufferObject:231
RenderBuffer(int width, int height, GLenum internalFormat, int samples=0, int colorSamples=0)
int compare(const RenderBuffer &rb) const
Definition FrameBufferObject:248
GLenum getInternalFormat() const
Definition FrameBufferObject:210
int getSamples() const
Definition FrameBufferObject:221
int getWidth() const
Definition FrameBufferObject:181
void setColorSamples(int colorSamples)
Definition FrameBufferObject:237
void dirtyAll() const
Definition FrameBufferObject:243
void setWidth(int w)
Definition FrameBufferObject:191
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Definition StateAttribute:77
Definition Texture2DArray:29
Definition Texture2DMultisample:30
Definition TextureCubeMap:24
Definition TextureRectangle:31
Definition buffered_value:27
void setAllElementsTo(const T &t)
Definition buffered_value:44
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39