eq::Window Class Reference

A Window represents an on-screen or off-screen drawable, and manages an OpenGL context. More...

#include <window.h>

Inheritance diagram for eq::Window:

Inheritance graph
[legend]
Collaboration diagram for eq::Window:

Collaboration graph
[legend]

List of all members.

Classes

struct  DrawableConfig
 Stores current drawable characteristics. More...
class  ObjectManager
 The per-window object manager. More...

Public Member Functions

 Window (Pipe *parent)
 Constructs a new window.
virtual ~Window ()
 Destructs the window.
double getFPS () const
 Returns averaged FPS count (averaging is not longer than 2 sec).
virtual void drawFPS () const
int getColorType ()
bool isFBOWindow ()
Data Access
net::CommandQueuegetPipeThreadQueue ()
const PipegetPipe () const
PipegetPipe ()
const NodegetNode () const
NodegetNode ()
const ConfiggetConfig () const
ConfiggetConfig ()
ClientPtr getClient ()
ServerPtr getServer ()
const ChannelVectorgetChannels ()
const std::string & getName () const
bool isRunning () const
uint32_t getTasks () const
 Return the set of tasks this window's channels might execute in the worst case.
VisitorResult accept (WindowVisitor &visitor)
 Traverse this window and all children using a window visitor.
void setSharedContextWindow (Window *sharedContextWindow)
 Set the window with which this window shares the OpenGL context, defaults to the first window of the pipe.
const WindowgetSharedContextWindow () const
WindowgetSharedContextWindow ()
GLEWContext * glewGetContext ()
 Get the GLEW context for this window.
WGLEWContext * wglewGetContext ()
const DrawableConfiggetDrawableConfig () const
ObjectManagergetObjectManager ()
const ObjectManagergetObjectManager () const
void setPixelViewport (const PixelViewport &pvp)
 Set the window's pixel viewport wrt its parent pipe.
const PixelViewportgetPixelViewport () const
const ViewportgetViewport () const
void addRenderContext (const RenderContext &context)
 Add a channel's rendering context to the current frame's list.
bool getRenderContext (const int32_t x, const int32_t y, RenderContext &context) const
 Get the last rendering context at the x, y position.
Actions
virtual void flush () const
 Flush outstanding rendering requests.
virtual void finish () const
 Finish outstanding rendering requests.
Interface to and from the OSWindow, the window-system specific
pieces for a Window.

void setOSWindow (OSWindow *window)
 Set the OS-specific window.
const OSWindowgetOSWindow () const
OSWindowgetOSWindow ()
Error information.
void setErrorMessage (const std::string &message)
 Set a message why the last operation failed.
Callbacks
The callbacks are called by Equalizer during rendering to execute various actions.

virtual bool processEvent (const Event &event)
 Process a received event.

Protected Member Functions

virtual void attachToSession (const uint32_t id, const uint32_t instanceID, net::Session *session)
 Called when object is attached to session.
Actions
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)
 Release the local synchronization of the parent for a frame.
Callbacks
The callbacks are called by Equalizer during rendering to execute various actions.

virtual bool configInit (const uint32_t initID)
 Initialize this window.
virtual bool configInitOSWindow (const uint32_t initID)
 Initialize the OS-specific window.
virtual bool configInitGL (const uint32_t initID)
 Initialize the OpenGL state for this window.
virtual bool configExit ()
 Exit this window.
virtual bool configExitOSWindow ()
 De-initialize the OS-specific window.
virtual bool configExitGL ()
 De-initializer the OpenGL state for this window.
virtual void frameStart (const uint32_t frameID, const uint32_t frameNumber)
 Start rendering a frame.
virtual void frameFinish (const uint32_t frameID, const uint32_t frameNumber)
 Finish rendering a frame.
virtual void frameDrawFinish (const uint32_t frameID, const uint32_t frameNumber)
 Finish drawing.
virtual void makeCurrent (const bool cache=true) const
 Make the window's drawable and context current.
