Equalizer 1.0
|
A Window represents an on-screen or off-screen drawable. More...
#include <window.h>
Public Member Functions | |
Window (Pipe *parent) | |
Construct a new window. | |
virtual | ~Window () |
Destruct the window. | |
Data Access | |
co::CommandQueue * | getPipeThreadQueue () |
co::CommandQueue * | getCommandThreadQueue () |
const Node * | getNode () const |
Node * | getNode () |
const Config * | getConfig () const |
Config * | getConfig () |
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. | |
OpenGL context handling and sharing | |
void | setSharedContextWindow (Window *sharedContextWindow) |
Set the window with which this window shares the OpenGL context. | |
const Window * | getSharedContextWindow () const |
Window * | getSharedContextWindow () |
ObjectManager * | getObjectManager () |
const ObjectManager * | getObjectManager () const |
const Font * | getSmallFont () |
const Font * | getMediumFont () |
const GLEWContext * | glewGetContext () const |
Get the GLEW context for this window. | |
uint32_t | getColorFormat () const |
SystemWindow interface | |
void | setSystemWindow (SystemWindow *window) |
Set the OS-specific window. | |
const SystemWindow * | getSystemWindow () const |
SystemWindow * | getSystemWindow () |
const SystemPipe * | getSystemPipe () const |
SystemPipe * | getSystemPipe () |
Public Types | |
typedef eq::ObjectManager | ObjectManager |
The per-window OpenGL object manager. | |
typedef util::BitmapFont < const void * > | Font |
Fonts used for overlays. | |
Protected Member Functions | |
virtual void | attach (const UUID &id, const uint32_t instanceID) |
Friends | |
class | Pipe |
class | Channel |
Actions | |
virtual void | flush () const |
Flush outstanding rendering requests. | |
virtual void | finish () const |
Finish outstanding rendering requests. | |
virtual void | swapBuffers () |
Swap the front and back buffer of the window. | |
virtual void | drawFPS () |
Render the current framerate as on overlay. | |
float | getFPS () const |
virtual void | makeCurrent (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. | |
void | releaseFrame (const uint32_t frameNumber) |
Signal the completion of a frame to the parent. | |
void | releaseFrameLocal (const uint32_t frameNumber) |
Signal the release of the local synchronization to the parent. | |
Callbacks | |
The callbacks are called by Equalizer during rendering to execute various actions. | |
virtual bool | processEvent (const Event &event) |
Process a received event. | |
virtual bool | configInit (const uint128_t &initID) |
Initialize this window. | |
virtual bool | configInitSystemWindow (const uint128_t &initID) |
Initialize the OS-specific window. | |
virtual bool | configInitGL (const uint128_t &initID) |
Initialize the OpenGL state for this window. | |
virtual bool | configExit () |
Exit this window. | |
virtual bool | configExitSystemWindow () |
De-initialize the OS-specific window. | |
virtual bool | configExitGL () |
De-initialize the OpenGL state for this window. | |
virtual void | frameStart (const uint128_t &frameID, const uint32_t frameNumber) |
Start rendering a frame. | |
virtual void | frameFinish (const uint128_t &frameID, const uint32_t frameNumber) |
Finish rendering a frame. | |
virtual void | frameDrawFinish (const uint128_t &frameID, const uint32_t frameNumber) |
Finish drawing. |
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.
Definition at line 63 of file include/eq/window.h.
typedef util::BitmapFont< const void* > eq::Window::Font |
The per-window OpenGL object manager.
Definition at line 67 of file include/eq/window.h.
eq::Window::Window | ( | Pipe * | parent | ) |
Construct a new window.
Reimplemented in eqNbody::Window, eqPixelBench::Window, eqPly::Window, eVolve::Window, and osgScaleViewer::Window.
virtual eq::Window::~Window | ( | ) | [virtual] |
Destruct the window.
Reimplemented from eq::fabric::Window< Pipe, Window, Channel >.
Reimplemented in eqNbody::Window, eqPly::Window, eVolve::Window, and osgScaleViewer::Window.
virtual bool eq::Window::configExit | ( | ) | [protected, virtual] |
Exit this window.
virtual bool eq::Window::configExitGL | ( | ) | [inline, protected, virtual] |
De-initialize the OpenGL state for this window.
Reimplemented in eqPly::Window, and osgScaleViewer::Window.
Definition at line 361 of file include/eq/window.h.
virtual bool eq::Window::configExitSystemWindow | ( | ) | [protected, virtual] |
De-initialize the OS-specific window.
Referenced by eqPly::Window::configInitSystemWindow().
virtual bool eq::Window::configInit | ( | const uint128_t & | initID | ) | [protected, virtual] |
Initialize this window.
initID | the init identifier. |
Reimplemented in eqPixelBench::Window, and eVolve::Window.
virtual bool eq::Window::configInitGL | ( | const uint128_t & | initID | ) | [protected, virtual] |
Initialize the OpenGL state for this window.
initID | the init identifier. |
true
if the initialization was successful, false
if not. Reimplemented in eqPly::Window, eVolve::Window, and osgScaleViewer::Window.
Referenced by osgScaleViewer::Window::configInitGL(), and eqPly::Window::configInitGL().
virtual bool eq::Window::configInitSystemWindow | ( | const uint128_t & | initID | ) | [protected, virtual] |
Initialize the OS-specific window.
Reimplemented in eqPly::Window.
Referenced by eqPly::Window::configInitSystemWindow().
virtual void eq::Window::drawFPS | ( | ) | [virtual] |
Render the current framerate as on overlay.
virtual void eq::Window::finish | ( | ) | const [inline, virtual] |
Finish outstanding rendering requests.
Called before a software swap barrier to ensure that the window will swap directly after the barrier is left.
Definition at line 212 of file include/eq/window.h.
virtual void eq::Window::flush | ( | ) | const [inline, virtual] |
Flush outstanding rendering requests.
Called at the end of each frame from frameFinish() to ensure timely execution of pending rendering requests.
Definition at line 203 of file include/eq/window.h.
virtual void eq::Window::frameDrawFinish | ( | const uint128_t & | frameID, |
const uint32_t | frameNumber | ||
) | [protected, virtual] |
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. |
virtual void eq::Window::frameFinish | ( | const uint128_t & | frameID, |
const uint32_t | frameNumber | ||
) | [protected, virtual] |
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. |
virtual void eq::Window::frameStart | ( | const uint128_t & | frameID, |
const uint32_t | frameNumber | ||
) | [protected, virtual] |
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. |
Reimplemented in eqPly::Window.
const Config* eq::Window::getConfig | ( | ) | const |
Referenced by eqPly::Window::configInitGL().
float eq::Window::getFPS | ( | ) | const [inline] |
Definition at line 221 of file include/eq/window.h.
const Font* eq::Window::getMediumFont | ( | ) |
const Node* eq::Window::getNode | ( | ) | const |
Referenced by osgScaleViewer::Window::configInitGL().
const ObjectManager* eq::Window::getObjectManager | ( | ) | const [inline] |
Definition at line 156 of file include/eq/window.h.
ObjectManager* eq::Window::getObjectManager | ( | ) | [inline] |
Definition at line 153 of file include/eq/window.h.
Referenced by eqPly::Window::configInitGL().
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.
const Window* eq::Window::getSharedContextWindow | ( | ) | const [inline] |
Definition at line 143 of file include/eq/window.h.
Referenced by osgScaleViewer::Window::configInitGL().
Window* eq::Window::getSharedContextWindow | ( | ) | [inline] |
Definition at line 150 of file include/eq/window.h.
const Font* eq::Window::getSmallFont | ( | ) |
SystemPipe* eq::Window::getSystemPipe | ( | ) |
const SystemPipe* eq::Window::getSystemPipe | ( | ) | const |
SystemWindow* eq::Window::getSystemWindow | ( | ) | [inline] |
Definition at line 258 of file include/eq/window.h.
const SystemWindow* eq::Window::getSystemWindow | ( | ) | const [inline] |
Definition at line 255 of file include/eq/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.
Referenced by eVolve::Window::configInitGL().
bool eq::Window::isRunning | ( | ) | const [inline] |
Definition at line 105 of file include/eq/window.h.
bool eq::Window::isStopped | ( | ) | const [inline] |
Definition at line 111 of file include/eq/window.h.
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().
event | the received window system event. |
void eq::Window::releaseFrame | ( | const uint32_t | frameNumber | ) | [protected] |
Signal the completion of a frame to the parent.
frameNumber | the frame to end. |
void eq::Window::releaseFrameLocal | ( | const uint32_t | frameNumber | ) | [protected] |
Signal the release of the local synchronization to the parent.
frameNumber | the frame to release. |
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.
Definition at line 136 of file include/eq/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.
void eq::Window::startFrame | ( | const uint32_t | frameNumber | ) | [protected] |
Start a frame by unlocking all child resources.
frameNumber | the frame to start. |
virtual void eq::Window::swapBuffers | ( | ) | [virtual] |
Swap the front and back buffer of the window.
Reimplemented in eqNbody::Window, and eVolve::Window.
Referenced by eqNbody::Window::swapBuffers().