Changeset 13041 for OpenSceneGraph/trunk/src/osgPlugins/cfg/RenderSurface.h
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/cfg/RenderSurface.h
r12292 r13041 34 34 \brief A RenderSurface provides a rendering surface for 3D graphics applications. 35 35 36 A RenderSurface creates a window in a windowing system for the purpose of 3D 36 A RenderSurface creates a window in a windowing system for the purpose of 3D 37 37 rendering. The focus of a RenderSurface differs from a windowing system window 38 38 in that it is not a user input/output device, but rather a context and screen area 39 specifically designed for 3D applications. Consequently, a RenderSurface does not 39 specifically designed for 3D applications. Consequently, a RenderSurface does not 40 40 provide or impose a requirement on the caller to structure the application around 41 the capturing or handling of events. Further, RenderSurface provides increased 41 the capturing or handling of events. Further, RenderSurface provides increased 42 42 control over the quality of pixel formats. 43 43 */ … … 51 51 static unsigned int _numScreens; 52 52 53 class Callback : public osg::Referenced 53 class Callback : public osg::Referenced 54 54 { 55 55 public: … … 61 61 }; 62 62 63 struct InputRectangle 63 struct InputRectangle 64 64 { 65 65 public: … … 67 67 InputRectangle( float left, float right, float bottom, float top ): 68 68 _left(left), _bottom(bottom), _width(right-left), _height(top-bottom) {} 69 InputRectangle(const InputRectangle &ir) 69 InputRectangle(const InputRectangle &ir) 70 70 { 71 71 _left = ir._left; … … 75 75 } 76 76 virtual ~InputRectangle() {} 77 77 78 78 void set( float left, float right, float bottom, float top ) 79 79 { … … 87 87 float width() const { return _width; } 88 88 float height() const { return _height; } 89 89 90 90 protected: 91 91 92 92 private: 93 93 float _left, _bottom, _width, _height; … … 118 118 void setHostName( const std::string & ); 119 119 120 /** 121 * Get the name of the Host the window is to be created on. 120 /** 121 * Get the name of the Host the window is to be created on. 122 122 * Ignored on Win32 */ 123 123 const std::string& getHostName( void ) const; 124 124 125 /** 126 * Set the number of the display the render surface is to 125 /** 126 * Set the number of the display the render surface is to 127 127 * be created on. In XWindows, this is the number of the 128 128 * XServer. Ignored on Win32 */ 129 129 void setDisplayNum( int ); 130 130 131 /** Get the number of the display the render surface is to 131 /** Get the number of the display the render surface is to 132 132 * be created on. In XWindows, this is the number of the 133 133 * XServer. Ignored on Win32 */ 134 134 int getDisplayNum( void ) const; 135 136 /** Set the number of the screen the render surface is to 135 136 /** Set the number of the screen the render surface is to 137 137 * be created on. In XWindows, this is the number of the 138 138 * XServer. Ignored on Win32 */ 139 139 void setScreenNum( int ); 140 140 141 /** Get the number of the screen the render surface is to 141 /** Get the number of the screen the render surface is to 142 142 * be created on. In XWindows, this is the number of the 143 143 * XServer. Ignored on Win32 */ 144 144 int getScreenNum( void ) const; 145 145 146 /** Get the size of the screen in pixels the render surface 146 /** Get the size of the screen in pixels the render surface 147 147 * is to be created on. */ 148 148 void getScreenSize( unsigned int &width, unsigned int &height ) const; 149 149 150 150 151 151 /** Default window name */ … … 159 159 const std::string& getWindowName( void ) const; 160 160 161 /** Set the windowing system rectangle the RenderSurface will 161 /** Set the windowing system rectangle the RenderSurface will 162 162 * occupy on the screen. The parameters are given as integers 163 163 * in screen space. x and y determine the lower left hand corner 164 * of the RenderSurface. Width and height are given in screen 164 * of the RenderSurface. Width and height are given in screen 165 165 * coordinates */ 166 void setWindowRectangle( int x, int y, unsigned int width, unsigned int height, 166 void setWindowRectangle( int x, int y, unsigned int width, unsigned int height, 167 167 bool resize=true ); 168 /** Get the windowing system rectangle the RenderSurface will 168 /** Get the windowing system rectangle the RenderSurface will 169 169 * occupy on the screen. The parameters are given as integers 170 170 * in screen space. x and y determine the lower left hand corner 171 * of the RenderSurface. Width and height are given in screen 171 * of the RenderSurface. Width and height are given in screen 172 172 * coordinates */ 173 173 void getWindowRectangle( int &x, int &y, unsigned int &width, unsigned int &height ) const; … … 234 234 bool usesOverrideRedirect(); 235 235 236 /** Request whether the window should have a visible cursor. If true, the 236 /** Request whether the window should have a visible cursor. If true, the 237 237 * windowing system's default cursor will be assigned to the window. If false 238 238 * the window will not have a visible cursor. */ … … 248 248 void setCursorToDefault(); 249 249 250 /** Specify whether the RenderSurface should use a separate thread for 251 * window configuration events. If flag is set to true, then the 252 * RenderSurface will spawn a new thread to manage events caused by 250 /** Specify whether the RenderSurface should use a separate thread for 251 * window configuration events. If flag is set to true, then the 252 * RenderSurface will spawn a new thread to manage events caused by 253 253 * resizing the window, mapping or destroying the window. */ 254 254 void useConfigEventThread(bool flag); … … 256 256 /** shareAllGLContexts will share all OpenGL Contexts between render surfaces 257 257 * upon realize. This must be called before any call to renderSurface::realize(). 258 */ 258 */ 259 259 static void shareAllGLContexts(bool); 260 260 … … 266 266 #if 0 267 267 /** Realize the RenderSurface. When realized, all components of the RenderSurface 268 * not already configured are configured, a window and a graphics context are 268 * not already configured are configured, a window and a graphics context are 269 269 * created and made current. If an already existing graphics context is passed 270 * through "sharedGLContext", then the graphics context created will share certain 270 * through "sharedGLContext", then the graphics context created will share certain 271 271 * graphics constructs (such as display lists) with "sharedGLContext". */ 272 272 bool realize( VisualChooser *vc=NULL, GLContext sharedGLContext=0 ); … … 279 279 virtual void swapBuffers(void); 280 280 281 /** Makes the graphics context and RenderSurface current for rendering */ 281 /** Makes the graphics context and RenderSurface current for rendering */ 282 282 bool makeCurrent(void) const; 283 283 284 /** Where supported, sync() will synchronize with the vertical retrace signal of the 284 /** Where supported, sync() will synchronize with the vertical retrace signal of the 285 285 * graphics display device. \a divisor specifies the number of vertical retace signals 286 286 * to allow before returning. */ … … 298 298 static void initThreads(); 299 299 300 /** 300 /** 301 301 * Puts the calling thread to sleep until the RenderSurface is realized. Returns true 302 302 * if for success and false for failure. … … 304 304 bool waitForRealize(); 305 305 306 /** fullScreen(flag). If flag is true, RenderSurface resizes its window to fill the 306 /** fullScreen(flag). If flag is true, RenderSurface resizes its window to fill the 307 307 * entire screen and turns off the border. If false, the window is returned to a size 308 * previously specified. If previous state specified a border around the window, a 308 * previously specified. If previous state specified a border around the window, a 309 309 * the border is replaced 310 310 * */ … … 323 323 #endif 324 324 void fullScreen( bool flag ); 325 /** setCustomFullScreenRencangle(x,y,width,height). Programmer may set a customized 325 /** setCustomFullScreenRencangle(x,y,width,height). Programmer may set a customized 326 326 * rectangle to be interpreted as "fullscreen" when fullscreen(true) is called. This 327 327 * allows configurations that have large virtual screens that span more than one monitor … … 332 332 * screen size as fullscreen rather than the custom full screen rectangle 333 333 */ 334 void useDefaultFullScreenRectangle(); 335 336 /** isFullScreen() returns true if the RenderSurface's window fills the entire screen 334 void useDefaultFullScreenRectangle(); 335 336 /** isFullScreen() returns true if the RenderSurface's window fills the entire screen 337 337 * and has no border. */ 338 338 bool isFullScreen() const { return _isFullScreen; } … … 347 347 BackBuffer 348 348 }; 349 349 350 350 enum RenderToTextureMode { 351 351 RenderToTextureMode_None, … … 353 353 RenderToRGBATexture 354 354 }; 355 355 356 356 enum RenderToTextureTarget { 357 357 Texture1D, … … 359 359 TextureCUBE 360 360 }; 361 361 362 362 enum RenderToTextureOptions { 363 363 RenderToTextureOptions_Default = 0, … … 365 365 RequestLargestPBuffer = 2 366 366 }; 367 367 368 368 enum CubeMapFace { 369 369 PositiveX = 0, … … 379 379 * This method affects PBuffer surfaces only. */ 380 380 void bindPBufferToTexture(BufferType buffer = FrontBuffer) const; 381 382 /** 381 382 /** 383 383 * Get the render-to-texture mode (PBuffer drawables only). 384 384 * This method has no effect if it is called after realize() */ 385 385 RenderToTextureMode getRenderToTextureMode() const; 386 386 387 387 /** 388 388 * Set the render-to-texture mode (PBuffer drawables only). You … … 392 392 * This method has no effect if it is called after realize(). */ 393 393 void setRenderToTextureMode(RenderToTextureMode mode); 394 395 /** 394 395 /** 396 396 * Get the render-to-texture target (PBuffer drawables only). 397 397 * This method has no effect if it is called after realize(). */ 398 398 RenderToTextureTarget getRenderToTextureTarget() const; 399 400 /** 399 400 /** 401 401 * Set the render-to-texture target (PBuffer drawables only). You 402 402 * can pass int values different from the constants defined by … … 405 405 * This method has no effect if it is called after realize(). */ 406 406 void setRenderToTextureTarget(RenderToTextureTarget target); 407 408 /** 407 408 /** 409 409 * Get the render-to-texture options (PBuffer drawables only). 410 410 * This method has no effect if it is called after realize(). */ 411 411 RenderToTextureOptions getRenderToTextureOptions() const; 412 413 /** 412 413 /** 414 414 * Set the render-to-texture options (PBuffer drawables only). 415 415 * You can pass any combination of the constants defined in … … 417 417 * This method has no effect if it is called after realize(). */ 418 418 void setRenderToTextureOptions(RenderToTextureOptions options); 419 419 420 420 /** 421 421 * Get which mipmap level on the target texture will be … … 428 428 * PBuffer has been realized. */ 429 429 void setRenderToTextureMipMapLevel(int level); 430 430 431 431 /** 432 432 * Get which face on the target cube map texture will be … … 441 441 442 442 // END TEMPORARY PBUFFER RENDER TO TEXTURE SUPPORT 443 443 444 444 /** 445 445 * Get the (const) vector of user-defined PBuffer attributes. */ … … 479 479 std::string _hostname; 480 480 int _displayNum; 481 float _windowLeft, _windowRight, 481 float _windowLeft, _windowRight, 482 482 _windowBottom, _windowTop; 483 483 int _windowX, _windowY; … … 531 531 GLContext _fullscreenGlcontext; 532 532 CFDictionaryRef _oldDisplayMode; 533 533 534 534 bool _captureDisplayOrWindow(); 535 535 void _releaseDisplayOrWindow(); 536 536 #endif 537 537 538 538 // user-defined PBuffer attributes 539 539 std::vector<int> _user_pbattr; 540 540 541 541 542 542 bool _useConfigEventThread; 543 543 bool _checkOwnEvents; 544 544 bool _useDefaultEsc; 545 545 546 546 InputRectangle _inputRectangle; 547 547 … … 584 584 BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag); 585 585 void KillGLWindow(); 586 586 587 587 LONG WINAPI proc( Window, UINT, WPARAM, LPARAM ); 588 588 static LONG WINAPI s_proc( Window, UINT, WPARAM, LPARAM ); … … 597 597 public: 598 598 EventQueue * selectInput( unsigned int mask ); 599 600 // if _parent is set, resize the window to 599 600 // if _parent is set, resize the window to 601 601 // fill the client area of the parent 602 602 void resizeToParent();
