bioformats  5.1.6
Public Slots | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ome::qtwidgets::GLWindow Class Reference

Top level GL window. More...

#include <ome/qtwidgets/GLWindow.h>

+ Inheritance diagram for ome::qtwidgets::GLWindow:
+ Collaboration diagram for ome::qtwidgets::GLWindow:

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).
 

Detailed Description

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.

Constructor & Destructor Documentation

ome::qtwidgets::GLWindow::GLWindow ( QWindow *  parent = 0)
explicit

Create a GL window.

Parameters
parentthe parent of this object.

Member Function Documentation

QOpenGLContext * ome::qtwidgets::GLWindow::context ( ) const
protected

Get GL context.

Returns
the GL context.

References glcontext.

bool ome::qtwidgets::GLWindow::event ( QEvent *  event)
protected

Handle events.

Used to handle timer events and trigger a rendering pass.

Parameters
eventthe event to handle.
Returns
true if the event was handled.

References renderNow(), and update_pending.

void ome::qtwidgets::GLWindow::exposeEvent ( QExposeEvent *  event)
protected

Handle expose events.

Trigger a rendering pass on exposure.

Parameters
eventthe event to handle.

References renderNow().

void ome::qtwidgets::GLWindow::logMessage ( QOpenGLDebugMessage  message)
slot

Log a GL debug message.

This currently logs to stderr due to the high log volume when debugging is enabled.

Parameters
messagethe message to log.

Referenced by renderNow().

+ Here is the caller graph for this function:

void ome::qtwidgets::GLWindow::render ( QPainter *  painter)
virtual

Render using a QPainter.

Does nothing by default. Subclass to paint with QPainter on the OpenGL paint device.

Parameters
painterthe painter for rendering.
void ome::qtwidgets::GLWindow::render ( )
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().

+ Here is the caller graph for this function:

void ome::qtwidgets::GLWindow::renderLater ( )
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().

+ Here is the caller graph for this function:

void ome::qtwidgets::GLWindow::renderNow ( )
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().

+ Here is the caller graph for this function:

void ome::qtwidgets::GLWindow::resizeEvent ( QResizeEvent *  event)
protected

Handle resize events.

Parameters
eventthe event to handle.

References glcontext, and resize().

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.

Parameters
animatingtrue to enable continuous animation or false to disable.

References animating, and renderLater().


The documentation for this class was generated from the following files: