eq::Channel Class Reference

A channel represents a two-dimensional viewport within a Window. More...

#include <channel.h>

Inheritance diagram for eq::Channel:

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

Collaboration graph
[legend]

List of all members.

Public Types

enum  Drawable { FBO_NONE = EQ_BIT_NONE, FBO_COLOR = EQ_BIT1, FBO_DEPTH = EQ_BIT2, FBO_STENCIL = EQ_BIT3 }
 The drawable format defining the components used as an alternate drawable for this cannel. More...

Public Member Functions

 Channel (Window *parent)
 Constructs a new channel.
virtual ~Channel ()
 Destructs the channel.
Data Access
WindowgetWindow ()
const WindowgetWindow () const
PipegetPipe ()
const PipegetPipe () const
NodegetNode ()
const NodegetNode () const
ConfiggetConfig ()
const ConfiggetConfig () const
ServerPtr getServer ()
Window::ObjectManagergetObjectManager ()
GLEWContext * glewGetContext ()
 Get the GLEW context for this channel.
const GLEWContext * glewGetContext () const
const std::string & getName () const
uint32_t getTasks () const
 Return the set of tasks this channel might execute in the worst case.
VisitorResult accept (ChannelVisitor &visitor)
 Traverse this channel and all children using a channel visitor.
void setNearFar (const float nearPlane, const float farPlane)
 Set the near and far planes for this channel.
const Vector3ubgetUniqueColor () const
 Return a stable, unique color for this channel.
const ViewgetView ()
 Get the channel's view.
const ViewgetNativeView ()
void addStatistic (Event &event)
 Add a new statistics event for the current frame.
Context-specific data access.
The data returned by these methods depends on the context (callback) they are called from, typically the data for the current rendering task.

uint32_t getDrawBuffer () const
uint32_t getReadBuffer () const
const ColorMaskgetDrawBufferMask () const
const PixelViewportgetPixelViewport () const
const Vector2igetPixelOffset () const
 Get the channel's current position wrt the destination channel.
const FrustumfgetFrustum () const
const FrustumfgetOrtho () const
const ViewportgetViewport () const
const RangegetRange () const
const PixelgetPixel () const
const ZoomgetZoom () const
Eye getEye () const
const Matrix4fgetHeadTransform () const
const FrameVectorgetInputFrames ()
const FrameVectorgetOutputFrames ()
Frustumf getScreenFrustum () const
 Returns an orthographic frustum for 2D operations on the view.
const PixelViewportgetNativePixelViewPort () const
 get the channel's native (drawable) pixel viewport.
const Vector4igetOverdraw () const
void setMaxSize (const Vector2i &size)
uint32_t getTaskID () const
FrameBufferObjectgetFrameBufferObject ()
 get the FBO used as an alternate frame buffer.
Operations
Operations are only meaningfull from within certain callbacks.

They are just convenience wrappers applying context-specific data to the OpenGL state.

virtual void applyBuffer ()
 Apply the current rendering buffer, including the color mask.
virtual void applyColorMask () const
 Apply the current color mask.
virtual void applyViewport () const
 Apply the OpenGL viewport for the current rendering task.
virtual void applyFrustum () const
 Apply the perspective frustum matrix for the current rendering task.
virtual void applyOrtho () const
 Apply the orthographic frustum matrix for the current rendering task.
void applyScreenFrustum () const
 Apply a orthographic frustum for pixel-based 2D operations.
virtual void applyHeadTransform () const
 Apply the modeling transformation to position and orient the view frustum.
virtual void applyFrameBufferObject ()
 Apply the current alternate frame buffer.
virtual bool processEvent (const Event &event)
 Process a received event.
virtual void drawStatistics ()
 Draw a statistics overlay.
virtual void outlineViewport ()
 Outlines the current pixel viewport.

Protected Member Functions

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 channel.
virtual bool configExit ()
 Exit this channel.
void bindFrameBuffer ()
 Rebind the current alternate rendering buffer.
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 frameClear (const uint32_t frameID)
 Clear the frame buffer.
virtual void frameDraw (const uint32_t frameID)
 Draw the scene.
