Equalizer  1.6.1
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
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 Types

typedef eq::ObjectManager ObjectManager
 The per-window OpenGL object manager. More...
 
typedef BitmapFont Font
 Fonts used for overlays. More...
 
- Public Types inherited from eq::fabric::Window< Pipe, Window, Channel >
typedef std::vector< C * > Channels
 A vector of pointers to channels. More...
 
typedef ElementVisitor< W,
LeafVisitor< C > > 
Visitor
 The Window visitor type. More...
 
enum  IAttribute
 Window attributes. More...
 
- Public Types inherited from eq::fabric::Object
enum  DirtyBits {
  DIRTY_NAME = Serializable::DIRTY_CUSTOM << 0, DIRTY_USERDATA = Serializable::DIRTY_CUSTOM << 1, DIRTY_ERROR = Serializable::DIRTY_CUSTOM << 2, DIRTY_TASKS = Serializable::DIRTY_CUSTOM << 3,
  DIRTY_REMOVED = Serializable::DIRTY_CUSTOM << 4, DIRTY_SERIAL = Serializable::DIRTY_CUSTOM << 5, DIRTY_CUSTOM = Serializable::DIRTY_CUSTOM << 6, DIRTY_OBJECT_BITS = DIRTY_NAME | DIRTY_USERDATA | DIRTY_ERROR
}
 The changed parts of the object since the last pack(). More...
 

Public Member Functions

 Window (Pipe *parent)
 Construct a new window. More...
 
virtual ~Window ()
 Destruct the window. More...
 
Data Access
co::CommandQueue * getPipeThreadQueue ()
 
co::CommandQueue * getCommandThreadQueue ()
 
uint32_t getCurrentFrame () const
 
const NodegetNode () const
 
NodegetNode ()
 
const ConfiggetConfig () const
 
ConfiggetConfig ()
 
ClientPtr getClient ()
 
ServerPtr getServer ()
 
bool isRunning () const
 
bool isStopped () const
 
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
void setSharedContextWindow (Window *sharedContextWindow)
 Set the window with which this window shares the OpenGL context. More...
 
const WindowgetSharedContextWindow () const
 
WindowgetSharedContextWindow ()
 
ObjectManagergetObjectManager ()
 
const ObjectManagergetObjectManager () const
 
const FontgetSmallFont ()
 
const FontgetMediumFont ()
 
const GLEWContext * glewGetContext () const
 Get the GLEW context for this window. More...
 
const GLEWContext * getTransferGlewContext ()
 
uint32_t getColorFormat () const
 
SystemWindow interface
void setSystemWindow (SystemWindow *window)
 Set the OS-specific window. More...
 
const SystemWindowgetSystemWindow () const
 
SystemWindowgetSystemWindow ()
 
const SystemPipegetSystemPipe () const
 
SystemPipegetSystemPipe ()
 
bool createTransferWindow ()
 
void deleteTransferSystemWindow ()
 
- Public Member Functions inherited from eq::fabric::Window< Pipe, Window, Channel >
EQFABRIC_INL WindowPath getPath () const
 
void init ()
 
const P * getPipe () const
 
P * getPipe ()
 
const ChannelsgetChannels () const
 
const DrawableConfiggetDrawableConfig () const
 
const PixelViewportgetPixelViewport () const
 
const ViewportgetViewport () const
 
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 (C **channel)
 
void release (C *channel)
 
virtual void output (std::ostream &) const
 
virtual EQFABRIC_INL uint128_t commit (const uint32_t incarnation=CO_COMMIT_NEXT)
 
void setIAttribute (const IAttribute attr, const int32_t value)
 Set a window attribute. More...
 
int32_t getIAttribute (const IAttribute attr) const
 
- Public Member Functions inherited from eq::fabric::Object
virtual bool isDirty () const
 
void setName (const std::string &name)
 Set the name of the object. More...
 
const std::string & getName () const
 
void setUserData (co::Object *userData)
 Set user-specific data. More...
 
co::Object * getUserData ()
 
const co::Object * getUserData () const
 
void setError (const int32_t error)
 Set an error code why the last operation failed. More...
 
eq::fabric::Error getError () const
 
uint32_t getTasks () const
 Return the set of tasks this channel might execute in the worst case. More...
 
uint32_t getSerial () const
 

Protected Member Functions

virtual void attach (const UUID &id, const uint32_t instanceID)
 
- Protected Member Functions inherited from eq::fabric::Window< Pipe, Window, Channel >
 Window (P *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
 
C * _findChannel (const UUID &id)
 
virtual uint64_t getRedistributableBits () const
 
- Protected Member Functions inherited from eq::fabric::Object
 Object ()
 Construct a new Object. More...
 
virtual ~Object ()
 Destruct the object. More...
 
virtual bool hasMasterUserData ()
 
virtual uint32_t getUserDataLatency () const
 
void setTasks (const uint32_t tasks)
 
void postRemove (Object *child)
 
virtual void removeChild (const UUID &)
 
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)
 
bool _cmdSync (co::ICommand &command)
 

Friends

class Pipe
 
class Channel
 

Actions

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

Callbacks

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

virtual bool processEvent (const Event &event)
 Process a received event. More...
 
