PCMGLXRenderWindow_impl.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00027 
00028  
00029  
00030  
00031 
00032 inline XDisplay::Pointer & GLXRenderWindow::getDisplay()
00033 {
00034   return mDisplay;
00035 }
00036 
00037  
00038 
00039 inline GLXGLContext::Pointer & GLXRenderWindow::getGLXGLContext()
00040 {
00041   return mGLXGLContext;
00042 }
00043 
00044  
00045 
00046 inline Process *GLXRenderWindow::getProcess() const
00047 {
00048   return mProcess;
00049 }
00050 
00051  
00052 
00053 inline const::Window & GLXRenderWindow::getWindow() const
00054 {
00055   return mWindow;
00056 }
00057 
00058  
00059 
00060 inline const bool & GLXRenderWindow::getInitialized() const
00061 {
00062   return mInitialized;
00063 }
00064 
00065  
00066 
00067 inline const bool & GLXRenderWindow::getVisible() const
00068 {
00069   return mVisible;
00070 }
00071 
00072  
00073 
00074 inline void GLXRenderWindow::setVisible(const bool & visible)
00075 {
00076   if(!mInitialized && visible)
00077   {
00078         
00079         initialize();
00080 
00081         
00082         _reposition();
00083         _resize();
00084   }
00085 
00086   mVisible = visible;
00087 }
00088 
00089  
00090 
00091 inline const bool & GLXRenderWindow::getFullScreen() const
00092 {
00093   return mFullScreen;
00094 }
00095 
00096  
00097 
00098 inline void GLXRenderWindow::setFullScreen(const bool & fullscreen)
00099 {
00100   mFullScreen = fullscreen;
00101 }
00102 
00103  
00104 
00105 inline const std::string & GLXRenderWindow::getCaption() const
00106 {
00107   return mCaption;
00108 }
00109 
00110  
00111 
00112 inline void GLXRenderWindow::setCaption(const std::string & caption)
00113 {
00114   mCaption = caption;
00115 
00116   _setCaption();
00117 }
00118 
00119  
00120 
00121 inline const s32 & GLXRenderWindow::getLeft() const
00122 {
00123   return mLeft;
00124 }
00125 
00126  
00127 
00128 inline void GLXRenderWindow::setLeft(const s32 & left)
00129 {
00130   reposition(left, mTop);
00131 }
00132 
00133  
00134 
00135 inline const s32 & GLXRenderWindow::getTop() const
00136 {
00137   return mTop;
00138 }
00139 
00140  
00141 
00142 inline void GLXRenderWindow::setTop(const s32 & top)
00143 {
00144   reposition(mLeft, top);
00145 }
00146 
00147  
00148 
00149 inline const u32 & GLXRenderWindow::getWidth() const
00150 {
00151   return mWidth;
00152 }
00153 
00154  
00155 
00156 inline void GLXRenderWindow::setWidth(const u32 & width)
00157 {
00158   resize(width, mHeight);
00159 }
00160 
00161  
00162 
00163 inline const u32 & GLXRenderWindow::getHeight() const
00164 {
00165   return mHeight;
00166 }
00167 
00168  
00169 
00170 inline void GLXRenderWindow::setHeight(const u32 & height)
00171 {
00172   resize(mWidth, height);
00173 }
00174 
00175  
00176 
00177 inline const u32 & GLXRenderWindow::getColourDepth() const
00178 {
00179   return mColourDepth;
00180 }
00181 
00182  
00183 
00184 inline void GLXRenderWindow::setColourDepth(const u32 & colourdepth)
00185 {
00186   mColourDepth = colourdepth;
00187 }
00188 
00189  
00190 
00191 inline const u32 & GLXRenderWindow::getFSAASamples() const
00192 {
00193   return mFSAASamples;
00194 }
00195 
00196  
00197 
00198 inline void GLXRenderWindow::setFSAASamples(const u32 & fsaasamples)
00199 {
00200   mFSAASamples = fsaasamples;
00201 }
00202 
00203  
00204 
00205 inline const GLXRenderWindow::WindowStatistics & GLXRenderWindow::getWindowStatistics() const
00206 {
00207   return mWindowStatistics;
00208 }
00209 
00210  
00211 
00212  
00213  
00214  
00215 
00216 inline void GLXRenderWindow::reposition(const s32 & left, const s32 & top)
00217 {
00218   mDisplay.lock();
00219   mLeft = (left == GLXRenderWindow::CENTERED ? (mDisplay->getWidth() - mWidth) / 2 : left);
00220   mTop = (top == GLXRenderWindow::CENTERED ? (mDisplay->getHeight() - mHeight) / 2 : top);
00221   mDisplay.unlock();
00222 
00223   if(mInitialized)
00224         _reposition();
00225 }
00226 
00227  
00228 
00229 inline void GLXRenderWindow::resize(const u32 & width, const u32 & height)
00230 {
00231   mWidth = width;
00232   mHeight = height;
00233 
00234   if(mInitialized)
00235         _resize();
00236 }
00237 
00238  
00239 
00240 inline void GLXRenderWindow::startFrame()
00241 {
00242   
00243   mWindowStatistics.lastTriangleCount = 0;
00244 
00245   
00246   mWindowStatistics.frameBeginTime = Timer::getSystemTime();
00247 
00248   
00249   setCurrent();
00250 }
00251 
00252  
00253 
00254 inline void GLXRenderWindow::finishFrame()
00255 {
00256   
00257   mDisplay.lock();
00258   glXSwapBuffers(mDisplay->getDisplay(), mWindow);
00259   mDisplay.unlock();
00260 
00261   
00262   releaseCurrent();
00263 
00264   
00265   mWindowStatistics.frameEndTime = Timer::getSystemTime();
00266 
00267   
00268   updateStatistics();
00269 }
00270 
00271  
00272 
00273 inline void GLXRenderWindow::_reposition()
00274 {
00275   mDisplay.lock();
00276   XMoveWindow(mDisplay->getDisplay(), mWindow, mLeft, mTop);
00277   mDisplay.unlock();
00278 }
00279 
00280  
00281 
00282 inline void GLXRenderWindow::_resize()
00283 {
00284   mDisplay.lock();
00285   XResizeWindow(mDisplay->getDisplay(), mWindow, mWidth, mHeight);
00286   
00287   
00288   mDisplay.unlock();
00289 }
00290 
00291