virtual void frameAssemble (const uint32_t frameID)
 Assemble input frames.
virtual void frameReadback (const uint32_t frameID)
 Read back the rendered scene.
virtual void frameViewStart (const uint32_t frameID)
 Start updating a destination channel.
virtual void frameViewFinish (const uint32_t frameID)
 Finish updating a destination channel.
virtual void setupAssemblyState ()
 Setup the OpenGL state for a readback or assemble operation.
virtual void resetAssemblyState ()
 Reset the OpenGL state after an assembly operation.
Error information.
void setErrorMessage (const std::string &message)
 Set a message why the last operation failed.

Friends

class Window

Attributes

enum  IAttribute {
  IATTR_HINT_STATISTICS, IATTR_HINT_SENDTOKEN, IATTR_FILL1, IATTR_FILL2,
  IATTR_ALL
}
int32_t getIAttribute (const IAttribute attr) const
static const std::string & getIAttributeString (const IAttribute attr)


Detailed Description

A channel represents a two-dimensional viewport within a Window.

The channel is the basic rendering entity. It executes all rendering-relevant tasks, such as clear, draw, assemble and readback. It is a child of a Window.

Definition at line 46 of file lib/client/channel.h.


Member Enumeration Documentation

The drawable format defining the components used as an alternate drawable for this cannel.

Enumerator:
FBO_COLOR  Use FBO color attachment.
FBO_DEPTH  Use FBO depth attachment.
FBO_STENCIL  Use FBO stencil attachment.

Definition at line 54 of file lib/client/channel.h.


Constructor & Destructor Documentation

Channel::Channel ( Window parent  ) 

Constructs a new channel.

Reimplemented in eqPly::Channel.

Definition at line 60 of file lib/client/channel.cpp.

References eq::Window::_addChannel(), and EQINFO.

Here is the call graph for this function:

Channel::~Channel (  )  [virtual]

Destructs the channel.

Reimplemented in eqPly::Channel.

Definition at line 75 of file lib/client/channel.cpp.

References eq::Window::_removeChannel(), and EQINFO.

Here is the call graph for this function:


Member Function Documentation

GLEWContext * Channel::glewGetContext (  ) 

Get the GLEW context for this channel.

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 Channel.

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

Definition at line 161 of file lib/client/channel.cpp.

References eq::Window::glewGetContext().

Here is the call graph for this function:

const std::string& eq::Channel::getName (  )  const [inline]

Returns:
the name of the window.

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

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

Return the set of tasks this channel might execute in the worst case.

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

Returns:
the tasks.

Definition at line 115 of file lib/client/channel.h.

VisitorResult Channel::accept ( ChannelVisitor visitor  ) 

Traverse this channel and all children using a channel visitor.

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

Definition at line 172 of file lib/client/channel.cpp.

References eq::ChannelVisitor::visit().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void Channel::setNearFar ( const float  nearPlane,
const float  farPlane 
)

Set the near and far planes for this channel.

The near and far planes are set during initialisation and are inherited by source channels contributing to the rendering of this channel. Dynamic near and far planes can be applied using applyNearFar.

Parameters:
nearPlane the near plane.
farPlane the far plane.

Definition at line 322 of file lib/client/channel.cpp.

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

Referenced by eqPly::Channel::configInit().

Here is the call graph for this function:

Here is the caller graph for this function:

const Vector3ub& eq::Channel::getUniqueColor (  )  const [inline]

Return a stable, unique color for this channel.

Definition at line 139 of file lib/client/channel.h.

Referenced by eqPly::Channel::frameClear(), frameClear(), and eqPly::Channel::frameDraw().

Here is the caller graph for this function:

const View * Channel::getView (  ) 

Get the channel's view.

A channel has a View if a Wall or Projection description is configured for it. This is typically the case for destination channels, source channels do not have a native view. During rendering operations, the view of the current destination channel, i.e., the channel this channel is rendering for, is returned.

Returns:
the channel's view, or 0 if it does not have a view.

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

References eq::Pipe::getView(), and eq::RenderContext::view.

Referenced by eqPly::Channel::frameClear().

Here is the call graph for this function:

