Equalizer  1.13.0
Parallel Rendering Framework
eq::Window Class Reference

A Window represents an on-screen or off-screen drawable. More...

#include <window.h>

+ Inheritance diagram for eq::Window:
+ Collaboration diagram for eq::Window:

Public Member Functions

EQ_API Window (Pipe *parent)
 Construct a new window. More...
 
virtual EQ_API ~Window ()
 Destruct the window. More...
 
Data Access
EQ_API co::CommandQueue * getPipeThreadQueue ()
 
EQ_API co::CommandQueue * getCommandThreadQueue ()
 
EQ_API uint32_t getCurrentFrame () const
 
EQ_API const NodegetNode () const
 
EQ_API NodegetNode ()
 
EQ_API const ConfiggetConfig () const
 
EQ_API ConfiggetConfig ()
 
EQ_API ClientPtr getClient ()
 
EQ_API ServerPtr getServer ()
 
bool isRunning () const
 
bool isStopped () const
 
EQ_API bool getRenderContext (const int32_t x, const int32_t y, RenderContext &context) const
 Get the last rendering context at the x, y position. More...
 
OpenGL context handling and sharing
EQ_API void setSharedContextWindow (const Window *sharedContextWindow)
 Set the window with which this window shares the OpenGL context. More...
 
EQ_API const WindowgetSharedContextWindow () const
 
util::ObjectManagergetObjectManager ()
 
const util::ObjectManagergetObjectManager () const
 
EQ_API const util::BitmapFontgetSmallFont ()
 
EQ_API const util::BitmapFontgetMediumFont ()
 
EQ_API const GLEWContext * glewGetContext () const
 Get the GLEW context for this window. More...
 
EQ_API const GLEWContext * getTransferGlewContext () const
 
EQ_API uint32_t getColorFormat () const
 
SystemWindow interface
EQ_API void setSystemWindow (SystemWindow *window)
 Set the OS-specific window. More...
 
const SystemWindowgetSystemWindow () const
 
SystemWindowgetSystemWindow ()
 
const SystemPipegetSystemPipe () const
 
SystemPipegetSystemPipe ()
 
bool createTransferWindow ()
 
void deleteTransferWindow ()
 
SystemWindowgetTransferWindow ()
 
const SystemWindowgetTransferWindow () const
 
Events
EQ_API EventOCommand sendError (const uint32_t error) final
 Send a window error event to the application node. More...
 
virtual EQ_API bool processEvent (const Event &event)
 Process a received event. More...
 
- Public Member Functions inherited from eq::fabric::Window< Pipe, Window, Channel, WindowSettings >
EQFABRIC_INL WindowPath getPath () const
 
void init ()
 
const PipegetPipe () const
 
PipegetPipe ()
 
const ChannelsgetChannels () const
 
const DrawableConfiggetDrawableConfig () const
 
EQFABRIC_INL const PixelViewportgetPixelViewport () const
 
const ViewportgetViewport () const
 
EQFABRIC_INL void setName (const std::string &name) final
 Set the window's name/caption. More...
 
virtual EQFABRIC_INL void setPixelViewport (const PixelViewport &pvp)
 Set the window's pixel viewport wrt its parent pipe. More...
 
EQFABRIC_INL void setViewport (const Viewport &vp)
 Set the window's viewport wrt its parent pipe. More...
 
bool hasFixedViewport () const
 
EQFABRIC_INL VisitorResult accept (Visitor &visitor)
 Perform a depth-first traversal of this window. More...
 
EQFABRIC_INL VisitorResult accept (Visitor &visitor) const
 Const-version of accept(). More...
 
virtual EQFABRIC_INL void backup ()
 
virtual EQFABRIC_INL void restore ()
 
void create (Channel **channel)
 
void release (Channel *channel)
 
virtual void output (std::ostream &) const
 
virtual EQFABRIC_INL uint128_t commit (const uint32_t incarnation=CO_COMMIT_NEXT)
 
EQFABRIC_INL void setSettings (const WindowSettings &settings)
 Set the settings of this window. More...
 
EQFABRIC_INL const WindowSettingsgetSettings () const
 
EQFABRIC_INL void setIAttribute (const WindowSettings::IAttribute attr, const int32_t value)
 Set a window attribute. More...
 
