|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.opengl.QGLFramebufferObject
public class QGLFramebufferObject
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:
Note that QPainter antialiasing of drawing primitives will not work when using a QGLFramebufferObject as a paintdevice. This is because sample buffers, which are needed for antialiasing, are not yet supported in application-defined framebuffer objects. However, an extension to solve this has already been approved by the OpenGL ARB (GL_EXT_framebuffer_multisample), and will most likely be available in the near future.
Object Example| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
|---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
| Constructor Summary | |
|---|---|
QGLFramebufferObject(int width,
int height)
Equivalent to QGLFramebufferObject(width, height, GL_TEXTURE_2D). |
|
QGLFramebufferObject(int width,
int height,
int target)
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the given width and height. |
|
QGLFramebufferObject(QSize size)
Equivalent to QGLFramebufferObject(size, GL_TEXTURE_2D). |
|
QGLFramebufferObject(QSize size,
int target)
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the size size. |
|
| Method Summary | |
|---|---|
boolean |
bind()
Switches rendering from the default, windowing system provided framebuffer to this framebuffer object. |
int |
depth()
Returns the bit depth (number of bit planes) of the paint device. |
int |
devType()
This function is reimplemented for internal reasons. |
static QGLFramebufferObject |
fromNativePointer(QNativePointer nativePointer)
This function returns the QGLFramebufferObject instance pointed to by nativePointer |
int |
handle()
Returns the GL framebuffer object handle for this framebuffer object (returned by the glGenFrameBuffersEXT() function). |
static boolean |
hasOpenGLFramebufferObjects()
Returns true if the OpenGL GL_EXT_framebuffer_object extension is present on this system; otherwise returns false. |
int |
height()
Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget). |
int |
heightMM()
Returns the height of the paint device in millimeters. |
boolean |
isValid()
Returns true if the framebuffer object is valid. |
int |
logicalDpiX()
Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. |
int |
logicalDpiY()
Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. |
int |
metric(QPaintDevice.PaintDeviceMetric metric)
Returns the metric information for the given paint device metric. |
int |
numColors()
Returns the number of different colors available for the paint device. |
QPaintEngine |
paintEngine()
This function is reimplemented for internal reasons. |
boolean |
paintingActive()
Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false. |
int |
physicalDpiX()
Returns the horizontal resolution of the device in dots per inch. |
int |
physicalDpiY()
Returns the horizontal resolution of the device in dots per inch. |
boolean |
release()
Switches rendering back to the default, windowing system provided framebuffer. |
QSize |
size()
Returns the size of the texture attached to this framebuffer object. |
int |
texture()
Returns the texture id for the texture attached as the default rendering target in this framebuffer object. |
QImage |
toImage()
Returns the contents of this framebuffer object as a QImage. |
int |
width()
Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget). |
int |
widthMM()
Returns the width of the paint device in millimeters. |
| Methods inherited from class com.trolltech.qt.QtJambiObject |
|---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
| Methods inherited from class com.trolltech.qt.QSignalEmitter |
|---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.trolltech.qt.QtJambiInterface |
|---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
| Constructor Detail |
|---|
public QGLFramebufferObject(QSize size)
Equivalent to QGLFramebufferObject(size, GL_TEXTURE_2D).
public 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.
It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization will fail.
public QGLFramebufferObject(int width,
int height)
Equivalent to QGLFramebufferObject(width, height, GL_TEXTURE_2D).
public QGLFramebufferObject(int width,
int height,
int target)
Constructs an OpenGL framebuffer object and binds a 2D GL texture to the buffer of the given width and height.
| Method Detail |
|---|
public final boolean bind()
Switches rendering from the default, windowing system provided framebuffer to this framebuffer object. Returns true upon success, false otherwise.
public final int depth()
Returns the bit depth (number of bit planes) of the paint device.
depth in interface QPaintDeviceInterfacepublic final int 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.
public final int height()
Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).
height in interface QPaintDeviceInterfacepublic final int heightMM()
Returns the height of the paint device in millimeters.
heightMM in interface QPaintDeviceInterfacepublic final boolean 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 2 width/height is specified as the texture size if the texture target is GL_TEXTURE_2D.
public final int logicalDpiX()
Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM, but it varies on Windows.
Note that if the logicalDpiX doesn't equal the physicalDpiX, the corresponding QPaintEngine must handle the resolution mapping.
logicalDpiX in interface QPaintDeviceInterfacepublic final int logicalDpiY()
Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM, but it varies on Windows.
Note that if the logicalDpiY doesn't equal the physicalDpiY, the corresponding QPaintEngine must handle the resolution mapping.
logicalDpiY in interface QPaintDeviceInterfacepublic final int numColors()
Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.
numColors in interface QPaintDeviceInterfacepublic final boolean paintingActive()
Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.
paintingActive in interface QPaintDeviceInterfacepublic final int physicalDpiX()
Returns the horizontal resolution of the device in dots per inch.
Note that if the physicalDpiX doesn't equal the logicalDpiX, the corresponding QPaintEngine must handle the resolution mapping.
physicalDpiX in interface QPaintDeviceInterfacepublic final int physicalDpiY()
Returns the horizontal resolution of the device in dots per inch.
Note that if the physicalDpiY doesn't equal the logicalDpiY, the corresponding QPaintEngine must handle the resolution mapping.
physicalDpiY in interface QPaintDeviceInterfacepublic final boolean release()
Switches rendering back to the default, windowing system provided framebuffer. Returns true upon success, false otherwise.
public final QSize size()
Returns the size of the texture attached to this framebuffer object.
public final int 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.
public final QImage toImage()
Returns the contents of this framebuffer object as a QImage.
public final int width()
Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).
width in interface QPaintDeviceInterfacepublic final int widthMM()
Returns the width of the paint device in millimeters.
widthMM in interface QPaintDeviceInterfacepublic int devType()
This function is reimplemented for internal reasons.
devType in interface QPaintDeviceInterfacepublic int metric(QPaintDevice.PaintDeviceMetric metric)
Returns the metric information for the given paint device metric.
metric in interface QPaintDeviceInterfacepublic QPaintEngine paintEngine()
This function is reimplemented for internal reasons.
paintEngine in interface QPaintDeviceInterfacepublic static boolean hasOpenGLFramebufferObjects()
Returns true if the OpenGL GL_EXT_framebuffer_object extension is present on this system; otherwise returns false.
public static QGLFramebufferObject fromNativePointer(QNativePointer nativePointer)
nativePointer - the QNativePointer of which object should be returned.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||