Here is the caller graph for this function:

const View * Channel::getNativeView (  ) 

Returns:
the channel's native view, or 0 if it is not an output channel.

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

References eq::Pipe::getView(), and eq::RenderContext::view.

Here is the call graph for this function:

void Channel::addStatistic ( Event event  ) 

Add a new statistics event for the current frame.

Definition at line 352 of file lib/client/channel.cpp.

References processEvent(), and eq::Event::statistic.

Here is the call graph for this function:

uint32_t Channel::getDrawBuffer (  )  const

Returns:
the channel's current draw buffer.

Definition at line 515 of file lib/client/channel.cpp.

References eq::RenderContext::buffer.

Referenced by applyBuffer().

Here is the caller graph for this function:

uint32_t Channel::getReadBuffer (  )  const

Returns:
the channel's current read buffer.

Definition at line 520 of file lib/client/channel.cpp.

References eq::RenderContext::buffer.

Referenced by applyBuffer().

Here is the caller graph for this function:

const ColorMask & Channel::getDrawBufferMask (  )  const

Returns:
the channel's current color mask for drawing.

Definition at line 525 of file lib/client/channel.cpp.

References eq::RenderContext::bufferMask.

Referenced by applyColorMask(), and eq::Compositor::setupStencilBuffer().

Here is the caller graph for this function:

const PixelViewport & Channel::getPixelViewport (  )  const

Returns:
the channel's current pixel viewport.

Definition at line 505 of file lib/client/channel.cpp.

References eq::RenderContext::pvp.

Referenced by applyViewport(), getScreenFrustum(), and outlineViewport().

Here is the caller graph for this function:

const Vector2i & Channel::getPixelOffset (  )  const

Get the channel's current position wrt the destination channel.

Note that computing this value from the current viewport and pixel viewport is inaccurate because it neglects rounding of the pixel viewport done by the server.

Returns:
the channel's current position wrt the destination channel.

Definition at line 510 of file lib/client/channel.cpp.

References eq::RenderContext::offset.

const Frustumf & Channel::getFrustum (  )  const

Returns:
the perspective frustum for the current rendering task.

Definition at line 530 of file lib/client/channel.cpp.

References eq::RenderContext::frustum.

Referenced by applyFrustum().

Here is the caller graph for this function:

const Frustumf & Channel::getOrtho (  )  const

Returns:
the orthographic frustum for the current rendering task.

Definition at line 535 of file lib/client/channel.cpp.

References eq::RenderContext::ortho.

Referenced by applyOrtho().

Here is the caller graph for this function:

const Viewport & Channel::getViewport (  )  const

Returns:
the fractional viewport wrt the destination view.

Definition at line 500 of file lib/client/channel.cpp.

References eq::RenderContext::vp.

Referenced by getScreenFrustum().

Here is the caller graph for this function:

const Range & Channel::getRange (  )  const

Returns:
the database range for the current rendering task.

Definition at line 540 of file lib/client/channel.cpp.

References eq::RenderContext::range.

const Pixel & Channel::getPixel (  )  const

Returns:
the pixel decomposition for the current rendering task.

Definition at line 545 of file lib/client/channel.cpp.

References eq::RenderContext::pixel.

Referenced by getScreenFrustum().

Here is the caller graph for this function:

const Zoom & Channel::getZoom (  )  const

Returns:
the up/downscale factor for the current rendering task.

Definition at line 550 of file lib/client/channel.cpp.

References eq::RenderContext::zoom.

Eye Channel::getEye (  )  const

Returns:
the currently rendered eye pass.

Definition at line 555 of file lib/client/channel.cpp.

References eq::RenderContext::eye.

const Matrix4f & Channel::getHeadTransform (  )  const

Returns:
the view transformation to position and orient the view frustum.

Definition at line 560 of file lib/client/channel.cpp.

References eq::RenderContext::headTransform.

Referenced by applyHeadTransform().

Here is the caller graph for this function:

const FrameVector& eq::Channel::getInputFrames (  )  [inline]

Returns:
the list of input frames, used from frameAssemble().

Definition at line 223 of file lib/client/channel.h.

Referenced by frameAssemble().