virtual bool configInit (const uint128_t &initID)
 Initialize this window. More...
 
virtual bool configInitSystemWindow (const uint128_t &initID)
 Initialize the OS-specific window. More...
 
virtual bool configInitGL (const uint128_t &initID)
 Initialize the OpenGL state for this window. More...
 
virtual bool configExit ()
 Exit this window. More...
 
virtual bool configExitSystemWindow ()
 De-initialize the OS-specific window. More...
 
virtual bool configExitGL ()
 De-initialize the OpenGL state for this window. More...
 
virtual void frameStart (const uint128_t &frameID, const uint32_t frameNumber)
 Start rendering a frame. More...
 
virtual void frameFinish (const uint128_t &frameID, const uint32_t frameNumber)
 Finish rendering a frame. More...
 
virtual void frameDrawFinish (const uint128_t &frameID, const uint32_t frameNumber)
 Finish drawing. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from eq::fabric::Window< Pipe, Window, Channel >
static EQFABRIC_INL const
std::string & 
getIAttributeString (const IAttribute attr)
 
- Protected Types inherited from eq::fabric::Window< Pipe, Window, Channel >
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 63 of file include/eq/client/window.h.

Member Typedef Documentation

Fonts used for overlays.

Version
1.0

Definition at line 70 of file include/eq/client/window.h.

The per-window OpenGL object manager.

Version
1.0

Definition at line 67 of file include/eq/client/window.h.

Constructor & Destructor Documentation

eq::Window::Window ( Pipe parent)

Construct a new window.

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

Destruct the window.

Version
1.0

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

Reimplemented in eqPly::Window, and eVolve::Window.

Member Function Documentation

virtual 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

Reimplemented in eqPly::Window.

Definition at line 382 of file include/eq/client/window.h.

Referenced by eqPly::Window::configExitGL().

+ Here is the caller graph for this function:

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

De-initialize the OS-specific window.

Version
1.0

Referenced by eqPly::Window::configInitSystemWindow().

+ Here is the caller graph for this function:

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

Initialize this window.

Parameters
initIDthe init identifier.
Version
1.0

Reimplemented in eVolve::Window, and eqPixelBench::Window.

Referenced by eqPixelBench::Window::configInit(), and eVolve::Window::configInit().

+ Here is the caller graph for this function:

virtual bool eq::Window::configInitGL ( const uint128_t &  initID)
protectedvirtual

Initialize the OpenGL state for this window.

Parameters
initIDthe init identifier.
Returns
true if the initialization was successful, false if not.
Version
1.0

Reimplemented in eqAsync::Window, eqPly::Window, and eVolve::Window.

Referenced by eqAsync::Window::configInitGL(), and eqPly::Window::configInitGL().

+ Here is the caller graph for this function:

virtual bool eq::Window::configInitSystemWindow ( const uint128_t &  initID)
protectedvirtual

Initialize the OS-specific window.

See Also
setSystemWindow()
Version
1.0

Reimplemented in eqPly::Window.

Referenced by eqPly::Window::configInitSystemWindow().

+ Here is the caller graph for this function:

virtual void eq::Window::drawFPS ( )
virtual

Render the current framerate as on overlay.

Version
1.0
virtual 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 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 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 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 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

Reimplemented in eqPly::Window.

Referenced by eqPly::Window::frameStart().

+ Here is the caller graph for this function:

ClientPtr eq::Window::getClient ( )
Returns
the Client of this window.
Version
1.0
const Config* eq::Window::getConfig ( ) const
Returns
the Config of this window.
Version
1.0

Referenced by eqPly::Window::configInitGL().

+ Here is the caller graph for this function:

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 231 of file include/eq/client/window.h.

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

Definition at line 154 of file include/eq/client/window.h.

Referenced by eqPly::Window::configInitGL().

+ Here is the caller graph for this function:

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

Definition at line 157 of file include/eq/client/window.h.

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.
ServerPtr eq::Window::getServer ( )
Returns
the Server of this window.
Version
1.0
const Window* eq::Window::getSharedContextWindow ( ) const
inline
Returns
the window with which this window shares the GL context.
Version
1.0

Definition at line 144 of file include/eq/client/window.h.

Window* eq::Window::getSharedContextWindow ( )
inline
Returns
the window with which this window shares the GL context.
Version
1.0

Definition at line 151 of file include/eq/client/window.h.

const Font* 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 270 of file include/eq/client/window.h.

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

Definition at line 273 of file include/eq/client/window.h.

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

Referenced by eVolve::Window::configInitGL().

+ Here is the caller graph for this function:

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

Definition at line 106 of file include/eq/client/window.h.

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

Definition at line 112 of file include/eq/client/window.h.

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

Parameters
eventthe received window system event.
Returns
true when the event was handled, false if not.
Version
1.0
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
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
void eq::Window::setSharedContextWindow ( Window sharedContextWindow)
inline

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.

Version
1.0

Definition at line 137 of file include/eq/client/window.h.

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 os-specific window has to be initialized.

Version
1.0
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 void eq::Window::swapBuffers ( )
virtual

Swap the front and back buffer of the window.

Version
1.0

Reimplemented in eVolve::Window.

Referenced by eVolve::Window::swapBuffers().

+ Here is the caller graph for this function:


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