1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
|
'''OpenGL extension EXT.framebuffer_object
Overview (from the spec)
This extension defines a simple interface for drawing to rendering
destinations other than the buffers provided to the GL by the
window-system.
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.
By allowing the use of a framebuffer-attachable image as a rendering
destination, this extension enables a form of "offscreen" rendering.
Furthermore, "render to texture" is supported by allowing the images
of a texture to be used as framebuffer-attachable images. A
particular image of a texture object is selected for use as a
framebuffer-attachable image by specifying the mipmap level, cube
map face (for a cube map texture), and z-offset (for a 3D texture)
that identifies the image. The "render to texture" semantics of
this extension are similar to performing traditional rendering to
the framebuffer, followed immediately by a call to CopyTexSubImage.
However, by using this extension instead, an application can achieve
the same effect, but with the advantage that the GL can usually
eliminate the data copy that would have been incurred by calling
CopyTexSubImage.
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.
Previous extensions that enabled rendering to a texture have been
much more complicated. One example is the combination of
ARB_pbuffer and ARB_render_texture, both of which are window-system
extensions. This combination requires calling MakeCurrent, an
operation that may be expensive, to switch between the window and
the pbuffer drawables. An application must create one pbuffer per
renderable texture in order to portably use ARB_render_texture. An
application must maintain at least one GL context per texture
format, because each context can only operate on a single
pixelformat or FBConfig. All of these characteristics make
ARB_render_texture both inefficient and cumbersome to use.
EXT_framebuffer_object, on the other hand, is both simpler to use
and more efficient than ARB_render_texture. The
EXT_framebuffer_object API is contained wholly within the GL API and
has no (non-portable) window-system components. Under
EXT_framebuffer_object, it is not necessary to create a second GL
context when rendering to a texture image whose format differs from
that of the window. Finally, unlike the pbuffers of
ARB_render_texture, a single framebuffer object can facilitate
rendering to an unlimited number of texture objects.
The official definition of this extension is available here:
http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_EXT_framebuffer_object'
GL_INVALID_FRAMEBUFFER_OPERATION_EXT = constant.Constant( 'GL_INVALID_FRAMEBUFFER_OPERATION_EXT', 0x506 )
GL_MAX_RENDERBUFFER_SIZE_EXT = constant.Constant( 'GL_MAX_RENDERBUFFER_SIZE_EXT', 0x84E8 )
glget.addGLGetConstant( GL_MAX_RENDERBUFFER_SIZE_EXT, (1,) )
GL_FRAMEBUFFER_BINDING_EXT = constant.Constant( 'GL_FRAMEBUFFER_BINDING_EXT', 0x8CA6 )
glget.addGLGetConstant( GL_FRAMEBUFFER_BINDING_EXT, (1,) )
GL_RENDERBUFFER_BINDING_EXT = constant.Constant( 'GL_RENDERBUFFER_BINDING_EXT', 0x8CA7 )
glget.addGLGetConstant( GL_RENDERBUFFER_BINDING_EXT, (1,) )
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT = constant.Constant( 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT', 0x8CD0 )
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT = constant.Constant( 'GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT', 0x8CD1 )
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT = constant.Constant( 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT', 0x8CD2 )
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT = constant.Constant( 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT', 0x8CD3 )
GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT = constant.Constant( 'GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT', 0x8CD4 )
GL_FRAMEBUFFER_COMPLETE_EXT = constant.Constant( 'GL_FRAMEBUFFER_COMPLETE_EXT', 0x8CD5 )
GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT', 0x8CD6 )
GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT', 0x8CD7 )
GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT', 0x8CD9 )
GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT', 0x8CDA )
GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT', 0x8CDB )
GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT = constant.Constant( 'GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT', 0x8CDC )
GL_FRAMEBUFFER_UNSUPPORTED_EXT = constant.Constant( 'GL_FRAMEBUFFER_UNSUPPORTED_EXT', 0x8CDD )
GL_MAX_COLOR_ATTACHMENTS_EXT = constant.Constant( 'GL_MAX_COLOR_ATTACHMENTS_EXT', 0x8CDF )
glget.addGLGetConstant( GL_MAX_COLOR_ATTACHMENTS_EXT, (1,) )
GL_COLOR_ATTACHMENT0_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT0_EXT', 0x8CE0 )
GL_COLOR_ATTACHMENT1_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT1_EXT', 0x8CE1 )
GL_COLOR_ATTACHMENT2_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT2_EXT', 0x8CE2 )
GL_COLOR_ATTACHMENT3_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT3_EXT', 0x8CE3 )
GL_COLOR_ATTACHMENT4_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT4_EXT', 0x8CE4 )
GL_COLOR_ATTACHMENT5_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT5_EXT', 0x8CE5 )
GL_COLOR_ATTACHMENT6_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT6_EXT', 0x8CE6 )
GL_COLOR_ATTACHMENT7_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT7_EXT', 0x8CE7 )
GL_COLOR_ATTACHMENT8_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT8_EXT', 0x8CE8 )
GL_COLOR_ATTACHMENT9_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT9_EXT', 0x8CE9 )
GL_COLOR_ATTACHMENT10_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT10_EXT', 0x8CEA )
GL_COLOR_ATTACHMENT11_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT11_EXT', 0x8CEB )
GL_COLOR_ATTACHMENT12_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT12_EXT', 0x8CEC )
GL_COLOR_ATTACHMENT13_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT13_EXT', 0x8CED )
GL_COLOR_ATTACHMENT14_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT14_EXT', 0x8CEE )
GL_COLOR_ATTACHMENT15_EXT = constant.Constant( 'GL_COLOR_ATTACHMENT15_EXT', 0x8CEF )
GL_DEPTH_ATTACHMENT_EXT = constant.Constant( 'GL_DEPTH_ATTACHMENT_EXT', 0x8D00 )
GL_STENCIL_ATTACHMENT_EXT = constant.Constant( 'GL_STENCIL_ATTACHMENT_EXT', 0x8D20 )
GL_FRAMEBUFFER_EXT = constant.Constant( 'GL_FRAMEBUFFER_EXT', 0x8D40 )
GL_RENDERBUFFER_EXT = constant.Constant( 'GL_RENDERBUFFER_EXT', 0x8D41 )
GL_RENDERBUFFER_WIDTH_EXT = constant.Constant( 'GL_RENDERBUFFER_WIDTH_EXT', 0x8D42 )
GL_RENDERBUFFER_HEIGHT_EXT = constant.Constant( 'GL_RENDERBUFFER_HEIGHT_EXT', 0x8D43 )
GL_RENDERBUFFER_INTERNAL_FORMAT_EXT = constant.Constant( 'GL_RENDERBUFFER_INTERNAL_FORMAT_EXT', 0x8D44 )
GL_STENCIL_INDEX1_EXT = constant.Constant( 'GL_STENCIL_INDEX1_EXT', 0x8D46 )
GL_STENCIL_INDEX4_EXT = constant.Constant( 'GL_STENCIL_INDEX4_EXT', 0x8D47 )
GL_STENCIL_INDEX8_EXT = constant.Constant( 'GL_STENCIL_INDEX8_EXT', 0x8D48 )
GL_STENCIL_INDEX16_EXT = constant.Constant( 'GL_STENCIL_INDEX16_EXT', 0x8D49 )
GL_RENDERBUFFER_RED_SIZE_EXT = constant.Constant( 'GL_RENDERBUFFER_RED_SIZE_EXT', 0x8D50 )
GL_RENDERBUFFER_GREEN_SIZE_EXT = constant.Constant( 'GL_RENDERBUFFER_GREEN_SIZE_EXT', 0x8D51 )
GL_RENDERBUFFER_BLUE_SIZE_EXT = constant.Constant( 'GL_RENDERBUFFER_BLUE_SIZE_EXT', 0x8D52 )
GL_RENDERBUFFER_ALPHA_SIZE_EXT = constant.Constant( 'GL_RENDERBUFFER_ALPHA_SIZE_EXT', 0x8D53 )
GL_RENDERBUFFER_DEPTH_SIZE_EXT = constant.Constant( 'GL_RENDERBUFFER_DEPTH_SIZE_EXT', 0x8D54 )
GL_RENDERBUFFER_STENCIL_SIZE_EXT = constant.Constant( 'GL_RENDERBUFFER_STENCIL_SIZE_EXT', 0x8D55 )
glIsRenderbufferEXT = platform.createExtensionFunction(
'glIsRenderbufferEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=constants.GLboolean,
argTypes=(constants.GLuint,),
doc = 'glIsRenderbufferEXT( GLuint(renderbuffer) ) -> constants.GLboolean',
argNames = ('renderbuffer',),
)
glBindRenderbufferEXT = platform.createExtensionFunction(
'glBindRenderbufferEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLuint,),
doc = 'glBindRenderbufferEXT( GLenum(target), GLuint(renderbuffer) ) -> None',
argNames = ('target', 'renderbuffer',),
)
glDeleteRenderbuffersEXT = platform.createExtensionFunction(
'glDeleteRenderbuffersEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLsizei, arrays.GLuintArray,),
doc = 'glDeleteRenderbuffersEXT( GLsizei(n), GLuintArray(renderbuffers) ) -> None',
argNames = ('n', 'renderbuffers',),
)
glGenRenderbuffersEXT = platform.createExtensionFunction(
'glGenRenderbuffersEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLsizei, arrays.GLuintArray,),
doc = 'glGenRenderbuffersEXT( GLsizei(n), GLuintArray(renderbuffers) ) -> None',
argNames = ('n', 'renderbuffers',),
)
glRenderbufferStorageEXT = platform.createExtensionFunction(
'glRenderbufferStorageEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLenum, constants.GLsizei, constants.GLsizei,),
doc = 'glRenderbufferStorageEXT( GLenum(target), GLenum(internalformat), GLsizei(width), GLsizei(height) ) -> None',
argNames = ('target', 'internalformat', 'width', 'height',),
)
glGetRenderbufferParameterivEXT = platform.createExtensionFunction(
'glGetRenderbufferParameterivEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLenum, arrays.GLintArray,),
doc = 'glGetRenderbufferParameterivEXT( GLenum(target), GLenum(pname), GLintArray(params) ) -> None',
argNames = ('target', 'pname', 'params',),
)
glIsFramebufferEXT = platform.createExtensionFunction(
'glIsFramebufferEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=constants.GLboolean,
argTypes=(constants.GLuint,),
doc = 'glIsFramebufferEXT( GLuint(framebuffer) ) -> constants.GLboolean',
argNames = ('framebuffer',),
)
glBindFramebufferEXT = platform.createExtensionFunction(
'glBindFramebufferEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLuint,),
doc = 'glBindFramebufferEXT( GLenum(target), GLuint(framebuffer) ) -> None',
argNames = ('target', 'framebuffer',),
)
glDeleteFramebuffersEXT = platform.createExtensionFunction(
'glDeleteFramebuffersEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLsizei, arrays.GLuintArray,),
doc = 'glDeleteFramebuffersEXT( GLsizei(n), GLuintArray(framebuffers) ) -> None',
argNames = ('n', 'framebuffers',),
)
glGenFramebuffersEXT = platform.createExtensionFunction(
'glGenFramebuffersEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLsizei, arrays.GLuintArray,),
doc = 'glGenFramebuffersEXT( GLsizei(n), GLuintArray(framebuffers) ) -> None',
argNames = ('n', 'framebuffers',),
)
glCheckFramebufferStatusEXT = platform.createExtensionFunction(
'glCheckFramebufferStatusEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=constants.GLenum,
argTypes=(constants.GLenum,),
doc = 'glCheckFramebufferStatusEXT( GLenum(target) ) -> constants.GLenum',
argNames = ('target',),
)
glFramebufferTexture1DEXT = platform.createExtensionFunction(
'glFramebufferTexture1DEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLenum, constants.GLenum, constants.GLuint, constants.GLint,),
doc = 'glFramebufferTexture1DEXT( GLenum(target), GLenum(attachment), GLenum(textarget), GLuint(texture), GLint(level) ) -> None',
argNames = ('target', 'attachment', 'textarget', 'texture', 'level',),
)
glFramebufferTexture2DEXT = platform.createExtensionFunction(
'glFramebufferTexture2DEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLenum, constants.GLenum, constants.GLuint, constants.GLint,),
doc = 'glFramebufferTexture2DEXT( GLenum(target), GLenum(attachment), GLenum(textarget), GLuint(texture), GLint(level) ) -> None',
argNames = ('target', 'attachment', 'textarget', 'texture', 'level',),
)
glFramebufferTexture3DEXT = platform.createExtensionFunction(
'glFramebufferTexture3DEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLenum, constants.GLenum, constants.GLuint, constants.GLint, constants.GLint,),
doc = 'glFramebufferTexture3DEXT( GLenum(target), GLenum(attachment), GLenum(textarget), GLuint(texture), GLint(level), GLint(zoffset) ) -> None',
argNames = ('target', 'attachment', 'textarget', 'texture', 'level', 'zoffset',),
)
glFramebufferRenderbufferEXT = platform.createExtensionFunction(
'glFramebufferRenderbufferEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLenum, constants.GLenum, constants.GLuint,),
doc = 'glFramebufferRenderbufferEXT( GLenum(target), GLenum(attachment), GLenum(renderbuffertarget), GLuint(renderbuffer) ) -> None',
argNames = ('target', 'attachment', 'renderbuffertarget', 'renderbuffer',),
)
glGetFramebufferAttachmentParameterivEXT = platform.createExtensionFunction(
'glGetFramebufferAttachmentParameterivEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum, constants.GLenum, constants.GLenum, arrays.GLintArray,),
doc = 'glGetFramebufferAttachmentParameterivEXT( GLenum(target), GLenum(attachment), GLenum(pname), GLintArray(params) ) -> None',
argNames = ('target', 'attachment', 'pname', 'params',),
)
glGenerateMipmapEXT = platform.createExtensionFunction(
'glGenerateMipmapEXT', dll=platform.GL,
extension=EXTENSION_NAME,
resultType=None,
argTypes=(constants.GLenum,),
doc = 'glGenerateMipmapEXT( GLenum(target) ) -> None',
argNames = ('target',),
)
def glInitFramebufferObjectEXT():
'''Return boolean indicating whether this extension is available'''
return extensions.hasGLExtension( EXTENSION_NAME )
|