Here is the caller graph for this function:

const FrameVector& eq::Channel::getOutputFrames (  )  [inline]

Returns:
the list of output frames, used from frameReadback().

Definition at line 226 of file lib/client/channel.h.

Referenced by eqPly::Channel::frameReadback(), and frameReadback().

Here is the caller graph for this function:

Frustumf Channel::getScreenFrustum (  )  const

Returns an orthographic frustum for 2D operations on the view.

One unit of the frustum covers one pixel on screen. The frustum is positioned relative to the view.

Returns:
the 2D orthographic frustum.

Definition at line 565 of file lib/client/channel.cpp.

References getPixel(), getPixelViewport(), getViewport(), eq::PixelViewport::getXEnd(), eq::PixelViewport::getYEnd(), eq::Viewport::h, eq::PixelViewport::h, eq::Viewport::w, eq::PixelViewport::w, eq::Viewport::x, eq::PixelViewport::x, eq::Viewport::y, and eq::PixelViewport::y.

Referenced by applyScreenFrustum().

Here is the call graph for this function:

Here is the caller graph for this function:

const Vector4i & Channel::getOverdraw (  )  const

For internal use only.

Undocumented - may not be supported in the future

Definition at line 582 of file lib/client/channel.cpp.

References eq::RenderContext::overdraw.

void Channel::setMaxSize ( const Vector2i size  ) 

For internal use only.

Undocumented - may not be supported in the future

Definition at line 587 of file lib/client/channel.cpp.

uint32_t Channel::getTaskID (  )  const

For internal use only.

Undocumented - may not be supported in the future

Definition at line 593 of file lib/client/channel.cpp.

References eq::RenderContext::taskID.

void Channel::applyScreenFrustum (  )  const

Apply a orthographic frustum for pixel-based 2D operations.

One unit in the frustum corresponds to one pixel on the screen. The frustum is position wrt the canvas.

Definition at line 691 of file lib/client/channel.cpp.

References EQVERB, and getScreenFrustum().

Here is the call graph for this function:

bool Channel::processEvent ( const Event event  )  [virtual]

Process a received event.

The task of this method is to update the channel as necessary, and transform the event into an config event to be send to the application using Config::sendEvent().

Parameters:
event the received event.
Returns:
true when the event was handled, false if not.

Definition at line 707 of file lib/client/channel.cpp.

References eq::Event::CHANNEL_RESIZE, eq::ConfigEvent::data, eq::ResizeEvent::dh, eq::ResizeEvent::dw, EQWARN, eq::ResizeEvent::h, eq::net::ObjectVersion::id, eq::Event::originator, eq::Event::resize, eq::Config::sendEvent(), eq::Event::STATISTIC, eq::Event::type, eq::RenderContext::view, eq::Event::VIEW_RESIZE, and eq::ResizeEvent::w.

Referenced by addStatistic().

Here is the call graph for this function:

Here is the caller graph for this function:

void Channel::drawStatistics (  )  [virtual]

void Channel::outlineViewport (  )  [virtual]

Outlines the current pixel viewport.

Definition at line 1069 of file lib/client/channel.cpp.

References getPixelViewport(), eq::PixelViewport::getXEnd(), eq::PixelViewport::getYEnd(), resetAssemblyState(), setupAssemblyState(), eq::PixelViewport::x, and eq::PixelViewport::y.

Here is the call graph for this function:

void Channel::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 81 of file lib/client/channel.cpp.

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

Here is the call graph for this function:

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

Start a frame by unlocking all child resources.

Parameters:
frameNumber the frame to start.

Definition at line 372 of file lib/client/channel.h.

Referenced by frameStart().

Here is the caller graph for this function:

void eq::Channel::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 379 of file lib/client/channel.h.

Referenced by frameFinish().

Here is the caller graph for this function:

void eq::Channel::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 386 of file lib/client/channel.h.

Referenced by frameDrawFinish().

Here is the caller graph for this function:

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

Initialize this channel.

Parameters:
initID the init identifier.

Reimplemented in eqPly::Channel.

Definition at line 183 of file lib/client/channel.cpp.

