Equalizer
2.0.0
Parallel Rendering Framework
|
A Window represents an on-screen or off-screen drawable. More...
#include <window.h>
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 Node * | getNode () const |
EQ_API Node * | getNode () |
EQ_API const Config * | getConfig () const |
EQ_API Config * | getConfig () |
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 Window * | getSharedContextWindow () const |
util::ObjectManager & | getObjectManager () |
const util::ObjectManager & | getObjectManager () const |
EQ_API const util::BitmapFont * | getSmallFont () |
EQ_API const util::BitmapFont * | getMediumFont () |
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 SystemWindow * | getSystemWindow () const |
SystemWindow * | getSystemWindow () |
const SystemPipe * | getSystemPipe () const |
SystemPipe * | getSystemPipe () |
bool | createTransferWindow () |
void | deleteTransferWindow () |
SystemWindow * | getTransferWindow () |
const SystemWindow * | getTransferWindow () const |
Events | |
EQ_API EventOCommand | sendError (const uint32_t error) final |
Send a window error event to the application node. More... | |
EQ_API bool | processEvent (EventType type) override |
EQ_API bool | processEvent (EventType type, SizeEvent &event) override |
EQ_API bool | processEvent (EventType type, PointerEvent &event) override |
EQ_API bool | processEvent (EventType type, KeyEvent &event) override |
EQ_API bool | processEvent (EventType type, AxisEvent &event) override |
EQ_API bool | processEvent (EventType type, ButtonEvent &event) override |
EQ_API bool | processEvent (Statistic &event) |
Public Member Functions inherited from eq::fabric::Window< Pipe, Window, Channel, WindowSettings > | |
EQFABRIC_INL WindowPath | getPath () const |
void | init () |
const Pipe * | getPipe () const |
Pipe * | getPipe () |
const Channels & | getChannels () const |
const DrawableConfig & | getDrawableConfig () const |
EQFABRIC_INL const PixelViewport & | getPixelViewport () const |
const Viewport & | getViewport () 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 WindowSettings & | getSettings () 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 | |
EQFABRIC_API bool | isDirty () const override |
EQFABRIC_API uint128_t | commit (const uint32_t incarnation=CO_COMMIT_NEXT) override |
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 | |
EQ_API void | attach (const uint128_t &id, const uint32_t instanceID) override |
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 Object & | operator= (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 | notifyDetach () override |
EQFABRIC_API void | serialize (co::DataOStream &os, const uint64_t dirtyBits) override |
EQFABRIC_API void | deserialize (co::DataIStream &is, const uint64_t dirtyBits) override |
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) |
EQFABRIC_API void | updateEvent (Event &event, int64_t time) |
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 |
EQ_API void | notifyViewportChanged () override |
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 |
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.
|
explicit |
Construct a new window.
|
virtual |
Destruct the window.
Reimplemented from eq::fabric::Window< Pipe, Window, Channel, WindowSettings >.
|
protectedvirtual |
Exit this window.
Referenced by getSystemWindow().
|
inlineprotectedvirtual |
De-initialize the OpenGL state for this window.
Definition at line 391 of file window.h.
References frameDrawFinish(), frameFinish(), and frameStart().
|
protectedvirtual |
De-initialize the OS-specific window.
Referenced by getSystemWindow().
|
protectedvirtual |
Initialize this window.
initID | the init identifier. |
Referenced by getSystemWindow().
|
protectedvirtual |
Initialize the OpenGL state for this window.
Called from configInit(), after the system window has been successfully initialized.
initID | the init identifier. |
Referenced by getSystemWindow().
|
protectedvirtual |
Initialize the OS-specific window.
Referenced by getSystemWindow().
|
virtual |
This results in no context being current in the current thread.
Referenced by getFPS().
|
virtual |
Render the current framerate as on overlay.
Referenced by getObjectManager().
|
virtual |
Finish outstanding rendering requests.
Called before a software swap barrier to ensure that the window will swap directly after the barrier is left.
Referenced by getObjectManager().
|
virtual |
Flush outstanding rendering requests.
Called at the end of each frame from frameFinish() to ensure timely execution of pending rendering requests.
Referenced by getObjectManager().
|
protectedvirtual |
Finish drawing.
Called once per frame after the last draw operation. Typically releases the local node thread synchronization for this frame.
frameID | the per-frame identifier. |
frameNumber | the frame to finished with draw. |
Referenced by configExitGL().
|
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.
frameID | the per-frame identifier. |
frameNumber | the frame to finish. |
Referenced by configExitGL().
|
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().
frameID | the per-frame identifier. |
frameNumber | the frame to start. |
Referenced by configExitGL().
|
inline |
Definition at line 216 of file window.h.
References doneCurrent(), makeCurrent(), and setSystemWindow().
EQ_API const util::BitmapFont* eq::Window::getMediumFont | ( | ) |
Referenced by getObjectManager().
|
inline |
|
inline |
Definition at line 147 of file window.h.
References drawFPS(), finish(), flush(), getMediumFont(), getSmallFont(), glewGetContext(), and swapBuffers().
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.
Referenced by isStopped().
EQ_API const Window* eq::Window::getSharedContextWindow | ( | ) | const |
Referenced by isStopped().
EQ_API const util::BitmapFont* eq::Window::getSmallFont | ( | ) |
Referenced by getObjectManager().
const SystemPipe* eq::Window::getSystemPipe | ( | ) | const |
Referenced by getSystemWindow().
SystemPipe* eq::Window::getSystemPipe | ( | ) |
|
inline |
|
inline |
Definition at line 265 of file window.h.
References configExit(), configExitSystemWindow(), configInit(), configInitGL(), configInitSystemWindow(), getSystemPipe(), processEvent(), releaseFrame(), releaseFrameLocal(), sendError(), and startFrame().
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.
Referenced by getObjectManager().
|
inline |
|
inline |
Definition at line 107 of file window.h.
References getRenderContext(), getSharedContextWindow(), and setSharedContextWindow().
|
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.
Referenced by getFPS().
|
overridevirtual |
Implements eq::NotifierInterface.
Referenced by getSystemWindow().
|
overridevirtual |
Implements eq::NotifierInterface.
|
overridevirtual |
Implements eq::NotifierInterface.
|
overridevirtual |
Implements eq::NotifierInterface.
|
overridevirtual |
Implements eq::NotifierInterface.
|
overridevirtual |
Implements eq::NotifierInterface.
|
protected |
Signal the completion of a frame to the parent.
frameNumber | the frame to end. |
Referenced by getSystemWindow().
|
protected |
Signal the release of the local synchronization to the parent.
frameNumber | the frame to release. |
Referenced by getSystemWindow().
|
finalvirtual |
Send a window error event to the application node.
error | the error code. |
Implements eq::NotifierInterface.
Referenced by getSystemWindow().
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.
Referenced by isStopped().
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.
Referenced by getFPS().
|
protected |
Start a frame by unlocking all child resources.
frameNumber | the frame to start. |
Referenced by getSystemWindow().
|
virtual |
Swap the front and back buffer of the window.
Referenced by getObjectManager().