EQFABRIC_INL int32_t getIAttribute (const WindowSettings::IAttribute attr) const
 
- Public Member Functions inherited from eq::fabric::Object
virtual EQFABRIC_API bool isDirty () const
 
EQFABRIC_API const std::string & getName () const
 
EQFABRIC_API void setUserData (co::Object *userData)
 Set user-specific data. More...
 
EQFABRIC_API co::Object * getUserData ()
 
EQFABRIC_API const co::Object * getUserData () const
 
EQFABRIC_API uint32_t getTasks () const
 Return the set of tasks this channel might execute in the worst case. More...
 
EQFABRIC_API uint32_t getSerial () const
 

Protected Member Functions

virtual EQ_API void attach (const uint128_t &id, const uint32_t instanceID)
 
Callbacks

The callbacks are called by Equalizer during rendering to execute various actions.

virtual EQ_API bool configInit (const uint128_t &initID)
 Initialize this window. More...
 
virtual EQ_API bool configInitSystemWindow (const uint128_t &initID)
 Initialize the OS-specific window. More...
 
virtual EQ_API bool configInitGL (const uint128_t &initID)
 Initialize the OpenGL state for this window. More...
 
virtual EQ_API bool configExit ()
 Exit this window. More...
 
virtual EQ_API bool configExitSystemWindow ()
 De-initialize the OS-specific window. More...
 
virtual bool configExitGL ()
 De-initialize the OpenGL state for this window. More...
 
virtual EQ_API void frameStart (const uint128_t &frameID, const uint32_t frameNumber)
 Start rendering a frame. More...
 
virtual EQ_API void frameFinish (const uint128_t &frameID, const uint32_t frameNumber)
 Finish rendering a frame. More...
 
virtual EQ_API void frameDrawFinish (const uint128_t &frameID, const uint32_t frameNumber)
 Finish drawing. More...
 
- Protected Member Functions inherited from eq::fabric::Window< Pipe, Window, Channel, WindowSettings >
 Window (Pipe *parent)
 
virtual EQFABRIC_INL void serialize (co::DataOStream &os, const uint64_t dirtyBits)
 
virtual EQFABRIC_INL void deserialize (co::DataIStream &is, const uint64_t dirtyBits)
 
virtual EQFABRIC_INL void notifyDetach ()
 
virtual EQFABRIC_INL void setDirty (const uint64_t bits)
 
void _setDrawableConfig (const DrawableConfig &drawableConfig)
 
virtual ChangeType getChangeType () const
 
Channel_findChannel (const uint128_t &id)
 
virtual uint64_t getRedistributableBits () const
 
- Protected Member Functions inherited from eq::fabric::Object
EQFABRIC_API Object ()
 Construct a new Object. More...
 
EQFABRIC_API Object (const Object &)
 Construct an unmapped, unregistered copy of an object. More...
 
virtual EQFABRIC_API ~Object ()
 Destruct the object. More...
 
EQFABRIC_API Objectoperator= (const Object &from)
 NOP assignment operator. More...
 
virtual bool hasMasterUserData ()
 
virtual uint32_t getUserDataLatency () const
 
EQFABRIC_API void setTasks (const uint32_t tasks)
 
EQFABRIC_API void postRemove (Object *child)
 
virtual void removeChild (const uint128_t &)
 
template<class C , class S >
void commitChild (C *child, S *sender, uint32_t cmd, const uint32_t incarnation)
 
template<class C >
void commitChild (C *child, const uint32_t incarnation)
 
template<class C , class S >
void commitChildren (const std::vector< C * > &children, S *sender, uint32_t cmd, const uint32_t incarnation)
 
template<class C >
void commitChildren (const std::vector< C * > &children, uint32_t cmd, const uint32_t incarnation)
 
template<class C >
void commitChildren (const std::vector< C * > &children, const uint32_t incarnation)
 
template<class C >
void syncChildren (const std::vector< C * > &children)
 
template<class P , class C >
void releaseChildren (const std::vector< C * > &children)
 
EQFABRIC_API bool _cmdSync (co::ICommand &command)
 

Friends

class Pipe
 
class Channel
 

Actions

virtual EQ_API void flush () const
 Flush outstanding rendering requests. More...
 