virtual void bindFrameBuffer () const
 Bind the window's FBO, if it uses one.
virtual void swapBuffers ()
 Swap the front and back buffer of the window.

Friends

class Pipe
class Channel

Attributes

enum  IAttribute {
  IATTR_HINT_STEREO, IATTR_HINT_DOUBLEBUFFER, IATTR_HINT_FULLSCREEN, IATTR_HINT_DECORATION,
  IATTR_HINT_SWAPSYNC, IATTR_HINT_DRAWABLE, IATTR_HINT_STATISTICS, IATTR_HINT_SCREENSAVER,
  IATTR_PLANES_COLOR, IATTR_PLANES_ALPHA, IATTR_PLANES_DEPTH, IATTR_PLANES_STENCIL,
  IATTR_PLANES_ACCUM, IATTR_PLANES_ACCUM_ALPHA, IATTR_PLANES_SAMPLES, IATTR_FILL1,
  IATTR_FILL2, IATTR_ALL
}
 Window (visual) attributes, used during configInit(). More...
void setIAttribute (const IAttribute attr, const int32_t value)
int32_t getIAttribute (const IAttribute attr) const
static const std::string & getIAttributeString (const IAttribute attr)


Detailed Description

A Window represents an on-screen or off-screen drawable, and manages an OpenGL context.

A Window is a child of a Pipe. The task methods for all windows of a pipe are executed sequentially in the same thread, in the order they are stored on the Pipe.

The default window initialization methods do 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. Please note that each window might have it's 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 51 of file lib/client/window.h.


Member Enumeration Documentation

Window (visual) attributes, used during configInit().

Enumerator:
IATTR_HINT_STEREO  Active Stereo.
IATTR_HINT_DOUBLEBUFFER  Front and back buffer.
IATTR_HINT_FULLSCREEN  Fullscreen drawable.
IATTR_HINT_DECORATION  Window decorations.
IATTR_HINT_SWAPSYNC  Swap sync on vertical retrace.
IATTR_HINT_DRAWABLE  Drawable type.
IATTR_HINT_STATISTICS  Statistics gathering hint.
IATTR_HINT_SCREENSAVER  Screensaver (de)activation (WGL).
IATTR_PLANES_COLOR  No of per-component color planes.
IATTR_PLANES_ALPHA  No of alpha planes.
IATTR_PLANES_DEPTH  No of z-buffer planes.
IATTR_PLANES_STENCIL  No of stencil planes.
IATTR_PLANES_ACCUM  No of accumulation buffer planes.
IATTR_PLANES_ACCUM_ALPHA  No of alpha accum buffer planes.
IATTR_PLANES_SAMPLES  No of multisample (AA) planes.

Definition at line 218 of file lib/client/window.h.


Constructor & Destructor Documentation

eq::Window::Window ( Pipe parent  ) 

Constructs a new window.

Reimplemented in eqPly::Window.

Definition at line 82 of file lib/client/window.cpp.

References eq::Pipe::_addWindow(), and EQINFO.

Here is the call graph for this function:

eq::Window::~Window (  )  [virtual]

Destructs the window.

Reimplemented in eqPly::Window.

Definition at line 97 of file lib/client/window.cpp.

References eq::Pipe::_removeWindow(), eq::Pipe::isCurrent(), and eq::Pipe::setCurrent().

Here is the call graph for this function:


Member Function Documentation

const Pipe* eq::Window::getPipe (  )  const [inline]

Returns:
the pipe of this window.

Definition at line 105 of file lib/client/window.h.

Referenced by configInitOSWindow(), eqPly::Window::frameStart(), and eqPly::Window::swapBuffers().

Here is the caller graph for this function:

uint32_t eq::Window::getTasks (  )  const [inline]

Return the set of tasks this window's channels might execute in the worst case.

It is not guaranteed that all the tasks will be actually executed during rendering.

