Qyoto
4.0.5
Qyoto is a C# language binding for Qt
|
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object. More...
Public Types | |
enum | Attachment { CombinedDepthStencil = 1, Depth = 2, NoAttachment = 0 } |
More... | |
Public Types inherited from QtGui.QPaintDevice | |
enum | PaintDeviceMetric { PdmDepth = 6, PdmDpiX = 7, PdmDpiY = 8, PdmHeight = 2, PdmHeightMM = 4, PdmNumColors = 5, PdmPhysicalDpiX = 9, PdmPhysicalDpiY = 10, PdmWidth = 1, PdmWidthMM = 3 } |
More... | |
Public Member Functions | |
QGLFramebufferObject (QSize size) | |
| |
QGLFramebufferObject (QSize size, QGLFramebufferObjectFormat format) | |
| |
QGLFramebufferObject (QSize size, QGLFramebufferObject.Attachment attachment) | |
| |
QGLFramebufferObject (QSize size, QGLFramebufferObject.Attachment attachment, int target) | |
| |
QGLFramebufferObject (QSize size, QGLFramebufferObject.Attachment attachment, int target, int internal_format) | |
| |
QGLFramebufferObject (QSize size, int target) | |
| |
QGLFramebufferObject (int width, int height) | |
| |
QGLFramebufferObject (int width, int height, QGLFramebufferObjectFormat format) | |
| |
QGLFramebufferObject (int width, int height, QGLFramebufferObject.Attachment attachment) | |
| |
QGLFramebufferObject (int width, int height, QGLFramebufferObject.Attachment attachment, int target) | |
| |
QGLFramebufferObject (int width, int height, QGLFramebufferObject.Attachment attachment, int target, int internal_format) | |
| |
QGLFramebufferObject (int width, int height, int target) | |
| |
override void | CreateProxy () |
new QGLFramebufferObject.Attachment | attachment () |
| |
new bool | Bind () |
| |
override int | DevType () |
new void | DrawTexture (QRectF target, uint textureId) |
| |
new void | DrawTexture (QPointF point, uint textureId) |
| |
new void | DrawTexture (QRectF target, uint textureId, int textureTarget) |
| |
new void | DrawTexture (QPointF point, uint textureId, int textureTarget) |
| |
new QGLFramebufferObjectFormat | Format () |
| |
new uint | Handle () |
| |
new bool | IsBound () |
| |
new bool | IsValid () |
| |
override QPaintEngine | PaintEngine () |
| |
new bool | Release () |
| |
new QSize | Size () |
| |
new uint | Texture () |
| |
new QImage | ToImage () |
| |
new void | Dispose () |
Public Member Functions inherited from QtGui.QPaintDevice | |
new int | ColorCount () |
| |
new int | Depth () |
| |
virtual System.IntPtr | GetDC () |
new int | Height () |
| |
new int | HeightMM () |
| |
new int | LogicalDpiX () |
| |
new int | LogicalDpiY () |
| |
new int | NumColors () |
| |
new bool | PaintingActive () |
| |
new int | PhysicalDpiX () |
| |
new int | PhysicalDpiY () |
| |
virtual void | ReleaseDC (System.IntPtr hdc) |
new int | Width () |
| |
new int | WidthMM () |
| |
new void | Dispose () |
Public Member Functions inherited from QtGui.IQPaintDevice | |
new int | ColorCount () |
new int | Depth () |
int | DevType () |
System.IntPtr | GetDC () |
new int | Height () |
new int | HeightMM () |
new int | LogicalDpiX () |
new int | LogicalDpiY () |
new int | NumColors () |
QPaintEngine | PaintEngine () |
new bool | PaintingActive () |
new int | PhysicalDpiX () |
new int | PhysicalDpiY () |
void | ReleaseDC (System.IntPtr hdc) |
new int | Width () |
new int | WidthMM () |
Static Public Member Functions | |
static bool | BindDefault () |
static void | BlitFramebuffer (QGLFramebufferObject target, QRect targetRect, QGLFramebufferObject source, QRect sourceRect) |
| |
static void | BlitFramebuffer (QGLFramebufferObject target, QRect targetRect, QGLFramebufferObject source, QRect sourceRect, int buffers) |
| |
static void | BlitFramebuffer (QGLFramebufferObject target, QRect targetRect, QGLFramebufferObject source, QRect sourceRect, int buffers, int filter) |
| |
static bool | HasOpenGLFramebufferBlit () |
| |
static bool | HasOpenGLFramebufferObjects () |
| |
Protected Member Functions | |
QGLFramebufferObject (System.Type dummy) | |
override int | Metric (QPaintDevice.PaintDeviceMetric metric) |
| |
Protected Member Functions inherited from QtGui.QPaintDevice | |
QPaintDevice (System.Type dummy) | |
QPaintDevice () | |
| |
Additional Inherited Members | |
Protected Attributes inherited from QtGui.QPaintDevice | |
SmokeInvocation | interceptor |
Properties inherited from QtGui.QPaintDevice | |
virtual System.IntPtr | SmokeObject [get, set] |
new ushort | Painters [get, set] |
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object.
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object, defined by the GL_EXT_framebuffer_object extension. In addition it provides a rendering surface that can be painted on with a QPainter, rendered to using native GL calls, or both. This surface can be bound and used as a regular texture in your own GL drawing code. By default, the QGLFramebufferObject class generates a 2D GL texture (using the GL_TEXTURE_2D target), which is used as the internal rendering target.
It is important to have a current GL context when creating a QGLFramebufferObject, otherwise initialization will fail.
OpenGL framebuffer objects and pbuffers (see QGLPixelBuffer) can both be used to render to offscreen surfaces, but there are a number of advantages with using framebuffer objects instead of pbuffers:
A framebuffer object does not require a separate rendering context, so no context switching will occur when switching rendering targets. There is an overhead involved in switching targets, but in general it is cheaper than a context switch to a pbuffer.
Rendering to dynamic textures (i.e. render-to-texture functionality) works on all platforms. No need to do explicit copy calls from a render buffer into a texture, as was necessary on systems that did not support the render_texture extension.
It is possible to attach several rendering buffers (or texture objects) to the same framebuffer object, and render to all of them without doing a context switch.
The OpenGL framebuffer extension is a pure GL extension with no system dependant WGL, CGL, or GLX parts. This makes using framebuffer objects more portable.
When using a QPainter to paint to a QGLFramebufferObject you should take care that the QGLFramebufferObject is created with the CombinedDepthStencil attachment for QPainter to be able to render correctly. Note that you need to create a QGLFramebufferObject with more than one sample per pixel for primitives to be antialiased when drawing using a QPainter. To create a multisample framebuffer object you should use one of the constructors that take a QGLFramebufferObject parameter, and set the QGLFramebufferObject::samples() property to a non-zero value.
When painting to a QGLFramebufferObject using QPainter, the state of the current GL context will be altered by the paint engine to reflect its needs. Applications should not rely upon the GL state being reset to its original conditions, particularly the current shader program, GL viewport, texture units, and drawing modes.
For multisample framebuffer objects a color render buffer is created, otherwise a texture with the specified texture target is created. The color render buffer or texture will have the specified internal format, and will be bound to the GL_COLOR_ATTACHMENT0 attachment in the framebuffer object.
If you want to use a framebuffer object with multisampling enabled as a texture, you first need to copy from it to a regular framebuffer object using QGLContext::blitFramebuffer().
Threading
As of Qt 4.8, it's possible to draw into a QGLFramebufferObject using a QPainter in a separate thread. Note that OpenGL 2.0 or OpenGL ES 2.0 is required for this to work. Also, under X11, it's necessary to set the Qt::AA_X11InitThreads application attribute.
See also Framebuffer Object Example.
This enum type is used to configure the depth and stencil buffers attached to the framebuffer object when it is created.
This enum was introduced or modified in Qt 4.3.
See also attachment().
|
protected |
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | QSize | size | ) |
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.
The target parameter is used to specify the GL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.
The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | QSize | size, |
QGLFramebufferObjectFormat | format | ||
) |
This is an overloaded function.
Constructs an OpenGL framebuffer object of the given size based on the supplied format.
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | QSize | size, |
QGLFramebufferObject.Attachment | attachment | ||
) |
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.
The target parameter is used to specify the GL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.
The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | QSize | size, |
QGLFramebufferObject.Attachment | attachment, | ||
int | target | ||
) |
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.
The target parameter is used to specify the GL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.
The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | QSize | size, |
QGLFramebufferObject.Attachment | attachment, | ||
int | target, | ||
int | internal_format | ||
) |
This is an overloaded function.
Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given size.
The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internal_format the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | QSize | size, |
int | target | ||
) |
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.
The target parameter is used to specify the GL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.
The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | int | width, |
int | height | ||
) |
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.
The target parameter is used to specify the GL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.
The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | int | width, |
int | height, | ||
QGLFramebufferObjectFormat | format | ||
) |
This is an overloaded function.
Constructs an OpenGL framebuffer object of the given width and height based on the supplied format.
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | int | width, |
int | height, | ||
QGLFramebufferObject.Attachment | attachment | ||
) |
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.
The target parameter is used to specify the GL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.
The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | int | width, |
int | height, | ||
QGLFramebufferObject.Attachment | attachment, | ||
int | target | ||
) |
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.
The target parameter is used to specify the GL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.
By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.
The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | int | width, |
int | height, | ||
QGLFramebufferObject.Attachment | attachment, | ||
int | target, | ||
int | internal_format | ||
) |
This is an overloaded function.
Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given width and height.
The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internal_format the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.
See also size(), texture(), and attachment().
QtOpenGL.QGLFramebufferObject.QGLFramebufferObject | ( | int | width, |
int | height, | ||
int | target | ||
) |
This is an overloaded function.
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the given width and height.
See also size() and texture().
new QGLFramebufferObject.Attachment QtOpenGL.QGLFramebufferObject.attachment | ( | ) |
Returns the status of the depth and stencil buffers attached to this framebuffer object.
new bool QtOpenGL.QGLFramebufferObject.Bind | ( | ) |
Switches rendering from the default, windowing system provided framebuffer to this framebuffer object. Returns true upon success, false otherwise.
See also release().
|
static |
|
static |
Blits from the sourceRect rectangle in the source framebuffer object to the targetRect rectangle in the target framebuffer object.
If source or target is 0, the default framebuffer will be used instead of a framebuffer object as source or target respectively.
The buffers parameter should be a mask consisting of any combination of GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. Any buffer type that is not present both in the source and target buffers is ignored.
The sourceRect and targetRect rectangles may have different sizes; in this case buffers should not contain GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT. The filter parameter should be set to GL_LINEAR or GL_NEAREST, and specifies whether linear or nearest interpolation should be used when scaling is performed.
If source equals target a copy is performed within the same buffer. Results are undefined if the source and target rectangles overlap and have different sizes. The sizes must also be the same if any of the framebuffer objects are multisample framebuffers.
Note that the scissor test will restrict the blit area if enabled.
This function will have no effect unless hasOpenGLFramebufferBlit() returns true.
This function was introduced in Qt 4.6.
See also hasOpenGLFramebufferBlit().
|
static |
Blits from the sourceRect rectangle in the source framebuffer object to the targetRect rectangle in the target framebuffer object.
If source or target is 0, the default framebuffer will be used instead of a framebuffer object as source or target respectively.
The buffers parameter should be a mask consisting of any combination of GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. Any buffer type that is not present both in the source and target buffers is ignored.
The sourceRect and targetRect rectangles may have different sizes; in this case buffers should not contain GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT. The filter parameter should be set to GL_LINEAR or GL_NEAREST, and specifies whether linear or nearest interpolation should be used when scaling is performed.
If source equals target a copy is performed within the same buffer. Results are undefined if the source and target rectangles overlap and have different sizes. The sizes must also be the same if any of the framebuffer objects are multisample framebuffers.
Note that the scissor test will restrict the blit area if enabled.
This function will have no effect unless hasOpenGLFramebufferBlit() returns true.
This function was introduced in Qt 4.6.
See also hasOpenGLFramebufferBlit().
|
static |
Blits from the sourceRect rectangle in the source framebuffer object to the targetRect rectangle in the target framebuffer object.
If source or target is 0, the default framebuffer will be used instead of a framebuffer object as source or target respectively.
The buffers parameter should be a mask consisting of any combination of GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. Any buffer type that is not present both in the source and target buffers is ignored.
The sourceRect and targetRect rectangles may have different sizes; in this case buffers should not contain GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT. The filter parameter should be set to GL_LINEAR or GL_NEAREST, and specifies whether linear or nearest interpolation should be used when scaling is performed.
If source equals target a copy is performed within the same buffer. Results are undefined if the source and target rectangles overlap and have different sizes. The sizes must also be the same if any of the framebuffer objects are multisample framebuffers.
Note that the scissor test will restrict the blit area if enabled.
This function will have no effect unless hasOpenGLFramebufferBlit() returns true.
This function was introduced in Qt 4.6.
See also hasOpenGLFramebufferBlit().
|
virtual |
Reimplemented from QtGui.QPaintDevice.
|
virtual |
Reimplemented from QtGui.QPaintDevice.
new void QtOpenGL.QGLFramebufferObject.Dispose | ( | ) |
new void QtOpenGL.QGLFramebufferObject.DrawTexture | ( | QRectF | target, |
uint | textureId | ||
) |
Draws the given texture, textureId, to the given target rectangle, target, in OpenGL model space. The textureTarget should be a 2D texture target.
The framebuffer object should be bound when calling this function.
Equivalent to the corresponding QGLContext::drawTexture().
This function was introduced in Qt 4.4.
new void QtOpenGL.QGLFramebufferObject.DrawTexture | ( | QPointF | point, |
uint | textureId | ||
) |
Draws the given texture, textureId, to the given target rectangle, target, in OpenGL model space. The textureTarget should be a 2D texture target.
The framebuffer object should be bound when calling this function.
Equivalent to the corresponding QGLContext::drawTexture().
This function was introduced in Qt 4.4.
new void QtOpenGL.QGLFramebufferObject.DrawTexture | ( | QRectF | target, |
uint | textureId, | ||
int | textureTarget | ||
) |
Draws the given texture, textureId, to the given target rectangle, target, in OpenGL model space. The textureTarget should be a 2D texture target.
The framebuffer object should be bound when calling this function.
Equivalent to the corresponding QGLContext::drawTexture().
This function was introduced in Qt 4.4.
new void QtOpenGL.QGLFramebufferObject.DrawTexture | ( | QPointF | point, |
uint | textureId, | ||
int | textureTarget | ||
) |
Draws the given texture, textureId, at the given point in OpenGL model space. The textureTarget should be a 2D texture target.
The framebuffer object should be bound when calling this function.
Equivalent to the corresponding QGLContext::drawTexture().
This function was introduced in Qt 4.4.
new QGLFramebufferObjectFormat QtOpenGL.QGLFramebufferObject.Format | ( | ) |
Returns the format of this framebuffer object.
new uint QtOpenGL.QGLFramebufferObject.Handle | ( | ) |
Returns the GL framebuffer object handle for this framebuffer object (returned by the glGenFrameBuffersEXT() function). This handle can be used to attach new images or buffers to the framebuffer. The user is responsible for cleaning up and destroying these objects.
|
static |
Returns true if the OpenGL GL_EXT_framebuffer_blit extension is present on this system; otherwise returns false.
This function was introduced in Qt 4.6.
See also blitFramebuffer().
|
static |
Returns true if the OpenGL GL_EXT_framebuffer_object extension is present on this system; otherwise returns false.
new bool QtOpenGL.QGLFramebufferObject.IsBound | ( | ) |
Returns true if the framebuffer object is currently bound to a context, otherwise false is returned.
This function was introduced in Qt 4.5.
new bool QtOpenGL.QGLFramebufferObject.IsValid | ( | ) |
Returns true if the framebuffer object is valid.
The framebuffer can become invalid if the initialization process fails, the user attaches an invalid buffer to the framebuffer object, or a non-power of two width/height is specified as the texture size if the texture target is GL_TEXTURE_2D. The non-power of two limitation does not apply if the OpenGL version is 2.0 or higher, or if the GL_ARB_texture_non_power_of_two extension is present.
The framebuffer can also become invalid if the QGLContext that the framebuffer was created within is destroyed and there are no other shared contexts that can take over ownership of the framebuffer.
|
protectedvirtual |
Reimplemented from QPaintDevice::metric().
Reimplemented from QtGui.QPaintDevice.
|
virtual |
Reimplemented from QPaintDevice::paintEngine().
Implements QtGui.QPaintDevice.
new bool QtOpenGL.QGLFramebufferObject.Release | ( | ) |
Switches rendering back to the default, windowing system provided framebuffer. Returns true upon success, false otherwise.
See also bind().
new QSize QtOpenGL.QGLFramebufferObject.Size | ( | ) |
Returns the size of the texture attached to this framebuffer object.
new uint QtOpenGL.QGLFramebufferObject.Texture | ( | ) |
Returns the texture id for the texture attached as the default rendering target in this framebuffer object. This texture id can be bound as a normal texture in your own GL code.
If a multisample framebuffer object is used then the value returned from this function will be invalid.
new QImage QtOpenGL.QGLFramebufferObject.ToImage | ( | ) |
Returns the contents of this framebuffer object as a QImage.