virtual EQ_API void finish () const
 Finish outstanding rendering requests. More...
 
virtual EQ_API void swapBuffers ()
 Swap the front and back buffer of the window. More...
 
virtual EQ_API void drawFPS ()
 Render the current framerate as on overlay. More...
 
float getFPS () const
 
virtual EQ_API void makeCurrent (const bool cache=true) const
 Make the window's drawable and context current. More...
 
virtual EQ_API void doneCurrent () const
 This results in no context being current in the current thread. More...
 
virtual EQ_API void bindFrameBuffer () const
 
virtual EQ_API void bindDrawFrameBuffer () const
 
virtual EQ_API void updateFrameBuffer () const
 
virtual EQ_API void notifyViewportChanged ()
 
EQ_API void startFrame (const uint32_t frameNumber)
 Start a frame by unlocking all child resources. More...
 
EQ_API void releaseFrame (const uint32_t frameNumber)
 Signal the completion of a frame to the parent. More...
 
EQ_API void releaseFrameLocal (const uint32_t frameNumber)
 Signal the release of the local synchronization to the parent. More...
 

Additional Inherited Members

- Public Types inherited from eq::fabric::Window< Pipe, Window, Channel, WindowSettings >
typedef std::vector< Channel * > Channels
 A vector of pointers to channels. More...
 
typedef ElementVisitor< Window, LeafVisitor< Channel > > Visitor
 The Window visitor type. More...
 
- Public Types inherited from eq::fabric::Object
enum  DirtyBits {
  DIRTY_NAME = Serializable::DIRTY_CUSTOM << 0, DIRTY_USERDATA = Serializable::DIRTY_CUSTOM << 1, DIRTY_TASKS = Serializable::DIRTY_CUSTOM << 2, DIRTY_REMOVED = Serializable::DIRTY_CUSTOM << 3,
  DIRTY_SERIAL = Serializable::DIRTY_CUSTOM << 4, DIRTY_CUSTOM = Serializable::DIRTY_CUSTOM << 6, DIRTY_OBJECT_BITS = DIRTY_NAME | DIRTY_USERDATA
}
 The changed parts of the object since the last pack(). More...
 
- Static Public Member Functions inherited from eq::fabric::Window< Pipe, Window, Channel, WindowSettings >
static EQFABRIC_INL const std::string & getIAttributeString (const WindowSettings::IAttribute attr)
 
- Protected Types inherited from eq::fabric::Window< Pipe, Window, Channel, WindowSettings >
enum  DirtyBits
 

Detailed Description

A Window represents an on-screen or off-screen drawable.

A drawable is a 2D rendering surface, typically attached to an OpenGL context. A window uses an SystemWindow implementation to manage the operating system specific handling of window and context creation.

A Window is a child of a Pipe. The task methods for all windows of a pipe are executed in the same pipe thread. All window and subsequent channel task methods are executed in the order the windows are defined on the pipe, with the exception of the swap and finish tasks, which are executed after all windows have been updated. This ensures that all windows of a given pipe swap at the same time.

The default window initialization methods initialize all windows of the same pipe with a shared context, so that OpenGL objects can be reused between them for optimal GPU memory usage. The window facilitates OpenGL object management by providing an ObjectManager for allocating and sharing OpenGL objects.

Please note that each window potentially has its own OpenGL command buffer, thus glFlush is needed to synchronize the state of OpenGL objects between windows. Therefore, Equalizer calls flush() at the end of each frame for each window.

See also
fabric::Window

Definition at line 64 of file window.h.

Constructor & Destructor Documentation

EQ_API eq::Window::Window ( Pipe parent)
explicit

Construct a new window.

Version
1.0
virtual EQ_API eq::Window::~Window ( )
virtual

Destruct the window.

Version
1.0

Reimplemented from eq::fabric::Window< Pipe, Window, Channel, WindowSettings >.

Member Function Documentation

virtual EQ_API bool eq::Window::configExit ( )
protectedvirtual

Exit this window.

Version
1.0
virtual bool eq::Window::configExitGL ( )
inlineprotectedvirtual

De-initialize the OpenGL state for this window.

Version
1.0

Definition at line 386 of file window.h.

virtual EQ_API bool eq::Window::configExitSystemWindow ( )
protectedvirtual