Warning:
Not finalized, might change in the future.
Returns:
the tasks.

Definition at line 133 of file lib/client/window.h.

VisitorResult eq::Window::accept ( WindowVisitor visitor  ) 

Traverse this window and all children using a window visitor.

Parameters:
visitor the visitor.
Returns:
the result of the visitor traversal.

Definition at line 276 of file lib/client/window.cpp.

References eq::Channel::accept(), eq::TRAVERSE_CONTINUE, eq::TRAVERSE_PRUNE, eq::TRAVERSE_TERMINATE, eq::WindowVisitor::visitPost(), and eq::WindowVisitor::visitPre().

Referenced by eq::Pipe::accept().

Here is the call graph for this function:

Here is the caller graph for this function:

const Window* eq::Window::getSharedContextWindow (  )  const [inline]

Returns:
the window with which this window shares the GL context

Definition at line 151 of file lib/client/window.h.

Referenced by eq::AGLWindow::createAGLContext(), eq::GLXWindow::createGLXContext(), and eq::WGLWindow::createWGLContext().

Here is the caller graph for this function:

Window* eq::Window::getSharedContextWindow (  )  [inline]

Returns:
the window with which this window shares the GL context

Definition at line 155 of file lib/client/window.h.

GLEWContext * eq::Window::glewGetContext (  ) 

Get the GLEW context for this window.

The glew context is initialized during window initialization, 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 supported GL function can be called directly from an initialized Window.

Returns:
the extended OpenGL function table for the window's OpenGL context.

Definition at line 662 of file lib/client/window.cpp.

References eq::OSWindow::glewGetContext().

Referenced by eq::Channel::glewGetContext().

Here is the call graph for this function:

Here is the caller graph for this function:

WGLEWContext * eq::Window::wglewGetContext (  ) 

Returns:
the generic WGL function table for the window's pipe.

Definition at line 270 of file lib/client/window.cpp.

References eq::Pipe::wglewGetContext().

Referenced by eq::OSWindow::wglewGetContext().

Here is the call graph for this function:

Here is the caller graph for this function:

const DrawableConfig& eq::Window::getDrawableConfig (  )  const [inline]

Returns:
information about the current drawable.

Definition at line 178 of file lib/client/window.h.

Referenced by getRenderContext().

Here is the caller graph for this function:

ObjectManager* eq::Window::getObjectManager (  )  [inline]

Returns:
the window's object manager instance.

Definition at line 182 of file lib/client/window.h.

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

Here is the caller graph for this function:

void eq::Window::setPixelViewport ( const PixelViewport pvp  ) 

Set the window's pixel viewport wrt its parent pipe.

Updates the fractional viewport accordingly.

Parameters:
pvp the viewport in pixels.

Definition at line 325 of file lib/client/window.cpp.

References eq::base::RefPtr< T >::get(), and eq::net::Object::send().

Referenced by eq::AGLWindow::configInitAGLFullscreen(), eq::GLXWindow::configInitGLXWindow(), processEvent(), eq::AGLWindow::setAGLPBuffer(), eq::AGLWindow::setCarbonWindow(), eq::WGLWindow::setWGLPBufferHandle(), eq::WGLWindow::setWGLWindowHandle(), and eq::GLXWindow::setXDrawable().

Here is the call graph for this function:

Here is the caller graph for this function:

const PixelViewport& eq::Window::getPixelViewport (  )  const [inline]

const Viewport& eq::Window::getViewport (  )  const [inline]

Returns:
the window's fractional viewport.

Definition at line 202 of file lib/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.

Definition at line 387 of file lib/client/window.cpp.

References eq::Window::Window::DrawableConfig::doublebuffered, getDrawableConfig(), eq::PixelViewport::h, eq::PixelViewport::isPointInside(), and eq::RenderContext::pvp.

Referenced by eq::EventHandler::_getRenderContext().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void eq::Window::flush (  )  const [inline, virtual]

Flush outstanding rendering requests.

