Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vrj::Display Class Reference

Container class for viewports and window information. More...

#include <Display.h>

List of all members.

Public Methods

 Display ()
virtual ~Display ()
virtual void config (jccl::ConfigElementPtr element)
 Takes a display config element and configures the display based one it. More...

void configDisplayWindow (jccl::ConfigElementPtr element)
void configViewports (jccl::ConfigElementPtr element)
void updateProjections (const float positionScale)
 Updates the projection data for each contained viewport. More...

bool isActive ()
void setName (std::string name)
std::string getName ()
 Gets the name of this display. More...

bool shouldDrawBorder ()
void setOriginAndSize (int xo, int yo, int xs, int ys, bool updateConfig=false)
 Explicitly set the origin and size. More...

void getOriginAndSize (int &xo, int &yo, int &xs, int &ys)
 Return the current origin and size. More...

void setPipe (int pipe)
int getPipe ()
bool isStereoRequested ()
 Indicates whether stereo rendering has been requested for this display. More...

jccl::ConfigElementPtr getConfigElement ()
 Gets the config element that configured this display window. More...

jccl::ConfigElementPtr getGlFrameBufferConfig ()
friend VJ_API (std::ostream &) operator<<(std
vrj::ViewportgetViewport (int vpNum)

Protected Attributes

std::string mName
 Name of the window. More...

int _xo
int _yo
int _xs
int _ys
 X and Y origin and size of the view. More...

bool mBorder
 Should we have a border. More...

int mPipe
 Hardware pipe. More...

bool mActive
 Is the display active or not? More...

bool mStereoRequested
 Has stereo been requested? More...

jccl::ConfigElementPtr mDisplayElement
 The config data for this display. More...

std::vector< vrj::Viewport * > mViewports
 Contained viewports. More...


Detailed Description

Container class for viewports and window information.

Stores location of window and viewports within the window.

Date:
3-5-2001

Definition at line 50 of file Display.h.


Constructor & Destructor Documentation

vrj::Display::Display   [inline]
 

Definition at line 53 of file Display.h.

00053              : mBorder(true), mPipe(-1), mActive(true), mStereoRequested(false)
00054    {
00055       _xo = _yo = _xs = _ys = -1;
00056    }

virtual vrj::Display::~Display   [inline, virtual]
 

Definition at line 58 of file Display.h.

00059    {;}


Member Function Documentation

void vrj::Display::config jccl::ConfigElementPtr    element [virtual]
 

Takes a display config element and configures the display based one it.

Precondition:
element is a valid configuration element.
Postcondition:
display is configured. If there is an error is the specified config, we output error and "fix" the error.
Note:
All derived display classes MUST call this function after doing local configuration.

Definition at line 66 of file Display.cpp.

References configDisplayWindow, and configViewports.

00067 {
00068    vprASSERT(element.get() != NULL);
00069 
00070    configDisplayWindow(element);
00071    configViewports(element);
00072 }

void vrj::Display::configDisplayWindow jccl::ConfigElementPtr    element
 

Definition at line 74 of file Display.cpp.

References mActive, mBorder, mDisplayElement, mStereoRequested, setName, setOriginAndSize, setPipe, and vrjDBG_DISP_MGR.

Referenced by config.

00075 {
00076    vprASSERT(element.get() != NULL);
00077 
00078    // -- Get config info from element -- //
00079    int originX      = element->getProperty<int>("origin", 0);
00080    int originY      = element->getProperty<int>("origin", 1);
00081    int sizeX        = element->getProperty<int>("size", 0);
00082    int sizeY        = element->getProperty<int>("size", 1);
00083    std::string name = element->getName();
00084    mBorder          = element->getProperty<bool>("border");
00085    int pipe         = element->getProperty<int>("pipe");
00086    mActive          = element->getProperty<bool>("active");
00087    mStereoRequested = element->getProperty<bool>("stereo");
00088 
00089    // -- Check for error in configuration -- //
00090    // NOTE: If there are errors, set them to some default value
00091    if(sizeX <= 0)
00092    {
00093       vprDEBUG(vrjDBG_DISP_MGR, vprDBG_WARNING_LVL)
00094          << "WARNING: window sizeX set to: " << sizeX
00095          << ".  Setting to 10." << std::endl << vprDEBUG_FLUSH;
00096       sizeX = 10;
00097    }
00098 
00099    if(sizeY <= 0)
00100    {
00101       vprDEBUG(vrjDBG_DISP_MGR, vprDBG_WARNING_LVL)
00102          << "WARNING: window sizeY set to: " << sizeY
00103          << ".  Setting to 10." << std::endl << vprDEBUG_FLUSH;
00104       sizeY = 10;
00105    }
00106 
00107    if(pipe < 0)
00108    {
00109       vprDEBUG(vrjDBG_DISP_MGR, vprDBG_WARNING_LVL)
00110          << "WARNING: pipe was negative, pipe set to: " << pipe
00111          << ".  Setting to 0.\n" << vprDEBUG_FLUSH;
00112       pipe = 0;
00113    }
00114 
00115       // -- Set local window attributes --- //
00116     setOriginAndSize(originX, originY, sizeX, sizeY);
00117 
00118     setName(name);
00119     setPipe(pipe);
00120 
00121     mDisplayElement = element;        // Save the element for later use
00122 }

void vrj::Display::configViewports jccl::ConfigElementPtr    element
 

Definition at line 124 of file Display.cpp.

References mViewports.

Referenced by config.

00125 {
00126    vprASSERT(element.get() != NULL);
00127 
00128    unsigned num_sim_vps = element->getNum("simulator_viewports");
00129    unsigned num_surface_vps = element->getNum("surface_viewports");
00130 
00131    jccl::ConfigElementPtr vp_elt;
00132    SimViewport* sim_vp = NULL;
00133    SurfaceViewport* surf_vp = NULL;
00134 
00135    unsigned i(0);
00136 
00137    // Create sim viewports
00138    // - Set the parent display
00139    // - Configure it
00140    for(i=0;i<num_sim_vps;i++)
00141    {
00142       vp_elt = element->getProperty<jccl::ConfigElementPtr>("simulator_viewports",i);
00143       sim_vp = new SimViewport;
00144       sim_vp->setDisplay(this);
00145       sim_vp->config(vp_elt);
00146       mViewports.push_back(sim_vp);
00147    }
00148 
00149    // Create surface viewports
00150    // - Set the parent display
00151    // - Configure it
00152    for(i=0;i<num_surface_vps;i++)
00153    {
00154       vp_elt = element->getProperty<jccl::ConfigElementPtr>("surface_viewports",i);
00155       surf_vp = new SurfaceViewport;
00156       surf_vp->setDisplay(this);
00157       surf_vp->config(vp_elt);
00158       mViewports.push_back(surf_vp);
00159    }
00160 }

void vrj::Display::updateProjections const float    positionScale
 

Updates the projection data for each contained viewport.

Parameters:
positionScale  - Scale value for converting from Juggler units (meters) to the display units

Definition at line 44 of file Display.cpp.

References mViewports.

00045 {
00046    for(unsigned i=0;i<mViewports.size();i++)
00047    {
00048       mViewports[i]->updateProjections(positionScale);
00049    }
00050 }

bool vrj::Display::isActive   [inline]
 

Definition at line 83 of file Display.h.

00084    { return mActive; }

void vrj::Display::setName std::string    name [inline]
 

Definition at line 86 of file Display.h.

Referenced by configDisplayWindow.

00087    { mName = name; }

std::string vrj::Display::getName   [inline]
 

Gets the name of this display.

Definition at line 90 of file Display.h.

Referenced by vrj::PfDrawManager::configFrameBuffer, vrj::GlWindowXWin::configWindow, vrj::GlWindowWin32::configWindow, vrj::GlWindowOSX::configWindow, vrj::GlWindowXWin::getGlxVisInfo, and vrj::GlWindowWin32::setPixelFormat.

00091    { return mName;}

bool vrj::Display::shouldDrawBorder   [inline]
 

Definition at line 93 of file Display.h.

Referenced by vrj::GlWindow::configWindow.

00094    { return mBorder;}

void vrj::Display::setOriginAndSize int    xo,
int    yo,
int    xs,
int    ys,
bool    updateConfig = false
 

Explicitly set the origin and size.

Parameters:
updateConfig  - If true, then the changes will be reflected in the config element for this display.

Definition at line 53 of file Display.cpp.

References _xo, _xs, _yo, _ys, and mDisplayElement.

Referenced by configDisplayWindow.

00054 { 
00055    _xo = xo; _yo = yo; _xs = xs; _ys = ys;
00056    if(updateConfig)
00057    {
00058       mDisplayElement->setProperty<int>("origin", 0, xo);
00059       mDisplayElement->setProperty<int>("origin", 1, yo);
00060       mDisplayElement->setProperty<int>("size", 0, xs);
00061       mDisplayElement->setProperty<int>("size", 1, ys);
00062    }
00063 }

void vrj::Display::getOriginAndSize int &    xo,
int &    yo,
int &    xs,
int &    ys
[inline]
 

Return the current origin and size.

Definition at line 102 of file Display.h.

Referenced by vrj::GlWindow::configWindow.

00103    {
00104       vprASSERT(_xo != -1);     // Make sure we have been configured
00105       xo = _xo; yo = _yo; xs = _xs; ys = _ys;
00106    }

void vrj::Display::setPipe int    pipe [inline]
 

Definition at line 108 of file Display.h.

Referenced by configDisplayWindow.

00109    { mPipe = pipe; }

int vrj::Display::getPipe   [inline]
 

Definition at line 110 of file Display.h.

Referenced by vrj::GlWindowXWin::configWindow, vrj::GlWindowWin32::configWindow, and vrj::GlWindowOSX::configWindow.

00111    { return mPipe; }

bool vrj::Display::isStereoRequested   [inline]
 

Indicates whether stereo rendering has been requested for this display.

Note:
If we are in simulator, we can not be in stereo.

Definition at line 118 of file Display.h.

Referenced by vrj::GlWindowXWin::getGlxVisInfo, and vrj::GlWindowWin32::setPixelFormat.

00119    {
00120       return mStereoRequested;
00121    }

jccl::ConfigElementPtr vrj::Display::getConfigElement   [inline]
 

Gets the config element that configured this display window.

Definition at line 124 of file Display.h.

Referenced by vrj::GlWindowXWin::configWindow, vrj::GlWindowWin32::configWindow, and vrj::GlWindowOSX::configWindow.

00125    {
00126       return mDisplayElement;
00127    }

jccl::ConfigElementPtr vrj::Display::getGlFrameBufferConfig  
 

Definition at line 162 of file Display.cpp.

References mDisplayElement.

Referenced by vrj::PfDrawManager::configFrameBuffer, vrj::GlWindowXWin::getGlxVisInfo, and vrj::GlWindowWin32::setPixelFormat.

00163 {
00164    jccl::ConfigElementPtr element;
00165 
00166    // XXX: Refactor this to allow different frame buffer child elements.  Right
00167    // now, this assumes that the child element type is OpenGLFBConfig.
00168    if ( mDisplayElement->getNum("frame_buffer_config") == 1 )
00169    {
00170       element =
00171          mDisplayElement->getProperty<jccl::ConfigElementPtr>("frame_buffer_config");
00172    }
00173 
00174    return element;
00175 }

vrj::Display::VJ_API std::ostream &    [inline]
 

Definition at line 131 of file Display.h.

00135    { return mViewports.size(); }

vrj::Viewport* vrj::Display::getViewport int    vpNum [inline]
 

Definition at line 137 of file Display.h.

Referenced by vrj::GlWindow::finishSetup.

00138    { return mViewports[vpNum]; }


Member Data Documentation

std::string vrj::Display::mName [protected]
 

Name of the window.

Definition at line 141 of file Display.h.

int vrj::Display::_xo [protected]
 

Definition at line 142 of file Display.h.

Referenced by setOriginAndSize.

int vrj::Display::_yo [protected]
 

Definition at line 142 of file Display.h.

Referenced by setOriginAndSize.

int vrj::Display::_xs [protected]
 

Definition at line 142 of file Display.h.

Referenced by setOriginAndSize.

int vrj::Display::_ys [protected]
 

X and Y origin and size of the view.

Definition at line 142 of file Display.h.

Referenced by setOriginAndSize.

bool vrj::Display::mBorder [protected]
 

Should we have a border.

Definition at line 143 of file Display.h.

Referenced by configDisplayWindow.

int vrj::Display::mPipe [protected]
 

Hardware pipe.

Index of the rendering hardware

Definition at line 144 of file Display.h.

bool vrj::Display::mActive [protected]
 

Is the display active or not?

Definition at line 145 of file Display.h.

Referenced by configDisplayWindow.

bool vrj::Display::mStereoRequested [protected]
 

Has stereo been requested?

Definition at line 146 of file Display.h.

Referenced by configDisplayWindow.

jccl::ConfigElementPtr vrj::Display::mDisplayElement [protected]
 

The config data for this display.

Definition at line 147 of file Display.h.

Referenced by configDisplayWindow, getGlFrameBufferConfig, and setOriginAndSize.

std::vector<vrj::Viewport*> vrj::Display::mViewports [protected]
 

Contained viewports.

Definition at line 149 of file Display.h.

Referenced by configViewports, and updateProjections.


The documentation for this class was generated from the following files:
Generated on Sun May 2 15:11:05 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002