De-initialize the OS-specific window.

Version
1.0
virtual EQ_API bool eq::Window::configInit ( const uint128_t &  initID)
protectedvirtual

Initialize this window.

Parameters
initIDthe init identifier.
Version
1.0
virtual EQ_API bool eq::Window::configInitGL ( const uint128_t &  initID)
protectedvirtual

Initialize the OpenGL state for this window.

Called from configInit(), after the system window has been successfully initialized.

Parameters
initIDthe init identifier.
Returns
true if the initialization was successful, false if not.
Version
1.0
virtual EQ_API bool eq::Window::configInitSystemWindow ( const uint128_t &  initID)
protectedvirtual

Initialize the OS-specific window.

See also
setSystemWindow()
Version
1.0
virtual EQ_API void eq::Window::doneCurrent ( ) const
virtual

This results in no context being current in the current thread.

Version
1.10
virtual EQ_API void eq::Window::drawFPS ( )
virtual

Render the current framerate as on overlay.

Version
1.0
virtual EQ_API void eq::Window::finish ( ) const
virtual

Finish outstanding rendering requests.

Called before a software swap barrier to ensure that the window will swap directly after the barrier is left.

Version
1.0
virtual EQ_API void eq::Window::flush ( ) const
virtual

Flush outstanding rendering requests.

Called at the end of each frame from frameFinish() to ensure timely execution of pending rendering requests.

Version
1.0
virtual EQ_API void eq::Window::frameDrawFinish ( const uint128_t &  frameID,
const uint32_t  frameNumber 
)
protectedvirtual

Finish drawing.

Called once per frame after the last draw operation. Typically releases the local node thread synchronization for this frame.

Parameters
frameIDthe per-frame identifier.
frameNumberthe frame to finished with draw.
Version
1.0
virtual EQ_API void eq::Window::frameFinish ( const uint128_t &  frameID,
const uint32_t  frameNumber 
)
protectedvirtual

Finish rendering a frame.

Called once at the end of each frame, to do per-frame updates of window-specific data. This method has to call releaseFrame(). The default implementation also flushes all rendering commands. This light-weight call ensures that all outstanding rendering commands for the window's context are being executed in a timely fashion.

Parameters
frameIDthe per-frame identifier.
frameNumberthe frame to finish.
Version
1.0
virtual EQ_API void eq::Window::frameStart ( const uint128_t &  frameID,
const uint32_t  frameNumber 
)
protectedvirtual

Start rendering a frame.

Called once at the beginning of each frame, to do per-frame updates of window-specific data. This method has to call startFrame().

Parameters
frameIDthe per-frame identifier.
frameNumberthe frame to start.
Version
1.0
EQ_API ClientPtr eq::Window::getClient ( )
Returns
the Client of this window.
Version
1.0
EQ_API const Config* eq::Window::getConfig ( ) const
Returns
the Config of this window.
Version
1.0
EQ_API Config* eq::Window::getConfig ( )
Returns
the Config of this window.
Version
1.0
float eq::Window::getFPS ( ) const
inline
Returns
the window's average framerate.
Version
1.0

Definition at line 217 of file window.h.

EQ_API const util::BitmapFont* eq::Window::getMediumFont ( )
Returns
a medium bitmap font used for overlays.
Warning
experimental - may not be supported in the future.
EQ_API const Node* eq::Window::getNode ( ) const
Returns
the Node of this window.
Version
1.0
EQ_API Node* eq::Window::getNode ( )
Returns
the Node of this window.
Version
1.0
util::ObjectManager& eq::Window::getObjectManager ( )
inline
Returns
the window's object manager instance.
Version
1.0

Definition at line 145 of file window.h.

const util::ObjectManager& eq::Window::getObjectManager ( ) const
inline
Returns
the window's object manager instance.
Version
1.0

Definition at line 148 of file window.h.

EQ_API bool eq::Window::getRenderContext ( const int32_t  x,
const int32_t  y,
RenderContext &  context 
) const

Get the last rendering context at the x, y position.

If no render context is found on the given position, false is returned and context is not modified.