Definition at line 250 of file lib/client/window.h.

Referenced by frameFinish().

Here is the caller graph for this function:

virtual void eq::Window::finish (  )  const [inline, virtual]

Finish outstanding rendering requests.

Definition at line 252 of file lib/client/window.h.

void eq::Window::setOSWindow ( OSWindow window  ) 

Set the OS-specific window.

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

Definition at line 431 of file lib/client/window.cpp.

References eq::OSWindow::exitGLEW(), eq::OSWindow::initGLEW(), and makeCurrent().

Referenced by configInitOSWindow().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Window::setErrorMessage ( const std::string &  message  ) 

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:
event the received window system event.
Returns:
true when the event was handled, false if not.

Definition at line 685 of file lib/client/window.cpp.

References eq::ConfigEvent::data, eq::Window::Window::DrawableConfig::doublebuffered, EQWARN, eq::ResizeEvent::h, IATTR_HINT_DRAWABLE, IATTR_HINT_SCREENSAVER, eq::KeyEvent::key, eq::Event::key, eq::Event::KEY_PRESS, eq::Event::KEY_RELEASE, eq::OFF, eq::ON, eq::Event::POINTER_BUTTON_PRESS, eq::Event::POINTER_BUTTON_RELEASE, eq::Event::POINTER_MOTION, eq::Event::resize, eq::Config::sendEvent(), setPixelViewport(), eq::Event::STATISTIC, eq::Event::type, eq::ResizeEvent::w, eq::WINDOW, eq::Event::WINDOW_CLOSE, eq::Event::WINDOW_EXPOSE, eq::Event::WINDOW_HIDE, eq::Event::WINDOW_RESIZE, eq::Event::WINDOW_SCREENSAVER, eq::Event::WINDOW_SHOW, eq::ResizeEvent::x, and eq::ResizeEvent::y.

Referenced by eq::AGLWindowIF::processEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

int eq::Window::getColorType (  ) 

Returns:
the internal color type

Definition at line 652 of file lib/client/window.cpp.

References IATTR_PLANES_COLOR, eq::RGBA16F, and eq::RGBA32F.

Referenced by eq::OSWindow::configInitFBO(), and eq::Channel::frameReadback().

Here is the caller graph for this function:

bool eq::Window::isFBOWindow (  ) 

Returns:
true if FBO is used

Definition at line 641 of file lib/client/window.cpp.

References eq::OSWindow::getFBO().

Referenced by eq::Channel::applyBuffer().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Window::attachToSession ( const uint32_t  id,
const uint32_t  instanceID,
net::Session session 
) [protected, virtual]

Called when object is attached to session.

For internal use only.

Reimplemented from eq::net::Object.

Definition at line 108 of file lib/client/window.cpp.

References eq::Pipe::getPipeThreadQueue(), and eq::net::Dispatcher::registerCommand().

Here is the call graph for this function:

void eq::Window::startFrame ( const uint32_t  frameNumber  )  [inline, protected]

Start a frame by unlocking all child resources.

Parameters:
frameNumber the frame to start.

Definition at line 336 of file lib/client/window.h.

Referenced by frameStart().

Here is the caller graph for this function:

void eq::Window::releaseFrame ( const uint32_t  frameNumber  )  [inline, protected]

Signal the completion of a frame to the parent.

Parameters:
frameNumber the frame to end.

Definition at line 343 of file lib/client/window.h.

Referenced by frameFinish().

Here is the caller graph for this function:

void eq::Window::releaseFrameLocal ( const uint32_t  frameNumber  )  [inline, protected]

Release the local synchronization of the parent for a frame.

Parameters:
frameNumber the frame to release.

Definition at line 350 of file lib/client/window.h.

Referenced by frameDrawFinish().

Here is the caller graph for this function:

bool eq::Window::configInit ( const uint32_t  initID  )  [protected, virtual]

Initialize this window.

Parameters:
initID the init identifier.

