#include <TAPsGLEXTFrameBufferObject.hpp>
Public Types | |
| enum | BufferType { FRAME_BUFFER, RENDER_BUFFER } |
Public Member Functions | |
| void | AttachRenderBuffer (GLuint i, GLenum attachment, GLuint renderbufferID) |
| void | AttachRenderBuffer (GLenum attachment, GLuint renderbufferID) |
| void | AttachTextureBuffer (GLuint i, GLenum attachment, GLenum textarget, GLuint texture, GLint level=0, GLint zoffset=0) |
| void | AttachTextureBuffer (GLenum attachment, GLenum textarget, GLuint texture, GLint level=0, GLint zoffset=0) |
| void | BindFrameBuffer (GLuint i=0) |
| void | BindRenderBuffer (GLuint i=0) |
| bool | CheckFrameBufferStatus (GLuint i=0) |
| void | DeleteFrameBuffers () |
| void | DeleteRenderBuffers () |
| void | FrameBufferRenderBuffer (GLenum attachment, GLuint renderbuffer) |
| void | FrameBufferTexture1D (GLenum attachment, GLenum textarget, GLuint texture, GLint level) |
| void | FrameBufferTexture2D (GLenum attachment, GLenum textarget, GLuint texture, GLint level) |
| void | FrameBufferTexture3D (GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) |
| void | GenerateMipmap () |
| void | GenFrameBuffers () |
| void | GenRenderBuffers () |
| BufferType | GetBufferType () const |
| GLint | GetFrameBufferAttachmentParameter (GLuint i, GLenum attachment, GLenum pname) |
| GLint | GetFrameBufferAttachmentParameter (GLenum attachment, GLenum pname) |
| GLuint | GetID (GLuint i) const |
| GLuint | GetID () const |
| GLint | GetRenderbufferParameter (GLuint i, GLenum attachment, GLenum pname) |
| GLint | GetRenderbufferParameter (GLenum attachment, GLenum pname) |
| void | GetRenderBufferParameter () |
| GLuint | GetSize () const |
| GLEXTFrameBufferObject (BufferType eBufferType, GLuint gluiSize=1) | |
| bool | IsFrameBuffer (GLuint i=0) |
| bool | IsRenderBuffer (GLuint i=0) |
| void | RenderBufferStorage (GLuint i, GLenum internalformat, GLsizei width, GLsizei height) |
| void | RenderBufferStorage (GLenum internalformat, GLsizei width, GLsizei height) |
| virtual | ~GLEXTFrameBufferObject () |
Static Public Member Functions | |
| static void | DisableAllFrameBuffers () |
| static void | DisableAllRenderBuffers () |
| static GLint | InquireMaxColorAttachments () |
| static GLint | InquireMaxRenderBufferSize () |
| static void | UnbindAllFrameBuffers () |
| static void | UnbindAllRenderBuffers () |
Protected Member Functions | |
| void | ProtectedBindFrameBuffer (GLuint i) |
| void | ProtectedBindRenderBuffer (GLuint i) |
| void | ProtectedUnbindFrameBuffer (GLuint i) |
| void | ProtectedUnbindRenderBuffer (GLuint i) |
Protected Attributes | |
| BufferType | m_eBufferType |
| GLuint | m_gluiSize |
| GLuint * | m_pgluiID |
| GLuint * | m_pgluiID_StackValue |
Static Protected Attributes | |
| static unsigned int | g_uiObjCounters = 0 |
Based on GL_EXT_framebuffer_object from http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt with Last Modified Date: April 5, 2006 and the framebufferObject class by Aaron Lefohn.
Excerpted from the specification mentioned above:
"In this extension, these newly defined rendering destinations are known collectively as "framebuffer-attachable images". This extension provides a mechanism for attaching framebuffer-attachable images to the GL framebuffer as one of the standard GL logical buffers: color, depth, and stencil. (Attaching a framebuffer-attachable image to the accum logical buffer is left for a future extension to define). When a framebuffer-attachable image is attached to the framebuffer, it is used as the source and destination of fragment operations as described in Chapter 4."
(Beside frame buffer (i.e. texture buffer) object) "This extension also defines a new GL object type, called a "renderbuffer", which encapsulates a single 2D pixel image. The image of renderbuffer can be used as a framebuffer-attachable image for generalized offscreen rendering and it also provides a means to support rendering to GL logical buffer types which have no corresponding texture format (stencil, accum, etc). A renderbuffer is similar to a texture in that both renderbuffers and textures can be independently allocated and shared among multiple contexts. The framework defined by this extension is general enough that support for attaching images from GL objects other than textures and renderbuffers could be added by layered extensions."
"To facilitate efficient switching between collections of framebuffer-attachable images, this extension introduces another new GL object, called a framebuffer object. A framebuffer object contains the state that defines the traditional GL framebuffer, including its set of images. Prior to this extension, it was the window-system which defined and managed this collection of images, traditionally by grouping them into a "drawable". The window-system API's would also provide a function (i.e., wglMakeCurrent, glXMakeCurrent, aglSetDrawable, etc.) to bind a drawable with a GL context (as is done in the WGL_ARB_pbuffer extension). In this extension however, this functionality is subsumed by the GL and the GL provides the function BindFramebufferEXT to bind a framebuffer object to the current context. Later, the context can bind back to the window-system-provided framebuffer in order to display rendered content."
Definition at line 80 of file TAPsGLEXTFrameBufferObject.hpp.
Definition at line 85 of file TAPsGLEXTFrameBufferObject.hpp.
00085 { 00086 FRAME_BUFFER, 00087 //TEXTURE_BUFFER, 00088 RENDER_BUFFER 00089 };
| GLEXTFrameBufferObject::GLEXTFrameBufferObject | ( | BufferType | eBufferType, | |
| GLuint | gluiSize = 1 | |||
| ) |
Definition at line 31 of file TAPsGLEXTFrameBufferObject.cpp.
00033 : m_eBufferType( eBufferType ), m_gluiSize( gluiSize ), 00034 m_pgluiID( NULL ), m_pgluiID_StackValue( NULL ) 00035 { 00036 switch ( m_eBufferType ) { 00037 case FRAME_BUFFER: 00038 GenFrameBuffers(); 00039 break; 00040 //case TEXTURE_BUFFER: 00041 // break; 00042 case RENDER_BUFFER: 00043 GenRenderBuffers(); 00044 break; 00045 } 00046 //--------------------------------------------------------------- 00047 ++g_uiObjCounters; 00048 }
| GLEXTFrameBufferObject::~GLEXTFrameBufferObject | ( | ) | [virtual] |
Definition at line 51 of file TAPsGLEXTFrameBufferObject.cpp.
00052 { 00053 switch ( m_eBufferType ) { 00054 case FRAME_BUFFER: 00055 DeleteFrameBuffers(); 00056 break; 00057 //case TEXTURE_BUFFER: 00058 // break; 00059 case RENDER_BUFFER: 00060 DeleteRenderBuffers(); 00061 break; 00062 } 00063 //--------------------------------------------------------------- 00064 delete [] m_pgluiID; 00065 delete [] m_pgluiID_StackValue; 00066 --g_uiObjCounters; 00067 }
| void GLEXTFrameBufferObject::AttachRenderBuffer | ( | GLuint | i, | |
| GLenum | attachment, | |||
| GLuint | renderbufferID | |||
| ) | [inline] |
Definition at line 113 of file TAPsGLEXTFrameBufferObject.cpp.
00115 { 00116 assert( i < GetSize() ); 00117 assert( m_eBufferType == FRAME_BUFFER ); 00118 //--------------------------------------------------------------- 00119 ProtectedBindFrameBuffer( i ); 00120 //--------------------------------------------------------------- 00121 #ifdef TAPs_DEBUG_MODE 00122 // Get Attached ID 00123 GLint id = GetFrameBufferAttachmentParameter( 00124 i, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 00125 ); 00126 if ( id != m_pgluiID[i] ) { 00127 #endif 00128 //--------------------------------------------------------------- 00129 FrameBufferRenderBuffer( attachment, renderbufferID ); 00130 //--------------------------------------------------------------- 00131 #ifdef TAPs_DEBUG_MODE 00132 } 00133 #endif 00134 //--------------------------------------------------------------- 00135 ProtectedUnbindFrameBuffer( i ); 00136 }
| void GLEXTFrameBufferObject::AttachRenderBuffer | ( | GLenum | attachment, | |
| GLuint | renderbufferID | |||
| ) | [inline] |
Definition at line 119 of file TAPsGLEXTFrameBufferObject.hpp.
00122 { AttachRenderBuffer( 0, attachment, renderbufferID ); }
| void GLEXTFrameBufferObject::AttachTextureBuffer | ( | GLuint | i, | |
| GLenum | attachment, | |||
| GLenum | textarget, | |||
| GLuint | texture, | |||
| GLint | level = 0, |
|||
| GLint | zoffset = 0 | |||
| ) | [inline] |
Definition at line 73 of file TAPsGLEXTFrameBufferObject.cpp.
00080 { 00081 assert( i < GetSize() ); 00082 assert( m_eBufferType == FRAME_BUFFER ); 00083 //--------------------------------------------------------------- 00084 ProtectedBindFrameBuffer( i ); 00085 //--------------------------------------------------------------- 00086 #ifdef TAPs_DEBUG_MODE 00087 // Get Attached ID 00088 GLint id = GetFrameBufferAttachmentParameter( 00089 i, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 00090 ); 00091 if ( id != m_pgluiID[i] ) { 00092 #endif 00093 //--------------------------------------------------------------- 00094 switch ( textarget ) { 00095 case GL_TEXTURE_2D: 00096 FrameBufferTexture2D( attachment, textarget, texture, level ); 00097 break; 00098 case GL_TEXTURE_3D: 00099 FrameBufferTexture3D( attachment, textarget, texture, level, zoffset ); 00100 break; 00101 case GL_TEXTURE_1D: 00102 FrameBufferTexture1D( attachment, textarget, texture, level ); 00103 break; 00104 } 00105 //--------------------------------------------------------------- 00106 #ifdef TAPs_DEBUG_MODE 00107 } 00108 #endif 00109 //--------------------------------------------------------------- 00110 ProtectedUnbindFrameBuffer( i ); 00111 }
| void GLEXTFrameBufferObject::AttachTextureBuffer | ( | GLenum | attachment, | |
| GLenum | textarget, | |||
| GLuint | texture, | |||
| GLint | level = 0, |
|||
| GLint | zoffset = 0 | |||
| ) | [inline] |
Definition at line 102 of file TAPsGLEXTFrameBufferObject.hpp.
00108 { AttachTextureBuffer( 0, attachment, textarget, texture, level, zoffset ); }
| void GLEXTFrameBufferObject::BindFrameBuffer | ( | GLuint | i = 0 |
) | [inline] |
Based On: void BindFramebufferEXT(enum target, uint framebuffer);
Definition at line 230 of file TAPsGLEXTFrameBufferObject.cpp.
00231 { 00232 assert( i < GetSize() ); 00233 assert( m_eBufferType == FRAME_BUFFER ); 00234 assert( m_pgluiID != NULL ); 00235 glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_pgluiID[i] ); 00236 }
| void GLEXTFrameBufferObject::BindRenderBuffer | ( | GLuint | i = 0 |
) | [inline] |
Based On: void BindRenderbufferEXT(enum target, uint renderbuffer);
Definition at line 154 of file TAPsGLEXTFrameBufferObject.cpp.
00155 { 00156 assert( i < GetSize() ); 00157 assert( m_eBufferType == RENDER_BUFFER ); 00158 assert( m_pgluiID != NULL ); 00159 glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, m_pgluiID[i] ); 00160 }
| bool GLEXTFrameBufferObject::CheckFrameBufferStatus | ( | GLuint | i = 0 |
) | [inline] |
Based On: enum CheckFramebufferStatusEXT(enum target);
Definition at line 263 of file TAPsGLEXTFrameBufferObject.cpp.
00264 { 00265 assert ( i < GetSize() ); 00266 //--------------------------------------------------------------- 00267 ProtectedBindFrameBuffer( i ); 00268 //--------------------------------------------------------------- 00269 switch ( glCheckFramebufferStatusEXT( GL_FRAMEBUFFER_EXT ) ) { 00270 case GL_FRAMEBUFFER_COMPLETE_EXT: 00271 return true; 00272 break; 00273 case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: 00274 #ifdef TAPs_USE_WXWIDGETS 00275 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT" ) ); 00276 #else 00277 std::cout << "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT" << std::endl; 00278 #endif 00279 break; 00280 case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT: 00281 #ifdef TAPs_USE_WXWIDGETS 00282 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT" ) ); 00283 #else 00284 std::cout << "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT" << std::endl; 00285 #endif 00286 break; 00287 case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: 00288 #ifdef TAPs_USE_WXWIDGETS 00289 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT" ) ); 00290 #else 00291 std::cout << "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT" << std::endl; 00292 #endif 00293 break; 00294 case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT: 00295 #ifdef TAPs_USE_WXWIDGETS 00296 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT" ) ); 00297 #else 00298 std::cout << "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT" << std::endl; 00299 #endif 00300 break; 00301 case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT: 00302 #ifdef TAPs_USE_WXWIDGETS 00303 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT" ) ); 00304 #else 00305 std::cout << "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT" << std::endl; 00306 #endif 00307 break; 00308 case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT: 00309 #ifdef TAPs_USE_WXWIDGETS 00310 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT" ) ); 00311 #else 00312 std::cout << "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT" << std::endl; 00313 #endif 00314 break; 00315 case GL_FRAMEBUFFER_UNSUPPORTED_EXT: 00316 #ifdef TAPs_USE_WXWIDGETS 00317 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_UNSUPPORTED_EXT" ) ); 00318 #else 00319 std::cout << "ERROR (GLEXTFrameBufferObject): GL_FRAMEBUFFER_UNSUPPORTED_EXT" << std::endl; 00320 #endif 00321 break; 00322 default: 00323 #ifdef TAPs_USE_WXWIDGETS 00324 wxLogError( wxT( "ERROR (GLEXTFrameBufferObject): UNKNOWN ERROR!" ) ); 00325 #else 00326 std::cout << "ERROR (GLEXTFrameBufferObject): UNKNOWN ERROR!" << std::endl; 00327 #endif 00328 break; 00329 } 00330 //--------------------------------------------------------------- 00331 ProtectedUnbindFrameBuffer( i ); 00332 //--------------------------------------------------------------- 00333 return false; 00334 }
| void GLEXTFrameBufferObject::DeleteFrameBuffers | ( | ) | [inline] |
Based On: void DeleteFramebuffersEXT(sizei n, const uint *framebuffers);
Delete all frame buffers in this object
Definition at line 238 of file TAPsGLEXTFrameBufferObject.cpp.
00239 { 00240 assert( m_eBufferType == FRAME_BUFFER ); 00241 assert( m_pgluiID != NULL ); 00242 glDeleteFramebuffersEXT( m_gluiSize, m_pgluiID ); 00243 }
| void GLEXTFrameBufferObject::DeleteRenderBuffers | ( | ) | [inline] |
Based On: void DeleteRenderbuffersEXT(sizei n, const uint *renderbuffers);
Delete all render buffers in this object
Definition at line 162 of file TAPsGLEXTFrameBufferObject.cpp.
00163 { 00164 assert( m_eBufferType == RENDER_BUFFER ); 00165 assert( m_pgluiID != NULL ); 00166 glDeleteRenderbuffersEXT( m_gluiSize, m_pgluiID ); 00167 }
| void GLEXTFrameBufferObject::DisableAllFrameBuffers | ( | ) | [inline, static] |
| void GLEXTFrameBufferObject::DisableAllRenderBuffers | ( | ) | [inline, static] |
| void GLEXTFrameBufferObject::FrameBufferRenderBuffer | ( | GLenum | attachment, | |
| GLuint | renderbuffer | |||
| ) | [inline] |
Based On: void FramebufferRenderbufferEXT(enum target, enum attachment, enum renderbuffertarget, uint renderbuffer);
<target> must be FRAMEBUFFER_EXT.
INVALID_OPERATION is generated if the current value of FRAMEBUFFER_BINDING_EXT is zero when FramebufferRenderbufferEXT is called.
<attachment> should be set to one of the attachment points of the framebuffer listed in table 1.nnn, which are the following:
--------------------------------------------------------------
COLOR_ATTACHMENT0_EXT ... COLOR_ATTACHMENTn_EXT (where n is from 0 to MAX_COLOR_ATTACHMENTS_EXT-1)
DEPTH_ATTACHMENT_EXT
STENCIL_ATTACHMENT_EXT
--------------------------------------------------------------
<renderbuffertarget> must be RENDERBUFFER_EXT.
<renderbuffer> should be set to the name of the renderbuffer object to be attached to the framebuffer.
<renderbuffer> must be either zero or the name of an existing renderbuffer object of type <renderbuffertarget>, otherwise INVALID_OPERATION is generated.
If <renderbuffer> is zero, then the value of <renderbuffertarget> is ignored.
If <renderbuffer> is not zero and if FramebufferRenderbufferEXT is successful, then the renderbuffer named <renderbuffer> will be used as the logical buffer identified by <attachment> of the framebuffer currently bound to <target>. The value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT for the specified attachment point is set to RENDERBUFFER_EXT and the value of FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is set to <renderbuffer>. All other state values of the attachment point specified by <attachment> are set to their default values listed in table 5.nnn. No change is made to the state of the renderbuffer object and any previous attachment to the <attachment> logical buffer of the framebuffer object bound to framebuffer <target> is broken. If, on the other hand, the attachment is not successful, then no change is made to the state of either the renderbuffer object or the framebuffer object.
Calling FramebufferRenderbufferEXT with the <renderbuffer> name zero will detach the image, if any, identified by <attachment>, in the framebuffer currently bound to <target>. All state values of the attachment point specified by <attachment> in the object bound to <target> are set to their default values listed in table 5.nnn.
If a renderbuffer object is deleted while its image is attached to one or more attachment points in the currently bound framebuffer, then it is as if FramebufferRenderbufferEXT() had been called, with a <renderbuffer> of 0, for each attachment point to which this image was attached in the currently bound framebuffer. In other words, this renderbuffer image is first detached from all attachment points in the currently bound framebuffer. Note that the renderbuffer image is specifically *not* detached from any non-bound framebuffers. Detaching the image from any non-bound framebuffers is the responsibility of the application.
Definition at line 368 of file TAPsGLEXTFrameBufferObject.cpp.
00371 { 00372 glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, attachment, 00373 GL_RENDERBUFFER_EXT, renderbuffer ); 00374 }
| void GLEXTFrameBufferObject::FrameBufferTexture1D | ( | GLenum | attachment, | |
| GLenum | textarget, | |||
| GLuint | texture, | |||
| GLint | level | |||
| ) | [inline] |
Calling FramebufferTexture{1D|2D|3D}EXT with <texture> name zero will detach the image identified by <attachment>, if any, in the framebuffer currently bound to <target>. All state values of the attachment point specified by <attachment> are set to their default values listed in table 5.nnn. Based On: void FramebufferTexture1DEXT(enum target, enum attachment, enum textarget, uint texture, int level);
<target> must be GL_FRAME_BUFFER_EXT.
INVALID_OPERATION is generated if the current value of FRAMEBUFFER_BINDING_EXT is zero when FramebufferTexture3DEXT is called.
List of <attachment>
--------------------------------------------------------------------------------------
COLOR_ATTACHMENT0_EXT ... COLOR_ATTACHMENTn_EXT (where n is from 0 to MAX_COLOR_ATTACHMENTS_EXT-1)
DEPTH_ATTACHMENT_EXT
STENCIL_ATTACHMENT_EXT
--------------------------------------------------------------------------------------
If <texture> is zero, <textarget> and <level> are ignored.
If <texture> is not zero, then <textarget> must be TEXTURE_1D.
<level> specifies the mipmap level of the texture image to be attached to the framebuffer.
<level> must be greater than or equal to zero and no larger than log base 2 of MAX_TEXTURE_SIZE. Otherwise, INVALID_VALUE is generated.
Definition at line 337 of file TAPsGLEXTFrameBufferObject.cpp.
00342 { 00343 glFramebufferTexture1DEXT( GL_FRAMEBUFFER_EXT, attachment, 00344 GL_TEXTURE_1D, texture, level ); 00345 }
| void GLEXTFrameBufferObject::FrameBufferTexture2D | ( | GLenum | attachment, | |
| GLenum | textarget, | |||
| GLuint | texture, | |||
| GLint | level | |||
| ) | [inline] |
Based On: void FramebufferTexture2DEXT(enum target, enum attachment, enum textarget, uint texture, int level);
<target> must be GL_FRAME_BUFFER_EXT.
INVALID_OPERATION is generated if the current value of FRAMEBUFFER_BINDING_EXT is zero when FramebufferTexture3DEXT is called.
List of <attachment>
--------------------------------------------------------------------------------------
COLOR_ATTACHMENT0_EXT ... COLOR_ATTACHMENTn_EXT (where n is from 0 to MAX_COLOR_ATTACHMENTS_EXT-1)
DEPTH_ATTACHMENT_EXT
STENCIL_ATTACHMENT_EXT
--------------------------------------------------------------------------------------
If <texture> is zero, <textarget> and <level> are ignored.
If <texture> is not zero, then <textarget> must be one of: TEXTURE_2D, TEXTURE_RECTANGLE_ARB, TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Z.
<level> specifies the mipmap level of the texture image to be attached to the framebuffer.
If <textarget> is TEXTURE_RECTANGLE_ARB, then <level> must be zero.
If <textarget> is one of TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_Y, or TEXTURE_CUBE_MAP_NEGATIVE_Z, then <level> must be greater than or equal to zero and less than or equal to log base 2 of MAX_CUBE_MAP_TEXTURE_SIZE.
For all other values of <textarget>, <level> must be greater than or equal to zero and no larger than log base 2 of MAX_TEXTURE_SIZE. Otherwise, INVALID_VALUE is generated.
Definition at line 347 of file TAPsGLEXTFrameBufferObject.cpp.
00352 { 00353 glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, attachment, 00354 textarget, texture, level ); 00355 }
| void GLEXTFrameBufferObject::FrameBufferTexture3D | ( | GLenum | attachment, | |
| GLenum | textarget, | |||
| GLuint | texture, | |||
| GLint | level, | |||
| GLint | zoffset | |||
| ) | [inline] |
Based On: void FramebufferTexture3DEXT(enum target, enum attachment, enum textarget, uint texture, int level, int zoffset);
<target> must be GL_FRAME_BUFFER_EXT.
INVALID_OPERATION is generated if the current value of FRAMEBUFFER_BINDING_EXT is zero when FramebufferTexture3DEXT is called.
List of <attachment>
--------------------------------------------------------------------------------------
COLOR_ATTACHMENT0_EXT ... COLOR_ATTACHMENTn_EXT (where n is from 0 to MAX_COLOR_ATTACHMENTS_EXT-1)
DEPTH_ATTACHMENT_EXT
STENCIL_ATTACHMENT_EXT
--------------------------------------------------------------------------------------
If <texture> is zero, <textarget>, <level>, and <zoffset> are ignored.
If <texture> is not zero, then <textarget> must be TEXTURE_3D.
<level> specifies the mipmap level of the texture image to be attached to the framebuffer.
If <textarget> is TEXTURE_3D, then <level> must be greater than or equal to zero and less than or equal to log base 2 of MAX_3D_TEXTURE_SIZE.
<zoffset> specifies the z-offset of a 2-dimensional image within a 3-dimensional texture. INVALID_VALUE is generated if <zoffset> is larger than MAX_3D_TEXTURE_SIZE-1.
Definition at line 357 of file TAPsGLEXTFrameBufferObject.cpp.
00363 { 00364 glFramebufferTexture3DEXT( GL_FRAMEBUFFER_EXT, attachment, 00365 GL_TEXTURE_3D, texture, level, zoffset ); 00366 }
| void GLEXTFrameBufferObject::GenerateMipmap | ( | ) | [inline] |
Based On: void GenerateMipmapEXT(enum target);
Definition at line 406 of file TAPsGLEXTFrameBufferObject.cpp.
| void GLEXTFrameBufferObject::GenFrameBuffers | ( | ) | [inline] |
Based On: void GenFramebuffersEXT(sizei n, uint *framebuffers);
Generate all frame buffers in this object
Definition at line 245 of file TAPsGLEXTFrameBufferObject.cpp.
00246 { 00247 if ( m_pgluiID != NULL ) { 00248 delete [] m_pgluiID; 00249 delete [] m_pgluiID_StackValue; 00250 } 00251 //------------------------------------------- 00252 m_pgluiID = new GLuint[ m_gluiSize ]; 00253 m_pgluiID_StackValue = new GLuint[ m_gluiSize ]; 00254 //------------------------------------------- 00255 glGenFramebuffersEXT( m_gluiSize, m_pgluiID ); 00256 }
| void GLEXTFrameBufferObject::GenRenderBuffers | ( | ) | [inline] |
Based On: void GenRenderbuffersEXT(sizei n, uint *renderbuffers);
Generate all render buffers in this object
Definition at line 169 of file TAPsGLEXTFrameBufferObject.cpp.
00170 { 00171 if ( m_pgluiID != NULL ) { 00172 delete [] m_pgluiID; 00173 delete [] m_pgluiID_StackValue; 00174 } 00175 //------------------------------------------- 00176 m_pgluiID = new GLuint[ m_gluiSize ]; 00177 m_pgluiID_StackValue = new GLuint[ m_gluiSize ]; 00178 //------------------------------------------- 00179 glGenRenderbuffersEXT( m_gluiSize, m_pgluiID ); 00180 }
| BufferType GLEXTFrameBufferObject::GetBufferType | ( | ) | const [inline] |
| GLint GLEXTFrameBufferObject::GetFrameBufferAttachmentParameter | ( | GLuint | i, | |
| GLenum | attachment, | |||
| GLenum | pname | |||
| ) | [inline] |
Definition at line 376 of file TAPsGLEXTFrameBufferObject.cpp.
00380 { 00381 assert( i < GetSize() ); 00382 //--------------------------------------------------------------- 00383 ProtectedBindFrameBuffer( i ); 00384 GLint result; 00385 glGetFramebufferAttachmentParameterivEXT( 00386 GL_FRAMEBUFFER_EXT, attachment, pname, &result ); 00387 ProtectedUnbindFrameBuffer( i ); 00388 return result; 00389 }
| GLint GLEXTFrameBufferObject::GetFrameBufferAttachmentParameter | ( | GLenum | attachment, | |
| GLenum | pname | |||
| ) | [inline] |
Based On: void GetFramebufferAttachmentParameterivEXT(enum target, enum attachment, enum pname, int *params);
<target> must be FRAMEBUFFER_EXT.
<attachment> must be one of the attachment points of the framebuffer listed in table 1.nnn, which are the following:
--------------------------------------------------------------
COLOR_ATTACHMENT0_EXT ... COLOR_ATTACHMENTn_EXT (where n is from 0 to MAX_COLOR_ATTACHMENTS_EXT-1)
DEPTH_ATTACHMENT_EXT
STENCIL_ATTACHMENT_EXT
--------------------------------------------------------------
<pname> must be one of the following:
--------------------------------------------------------------
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT,
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT,
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT,
FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT.
--------------------------------------------------------------
If the framebuffer currently bound to <target> is zero, then INVALID_OPERATION is generated.
Upon successful return from GetFramebufferAttachmentParameterivEXT, if <pname> is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT, then param will contain one of NONE, TEXTURE, or RENDERBUFFER_EXT, identifying the type of object which contains the attached image.
If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is RENDERBUFFER_EXT, then If <pname> is FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, <params> will contain the name of the renderbuffer object which contains the attached image.
Otherwise, INVALID_ENUM is generated.
If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE, then
If <pname> is FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT, then <params> will contain the name of the texture object which contains the attached image.
If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT, then <params> will contain the mipmap level of the texture object which contains the attached image.
If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT and the texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a cube map texture, then <params> will contain the cube map face of the cubemap texture object which contains the attached image. Otherwise <params> will contain the value zero.
If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT and the texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a 3-dimensional texture, then <params> will contain the zoffset of the 2D image of the 3D texture object which contains the attached image. Otherwise <params> will contain the value zero.
Otherwise, INVALID_ENUM is generated.
Definition at line 664 of file TAPsGLEXTFrameBufferObject.hpp.
00667 { return GetFrameBufferAttachmentParameter( 0, attachment, pname ); }
| GLuint GLEXTFrameBufferObject::GetID | ( | GLuint | i | ) | const [inline] |
| GLuint GLEXTFrameBufferObject::GetID | ( | ) | const [inline] |
| GLint GLEXTFrameBufferObject::GetRenderbufferParameter | ( | GLuint | i, | |
| GLenum | attachment, | |||
| GLenum | pname | |||
| ) | [inline] |
Definition at line 391 of file TAPsGLEXTFrameBufferObject.cpp.
00395 { 00396 assert( i < GetSize() ); 00397 //--------------------------------------------------------------- 00398 ProtectedBindFrameBuffer( i ); 00399 GLint result; 00400 glGetRenderbufferParameterivEXT( 00401 GL_RENDERBUFFER_EXT, pname, &result ); 00402 ProtectedUnbindFrameBuffer( i ); 00403 return result; 00404 }
| GLint GLEXTFrameBufferObject::GetRenderbufferParameter | ( | GLenum | attachment, | |
| GLenum | pname | |||
| ) | [inline] |
Based On: void GetRenderbufferParameterivEXT(enum target, enum pname, int *params);
<target> must be RENDERBUFFER_EXT.
<pname> must be one of the symbolic values in table 8.nnn, which are the following:
--------------------------------------------------------------
RENDERBUFFER_WIDTH_EXT
RENDERBUFFER_HEIGHT_EXT
RENDERBUFFER_INTERNAL_FORMAT_EXT
RENDERBUFFER_RED_SIZE_EXT
RENDERBUFFER_GREEN_SIZE_EXT
RENDERBUFFER_BLUE_SIZE_EXT
RENDERBUFFER_ALPHA_SIZE_EXT
RENDERBUFFER_DEPTH_SIZE_EXT
RENDERBUFFER_STENCIL_SIZE_EXT
--------------------------------------------------------------
If the renderbuffer currently bound to <target> is zero, then INVALID_OPERATION is generated.
Upon successful return from GetRenderbufferParameterivEXT, if <pname> is RENDERBUFFER_WIDTH_EXT, RENDERBUFFER_HEIGHT_EXT, or RENDERBUFFER_INTERNAL_FORMAT_EXT, then <params> will contain the width in pixels, height in pixels, or internal format, respectively, of the image of the renderbuffer currently bound to <target>.
Upon successful return from GetRenderbufferParameterivEXT, if <pname> is RENDERBUFFER_RED_SIZE_EXT, RENDERBUFFER_GREEN_SIZE_EXT, RENDERBUFFER_BLUE_SIZE_EXT, RENDERBUFFER_ALPHA_SIZE_EXT, RENDERBUFFER_DEPTH_SIZE_EXT, or RENDERBUFFER_STENCIL_SIZE_EXT, then <params> will contain the actual resolutions, (not the resolutions specified when the image array was defined), for the red, green, blue, alpha depth, or stencil components, respectively, of the image of the renderbuffer currently bound to <target>.
Otherwise, INVALID_ENUM is generated."
Definition at line 728 of file TAPsGLEXTFrameBufferObject.hpp.
00731 { return GetRenderbufferParameter( 0, attachment, pname ); }
| void GLEXTFrameBufferObject::GetRenderBufferParameter | ( | ) | [inline] |
Based On: void GetRenderbufferParameterivEXT(enum target, enum pname, int *params);
<target> must be RENDERBUFFER_EXT.
<pname> must be one of these:
RENDERBUFFER_WIDTH_EXT
RENDERBUFFER_HEIGHT_EXT
RENDERBUFFER_INTERNAL_FORMAT_EXT
RENDERBUFFER_RED_SIZE_EXT
RENDERBUFFER_GREEN_SIZE_EXT
RENDERBUFFER_BLUE_SIZE_EXT
RENDERBUFFER_ALPHA_SIZE_EXT
RENDERBUFFER_DEPTH_SIZE_EXT
RENDERBUFFER_STENCIL_SIZE_EXT
If the renderbuffer currently bound to <target> is zero, then INVALID_OPERATION is generated.
Upon successful return from GetRenderbufferParameterivEXT, if <pname> is RENDERBUFFER_WIDTH_EXT, RENDERBUFFER_HEIGHT_EXT, or RENDERBUFFER_INTERNAL_FORMAT_EXT, then <params> will contain the width in pixels, height in pixels, or internal format, respectively, of the image of the renderbuffer currently bound to <target>.
Upon successful return from GetRenderbufferParameterivEXT, if <pname> is RENDERBUFFER_RED_SIZE_EXT, RENDERBUFFER_GREEN_SIZE_EXT, RENDERBUFFER_BLUE_SIZE_EXT, RENDERBUFFER_ALPHA_SIZE_EXT, RENDERBUFFER_DEPTH_SIZE_EXT, or RENDERBUFFER_STENCIL_SIZE_EXT, then <params> will contain the actual resolutions, (not the resolutions specified when the image array was defined), for the red, green, blue, alpha depth, or stencil components, respectively, of the image of the renderbuffer currently bound to <target>.
Otherwise, INVALID_ENUM is generated.
Definition at line 212 of file TAPsGLEXTFrameBufferObject.cpp.
| GLuint GLEXTFrameBufferObject::GetSize | ( | ) | const [inline] |
| GLint GLEXTFrameBufferObject::InquireMaxColorAttachments | ( | ) | [inline, static] |
Definition at line 415 of file TAPsGLEXTFrameBufferObject.cpp.
00416 { 00417 GLint max = 0; 00418 glGetIntegerv( GL_MAX_COLOR_ATTACHMENTS_EXT, &max ); 00419 return max; 00420 }
| GLint GLEXTFrameBufferObject::InquireMaxRenderBufferSize | ( | ) | [inline, static] |
Definition at line 422 of file TAPsGLEXTFrameBufferObject.cpp.
00423 { 00424 GLint max = 0; 00425 glGetIntegerv( GL_MAX_RENDERBUFFER_SIZE_EXT, &max ); 00426 return max; 00427 }
| bool GLEXTFrameBufferObject::IsFrameBuffer | ( | GLuint | i = 0 |
) | [inline] |
Based On: boolean IsFramebufferEXT(uint framebuffer);
Definition at line 222 of file TAPsGLEXTFrameBufferObject.cpp.
00223 { 00224 assert( i < GetSize() ); 00225 if ( glIsFramebufferEXT( m_pgluiID[i] ) == GL_TRUE ) 00226 return true; 00227 return false; 00228 }
| bool GLEXTFrameBufferObject::IsRenderBuffer | ( | GLuint | i = 0 |
) | [inline] |
Render Buffer Object
A renderbuffer is a data storage object containing a single image of a renderable internal format. GL provides the methods described below to allocate and delete a renderbuffer's image, and to attach a renderbuffer's image to a framebuffer object.
The name space for renderbuffer objects is the unsigned integers, with zero reserved for the GL. A renderbuffer object is created by binding an unused name to RENDERBUFFER_EXT. The binding is effected by calling
void BindRenderbufferExt( enum target, uint renderbuffer );
with <target> set to RENDERBUFFER_EXT and <renderbuffer> set to the unused name. If <renderbuffer> is not zero, then the resulting renderbuffer object is a new state vector, initialized with a zero-sized memory buffer, and comprising the state values listed in Table 8.nnn. Any previous binding to <target> is broken.
BindRenderbufferEXT may also be used to bind an existing renderbuffer object. If the bind is successful, no change is made to the state of the newly bound renderbuffer object, and any previous binding to <target> is broken.
While a renderbuffer object is bound, GL operations on the target to which it is bound affect the bound renderbuffer object, and queries of the target to which a renderbuffer object is bound return state from the bound object.
The name zero is reserved. A renderbuffer object cannot be created with the name zero. If <renderbuffer> is zero, then any previous binding to <target> is broken and the <target> binding is restored to the initial state.
In the initial state, the reserved name zero is bound to RENDERBUFFER_EXT. There is no renderbuffer object corresponding to the name zero, so client attempts to modify or query renderbuffer state for the target RENDERBUFFER_EXT while zero is bound will generate GL errors, as described in section 6.1.3.
Using GetIntegerv, the current RENDERBUFFER_EXT binding can be queried as RENDERBUFFER_BINDING_EXT.
Renderbuffer objects are deleted by calling
void DeleteRenderbuffersEXT( sizei n, const uint *renderbuffers );
where <renderbuffers> contains n names of renderbuffer objects to be deleted. After a renderbuffer object is deleted, it has no contents, and its name is again unused. If a renderbuffer that is currently bound to RENDERBUFFER_EXT is deleted, it is as though BindRenderbufferEXT had been executed with the <target> RENDERBUFFER_EXT and <name> of zero. Additionally, special care must be taken when deleting a renderbuffer if the image of the renderbuffer is attached to a framebuffer object. (See section 4.4.2.2 for details). Unused names in <renderbuffers> are silently ignored, as is the value zero. Based On: boolean IsRenderbufferEXT(uint renderbuffer);
Definition at line 146 of file TAPsGLEXTFrameBufferObject.cpp.
00147 { 00148 assert( i < GetSize() ); 00149 if ( glIsRenderbufferEXT( m_pgluiID[i] ) == GL_TRUE ) 00150 return true; 00151 return false; 00152 }
| void GLEXTFrameBufferObject::ProtectedBindFrameBuffer | ( | GLuint | i | ) | [inline, protected] |
Unbind the current frame buffer and bind this frame buffer.
Definition at line 445 of file TAPsGLEXTFrameBufferObject.cpp.
00446 { 00447 GLint bindingID; 00448 glGetIntegerv( GL_FRAMEBUFFER_BINDING_EXT, &bindingID ); 00449 m_pgluiID_StackValue[i] = static_cast<GLuint>( bindingID ); 00450 if ( m_pgluiID[i] != m_pgluiID_StackValue[i] ) { 00451 glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_pgluiID[i] ); 00452 } 00453 }
| void GLEXTFrameBufferObject::ProtectedBindRenderBuffer | ( | GLuint | i | ) | [inline, protected] |
Unbind the current render buffer and bind this render buffer.
Definition at line 464 of file TAPsGLEXTFrameBufferObject.cpp.
00465 { 00466 GLint bindingID; 00467 glGetIntegerv( GL_RENDERBUFFER_BINDING_EXT, &bindingID ); 00468 m_pgluiID_StackValue[i] = static_cast<GLuint>( bindingID ); 00469 if ( m_pgluiID[i] != m_pgluiID_StackValue[i] ) { 00470 glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, m_pgluiID[i] ); 00471 } 00472 }
| void GLEXTFrameBufferObject::ProtectedUnbindFrameBuffer | ( | GLuint | i | ) | [inline, protected] |
Unbind the this frame buffer and bind the previous frame buffer.
Definition at line 456 of file TAPsGLEXTFrameBufferObject.cpp.
00457 { 00458 if ( m_pgluiID[i] != m_pgluiID_StackValue[i] ) { 00459 glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, m_pgluiID_StackValue[i] ); 00460 } 00461 }
| void GLEXTFrameBufferObject::ProtectedUnbindRenderBuffer | ( | GLuint | i | ) | [inline, protected] |
Unbind the this render buffer and bind the previous render buffer.
Definition at line 475 of file TAPsGLEXTFrameBufferObject.cpp.
00476 { 00477 if ( m_pgluiID[i] != m_pgluiID_StackValue[i] ) { 00478 glBindRenderbufferEXT( GL_RENDERBUFFER_EXT, m_pgluiID_StackValue[i] ); 00479 } 00480 }
| void GLEXTFrameBufferObject::RenderBufferStorage | ( | GLuint | i, | |
| GLenum | internalformat, | |||
| GLsizei | width, | |||
| GLsizei | height | |||
| ) | [inline] |
Definition at line 182 of file TAPsGLEXTFrameBufferObject.cpp.
00184 { 00185 //--------------------------------------------------------------- 00186 // Check againt max size 00187 GLint maxSize = InquireMaxRenderBufferSize(); 00188 if ( width > maxSize || height > maxSize ) { 00189 return; 00190 #ifdef TAPs_USE_WXWIDGETS 00191 wxLogError( wxT( 00192 "ERROR: GLEXTFrameBufferObject::RenderBufferStorage(): \ 00193 Max size (%d) is less than width (%d) and/or height (%d)!" ), 00194 maxSize, width, height ); 00195 #else 00196 std::cerr << "ERROR: GLEXTFrameBufferObject::RenderBufferStorage(): " 00197 << "Max size (" << maxSize << ") is less than width (" 00198 << width << ") and/or height (" << height << ")!" 00199 << std::endl; 00200 #endif 00201 return; 00202 } 00203 //--------------------------------------------------------------- 00204 ProtectedBindRenderBuffer( i ); 00205 //--------------------------------------------------------------- 00206 glRenderbufferStorageEXT( GL_RENDERBUFFER_EXT, internalformat, width, height ); 00207 //--------------------------------------------------------------- 00208 ProtectedUnbindRenderBuffer( i ); 00209 //--------------------------------------------------------------- 00210 }
| void GLEXTFrameBufferObject::RenderBufferStorage | ( | GLenum | internalformat, | |
| GLsizei | width, | |||
| GLsizei | height | |||
| ) | [inline] |
Based On: void RenderbufferStorageEXT(enum target, enum internalformat, sizei width, sizei height);
Establishes the data storage, format, and dimensions of a renderbuffer object's image. <target> must be RENDERBUFFER_EXT. <internalformat> must be color-renderable, depth-renderable, or stencil-renderable (as defined in section 4.4.4). <width> and <height> are the dimensions in pixels of the renderbuffer. If either <width> or <height> is greater than MAX_RENDERBUFFER_SIZE_EXT, the the error INVALID_VALUE is generated. If the GL is unable to create a data store of the requested size, the error OUT_OF_MEMORY is generated. RenderbufferStorageEXT deletes any existing data store for the renderbuffer and the contents of the data store after calling RenderbufferStorageEXT are undefined.
Sized Base S
Internal Format Internal format Bits
--------------- --------------- ----
STENCIL_INDEX1_EXT STENCIL_INDEX 1
STENCIL_INDEX4_EXT STENCIL_INDEX 4
STENCIL_INDEX8_EXT STENCIL_INDEX 8
STENCIL_INDEX16_EXT STENCIL_INDEX 16
------------------------------------------------------------------
Table 2.nnn Desired component resolution for each sized internal format that can be used only with renderbuffers.
Definition at line 258 of file TAPsGLEXTFrameBufferObject.hpp.
00260 { RenderBufferStorage( 0, internalformat, width, height ); }
| static void GLEXTFrameBufferObject::UnbindAllFrameBuffers | ( | ) | [inline, static] |
| static void GLEXTFrameBufferObject::UnbindAllRenderBuffers | ( | ) | [inline, static] |
BEGIN_NAMESPACE_TAPs__OpenGL unsigned int GLEXTFrameBufferObject::g_uiObjCounters = 0 [static, protected] |
Based on GL_EXT_framebuffer_object from http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt with Last Modified Date: April 5, 2006.
Definition at line 773 of file TAPsGLEXTFrameBufferObject.hpp.
BufferType GLEXTFrameBufferObject::m_eBufferType [protected] |
Definition at line 774 of file TAPsGLEXTFrameBufferObject.hpp.
GLuint GLEXTFrameBufferObject::m_gluiSize [protected] |
Definition at line 775 of file TAPsGLEXTFrameBufferObject.hpp.
GLuint* GLEXTFrameBufferObject::m_pgluiID [protected] |
Definition at line 776 of file TAPsGLEXTFrameBufferObject.hpp.
GLuint* GLEXTFrameBufferObject::m_pgluiID_StackValue [protected] |
Definition at line 777 of file TAPsGLEXTFrameBufferObject.hpp.
1.5.6