bioformats
5.1.0
|
Top level GL window. More...
#include <ome/qtwidgets/GLWindow.h>
Public Slots | |
void | renderLater () |
Render a frame at the next opportunity. More... | |
void | renderNow () |
Render a frame immediately. More... | |
void | logMessage (QOpenGLDebugMessage message) |
Log a GL debug message. More... | |
Public Member Functions | |
GLWindow (QWindow *parent=0) | |
Create a GL window. More... | |
~GLWindow () | |
Destructor. | |
virtual void | render (QPainter *painter) |
Render using a QPainter. More... | |
virtual void | render () |
Render using OpenGL. More... | |
virtual void | initialize () |
Handle initialization of the window. | |
virtual void | resize () |
Handle resizing of the window. | |
void | setAnimating (bool animating) |
Enable or disable animating. More... | |
Protected Member Functions | |
bool | event (QEvent *event) |
Handle events. More... | |
void | exposeEvent (QExposeEvent *event) |
Handle expose events. More... | |
void | resizeEvent (QResizeEvent *event) |
Handle resize events. More... | |
QOpenGLContext * | context () const |
Get GL context. More... | |
void | makeCurrent () |
Make the GL context for this window the current context. | |
Private Attributes | |
bool | update_pending |
Update at next opportunity? | |
bool | animating |
Animation enabled? | |
QOpenGLContext * | glcontext |
OpenGL context. | |
QOpenGLPaintDevice * | device |
OpenGL paint device (if render is not reimplemented in subclass). | |
QOpenGLDebugLogger * | logger |
OpenGL debug logger (if logging enabled). | |
Top level GL window.
This is a standard QWindow, however it contains no child widgets; it's simply a surface on which to paint GL rendered content.
|
explicit |
Create a GL window.
parent | the parent of this object. |
|
protected |
|
protected |
Handle events.
Used to handle timer events and trigger a rendering pass.
event | the event to handle. |
true
if the event was handled. References renderNow(), and update_pending.
|
protected |
Handle expose events.
Trigger a rendering pass on exposure.
event | the event to handle. |
References renderNow().
|
slot |
Log a GL debug message.
This currently logs to stderr due to the high log volume when debugging is enabled.
message | the message to log. |
Referenced by renderNow().
|
virtual |
Render using a QPainter.
Does nothing by default. Subclass to paint with QPainter on the OpenGL paint device.
painter | the painter for rendering. |
|
virtual |
Render using OpenGL.
By default sets up a QOpenGLPaintDevice and calls render(QPainter*). Subclass and reimplement to handle rendering directly.
Reimplemented in ome::qtwidgets::GLView2D.
References device, and render().
Referenced by render(), and renderNow().
|
slot |
Render a frame at the next opportunity.
Mark the window for requiring a full render pass at a future point in time. This will usually be for the next frame.
References update_pending.
Referenced by renderNow(), setAnimating(), ome::qtwidgets::GLView2D::setChannelMax(), ome::qtwidgets::GLView2D::setChannelMin(), ome::qtwidgets::GLView2D::setPlane(), ome::qtwidgets::GLView2D::setXTranslation(), ome::qtwidgets::GLView2D::setYTranslation(), ome::qtwidgets::GLView2D::setZoom(), ome::qtwidgets::GLView2D::setZRotation(), and ome::qtwidgets::GLView2D::timerEvent().
|
slot |
Render a frame immediately.
This method also handles initialization of the GL context if it has not been called previously.
References animating, glcontext, initialize(), logger, logMessage(), makeCurrent(), render(), and renderLater().
Referenced by event(), and exposeEvent().
|
protected |
void ome::qtwidgets::GLWindow::setAnimating | ( | bool | animating | ) |
Enable or disable animating.
If enabled, this will trigger a full render pass for every frame using a timer. If disabled, rendering must be triggered by hand.
animating | true to enable continuous animation or false to disable. |
References animating, and renderLater().