Definition at line 458 of file lib/client/window.cpp.

References configInitGL(), configInitOSWindow(), eq::PixelViewport::isValid(), and setErrorMessage().

Here is the call graph for this function:

bool eq::Window::configInitOSWindow ( const uint32_t  initID  )  [protected, virtual]

Initialize the OS-specific window.

See also:
setOSWindow()

Definition at line 475 of file lib/client/window.cpp.

References eq::OSWindow::configInit(), EQERROR, EQINFO, EQWARN, getPipe(), eq::Pipe::getWindowSystem(), setOSWindow(), eq::WINDOW_SYSTEM_AGL, eq::WINDOW_SYSTEM_GLX, and eq::WINDOW_SYSTEM_WGL.

Referenced by configInit().

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::Window::configInitGL ( const uint32_t  initID  )  [protected, virtual]

Initialize the OpenGL state for this window.

Parameters:
initID the init identifier.
Returns:
true if the initialization was successful, false if not.

Reimplemented in eqPly::Window.

Definition at line 578 of file lib/client/window.cpp.

References swapBuffers().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool eq::Window::configExit (  )  [protected, virtual]

Exit this window.

Definition at line 603 of file lib/client/window.cpp.

References configExitGL(), and configExitOSWindow().

Here is the call graph for this function:

bool eq::Window::configExitOSWindow (  )  [protected, virtual]

De-initialize the OS-specific window.

Definition at line 609 of file lib/client/window.cpp.

References eq::OSWindow::configExit(), eq::Pipe::isCurrent(), and eq::Pipe::setCurrent().

Referenced by configExit().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool eq::Window::configExitGL (  )  [inline, protected, virtual]

De-initializer the OpenGL state for this window.

Reimplemented in eqPly::Window.

Definition at line 391 of file lib/client/window.h.

Referenced by configExit().

Here is the caller graph for this function:

virtual void eq::Window::frameStart ( const uint32_t  frameID,
const uint32_t  frameNumber 
) [inline, 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().

Parameters:
frameID the per-frame identifier.
frameNumber the frame to start.
See also:
Config::beginFrame()

Reimplemented in eqPly::Window.

Definition at line 403 of file lib/client/window.h.

References startFrame().

Here is the call graph for this function:

void eq::Window::frameFinish ( const uint32_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.

Parameters:
frameID the per-frame identifier.
frameNumber the frame to finish.

Definition at line 448 of file lib/client/window.cpp.

References flush(), and releaseFrame().

Here is the call graph for this function:

virtual void eq::Window::frameDrawFinish ( const uint32_t  frameID,
const uint32_t  frameNumber 
) [inline, protected, virtual]

Finish drawing.

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

Parameters:
frameID the per-frame identifier.
frameNumber the frame to finished with draw.

Definition at line 431 of file lib/client/window.h.

References releaseFrameLocal().

Here is the call graph for this function:

void eq::Window::makeCurrent ( const bool  cache = true  )  const [protected, virtual]

Make the window's drawable and context current.

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

Definition at line 627 of file lib/client/window.cpp.

References eq::Pipe::isCurrent(), and eq::OSWindow::makeCurrent().

Referenced by setOSWindow().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Window::bindFrameBuffer (  )  const [protected, virtual]

Bind the window's FBO, if it uses one.

Definition at line 636 of file lib/client/window.cpp.

References eq::OSWindow::bindFrameBuffer().

Referenced by eq::Channel::bindFrameBuffer().

Here is the call graph for this function:

Here is the caller graph for this function:

void eq::Window::swapBuffers (  )  [protected, virtual]

Swap the front and back buffer of the window.

Reimplemented in eqPly::Window.

Definition at line 646 of file lib/client/window.cpp.

References EQVERB, and eq::OSWindow::swapBuffers().

Referenced by configInitGL().

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Mon Aug 10 18:58:43 2009 for Equalizer 0.9 by  doxygen 1.5.8