Referenced by eqPly::Channel::configInit().

Here is the caller graph for this function:

virtual void eq::Channel::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 channel-specific data. This method has to call startFrame().

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

Definition at line 423 of file lib/client/channel.h.

References startFrame().

Here is the call graph for this function:

virtual void eq::Channel::frameFinish ( const uint32_t  frameID,
const uint32_t  frameNumber 
) [inline, protected, virtual]

Finish rendering a frame.

Called once at the end of each frame, to do per-frame updates of channel-specific data. This method has to call releaseFrame().

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

Definition at line 436 of file lib/client/channel.h.

References releaseFrame().

Here is the call graph for this function:

virtual void eq::Channel::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 449 of file lib/client/channel.h.

References releaseFrameLocal().

Here is the call graph for this function:

void Channel::frameClear ( const uint32_t  frameID  )  [protected, virtual]

Clear the frame buffer.

Parameters:
frameID the per-frame identifier.

Reimplemented in eqPly::Channel.

Definition at line 362 of file lib/client/channel.cpp.

References applyBuffer(), applyViewport(), and getUniqueColor().

Here is the call graph for this function:

void Channel::frameDraw ( const uint32_t  frameID  )  [protected, virtual]

Draw the scene.

Parameters:
frameID the per-frame identifier.

Reimplemented in eqPly::Channel.

Definition at line 378 of file lib/client/channel.cpp.

References applyBuffer(), applyFrustum(), applyHeadTransform(), and applyViewport().

Here is the call graph for this function:

void Channel::frameAssemble ( const uint32_t  frameID  )  [protected, virtual]

Assemble input frames.

Parameters:
frameID the per-frame identifier.
See also:
getInputFrames

Definition at line 392 of file lib/client/channel.cpp.

References applyBuffer(), applyViewport(), eq::Compositor::assembleFrames(), getInputFrames(), resetAssemblyState(), and setupAssemblyState().

Here is the call graph for this function:

void Channel::frameReadback ( const uint32_t  frameID  )  [protected, virtual]

Read back the rendered scene.

Parameters:
frameID the per-frame identifier.
See also:
getOutputFrames

Reimplemented in eqPly::Channel.

Definition at line 403 of file lib/client/channel.cpp.

References applyBuffer(), applyViewport(), eq::Window::getColorType(), getOutputFrames(), resetAssemblyState(), eq::Frame::setColorType(), setupAssemblyState(), eq::Frame::startReadback(), and eq::Frame::syncReadback().

Here is the call graph for this function:

virtual void eq::Channel::frameViewStart ( const uint32_t  frameID  )  [inline, protected, virtual]

Start updating a destination channel.

Called on each destination channel, e.g., channels which are defined by a view/segment intersection, updating a part of a display.

Parameters:
frameID the per-frame identifier.

Definition at line 491 of file lib/client/channel.h.

virtual void eq::Channel::frameViewFinish ( const uint32_t  frameID  )  [inline, protected, virtual]

Finish updating a destination channel.

This is typically used to do operations on the output channel after it has been fully updated, e.g., to draw a 2D overlay.

Parameters:
frameID the per-frame identifier.

Reimplemented in eqPly::Channel.

Definition at line 501 of file lib/client/channel.h.

void Channel::setupAssemblyState (  )  [protected, virtual]

Setup the OpenGL state for a readback or assemble operation.

The default implementation is very conservative and saves any state which is potentially changed by the assembly routines.

Definition at line 427 of file lib/client/channel.cpp.

References EQERROR, eq::Window::getPixelViewport(), eq::FrameBufferObject::getPixelViewport(), eq::PixelViewport::h, eq::PixelViewport::hasArea(), and eq::PixelViewport::w.

Referenced by drawStatistics(), frameAssemble(), frameReadback(), and outlineViewport().

Here is the call graph for this function:

Here is the caller graph for this function:

void Channel::setErrorMessage ( const std::string &  message  )  [protected]

Set a message why the last operation failed.

The message will be transmitted to the originator of the request, for example to Config::init when set from within the configInit method.

Parameters:
message the error message.

Definition at line 489 of file lib/client/channel.cpp.


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