Returns
true if a render context was found, false otherwise.
Warning
experimental - may not be supported in the future.
EQ_API ServerPtr eq::Window::getServer ( )
Returns
the Server of this window.
Version
1.0
EQ_API const Window* eq::Window::getSharedContextWindow ( ) const
Returns
the window with which this window shares the GL context.
Version
1.0
EQ_API const util::BitmapFont* eq::Window::getSmallFont ( )
Returns
a small bitmap font used for overlays.
Warning
experimental - may not be supported in the future.
const SystemPipe* eq::Window::getSystemPipe ( ) const
Returns
the OS-specific pipe implementation.
Version
1.0
SystemPipe* eq::Window::getSystemPipe ( )
Returns
the OS-specific pipe implementation.
Version
1.0
const SystemWindow* eq::Window::getSystemWindow ( ) const
inline
Returns
the OS-specific window implementation.
Version
1.0

Definition at line 263 of file window.h.

SystemWindow* eq::Window::getSystemWindow ( )
inline
Returns
the OS-specific window implementation.
Version
1.0

Definition at line 266 of file window.h.

EQ_API const GLEWContext* eq::Window::glewGetContext ( ) const

Get the GLEW context for this window.

The glew context is provided and initialized by the SystemWindow, and provides access to OpenGL extensions. This function does not follow the Equalizer naming conventions, since GLEW uses a function of this name to automatically resolve OpenGL function entry points. Therefore, any OpenGL function support by the driver can be directly called from any method of an initialized window.

Returns
the extended OpenGL function table for the window's OpenGL context.
Version
1.0
bool eq::Window::isRunning ( ) const
inline
Returns
true if this window is running, false otherwise.
Version
1.0

Definition at line 102 of file window.h.

bool eq::Window::isStopped ( ) const
inline
Returns
true if this window is stopped, false otherwise.
Version
1.0

Definition at line 108 of file window.h.

virtual EQ_API void eq::Window::makeCurrent ( const bool  cache = true) const
virtual

Make the window's drawable and context current.

GL drivers tend to behave sub-optimally if too many makeCurrent calls happen in a multi-threaded program. When caching is enabled, this method will only call SystemWindow::makeCurrent if it has not been done before for this window on this thread.

Version
1.3.2
virtual EQ_API bool eq::Window::processEvent ( const Event &  event)
virtual

Process a received event.

The task of this method is to update the window as necessary, and transform the event into an config event to be send to the application using Config::sendEvent(). Events which can be related to a channel (eg pointer events) are transformed into their corresponding channel event and forwarded to Channel::processEvent().

Parameters
eventthe received window system event.
Returns
true when the event was handled, false if not.
Version
1.0

Implements eq::NotifierInterface.

EQ_API void eq::Window::releaseFrame ( const uint32_t  frameNumber)
protected

Signal the completion of a frame to the parent.

Parameters
frameNumberthe frame to end.
Version
1.0
EQ_API void eq::Window::releaseFrameLocal ( const uint32_t  frameNumber)
protected

Signal the release of the local synchronization to the parent.

Parameters
frameNumberthe frame to release.
Version
1.0
EQ_API EventOCommand eq::Window::sendError ( const uint32_t  error)
finalvirtual

Send a window error event to the application node.

Parameters
errorthe error code.
Version
1.7.1

Implements eq::NotifierInterface.

EQ_API void eq::Window::setSharedContextWindow ( const Window sharedContextWindow)

Set the window with which this window shares the OpenGL context.

By default it is set to the first window of the pipe in the window's constructor. The shared context window is used during initialization to setup the OpenGL context and util::ObjectManager. The default implementation of configInitSystemWindow() will use this to call WindowSettings::setSharedContextWindow() using the corresponding SystemWindow.

Version
1.0
EQ_API void eq::Window::setSystemWindow ( SystemWindow window)

Set the OS-specific window.

The SystemWindow implements the window-system-dependent part, e.g., the drawable creation. This window forwards certain calls, e.g., swapBuffers(), to the SystemWindow. The system window has to be initialized.

Version
1.0
EQ_API void eq::Window::startFrame ( const uint32_t  frameNumber)
protected

Start a frame by unlocking all child resources.

Parameters
frameNumberthe frame to start.
Version
1.0
virtual EQ_API void eq::Window::swapBuffers ( )
virtual

Swap the front and back buffer of the window.

Version
1.0

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