📄 rendersurface.h
字号:
* previously specified. If previous state specified a border around the window, a * the border is replaced * */ /** positionPointer(x,y) places the pointer at window coordinates x, y. */ void positionPointer( int x, int y ); /** set/getUseDefaultEsc is deprecated */ void setUseDefaultEsc( bool flag ) {_useDefaultEsc = flag; } bool getUseDefaultEsc() { return _useDefaultEsc; } /** map and unmap the window */ void mapWindow(); void unmapWindow();#endif void fullScreen( bool flag ); /** setCustomFullScreenRencangle(x,y,width,height). Programmer may set a customized * rectangle to be interpreted as "fullscreen" when fullscreen(true) is called. This * allows configurations that have large virtual screens that span more than one monitor * to define a "local" full screen for each monitor. */ void setCustomFullScreenRectangle( int x, int y, unsigned int width, unsigned int height ); /** useDefaultFullScreenRetangle(). Sets the application back to using the default * screen size as fullscreen rather than the custom full screen rectangle */ void useDefaultFullScreenRectangle(); /** isFullScreen() returns true if the RenderSurface's window fills the entire screen * and has no border. */ bool isFullScreen() const { return _isFullScreen; } // TEMPORARY PBUFFER RENDER TO TEXTURE SUPPORT // Temporary PBuffer support for Windows. Somebody got really // confused and mixed up PBuffers with a renderable texture and // caused this messy headache. // These have no meaning in GLX world..... enum BufferType { FrontBuffer, BackBuffer }; enum RenderToTextureMode { RenderToTextureMode_None, RenderToRGBTexture, RenderToRGBATexture }; enum RenderToTextureTarget { Texture1D, Texture2D, TextureCUBE }; enum RenderToTextureOptions { RenderToTextureOptions_Default = 0, RequestSpaceForMipMaps = 1, RequestLargestPBuffer = 2 }; enum CubeMapFace { PositiveX = 0, NegativeX = 1, PositiveY = 2, NegativeY = 3, PositiveZ = 4, NegativeZ = 5 }; /** * Bind PBuffer content to the currently selected texture. * This method affects PBuffer surfaces only. */ void bindPBufferToTexture(BufferType buffer = FrontBuffer) const; /** * Get the render-to-texture mode (PBuffer drawables only). * This method has no effect if it is called after realize() */ RenderToTextureMode getRenderToTextureMode() const; /** * Set the render-to-texture mode (PBuffer drawables only). You * can pass int values different from the constants defined by * RenderToTextureMode, in which case they will be applied * directly as parameters to the WGL_TEXTURE_FORMAT attribute. * This method has no effect if it is called after realize(). */ void setRenderToTextureMode(RenderToTextureMode mode); /** * Get the render-to-texture target (PBuffer drawables only). * This method has no effect if it is called after realize(). */ RenderToTextureTarget getRenderToTextureTarget() const; /** * Set the render-to-texture target (PBuffer drawables only). You * can pass int values different from the constants defined by * RenderToTextureTarget, in which case they will be applied * directly as parameters to the WGL_TEXTURE_TARGET attribute. * This method has no effect if it is called after realize(). */ void setRenderToTextureTarget(RenderToTextureTarget target); /** * Get the render-to-texture options (PBuffer drawables only). * This method has no effect if it is called after realize(). */ RenderToTextureOptions getRenderToTextureOptions() const; /** * Set the render-to-texture options (PBuffer drawables only). * You can pass any combination of the constants defined in * enum RenderToTextureOptions. * This method has no effect if it is called after realize(). */ void setRenderToTextureOptions(RenderToTextureOptions options); /** * Get which mipmap level on the target texture will be * affected by rendering. */ int getRenderToTextureMipMapLevel() const; /** * Select which mipmap level on the target texture will be * affected by rendering. This method can be called after the * PBuffer has been realized. */ void setRenderToTextureMipMapLevel(int level); /** * Get which face on the target cube map texture will be * affected by rendering. */ CubeMapFace getRenderToTextureFace() const; /** * Select which face on the target cube map texture will be * affected by rendering. This method can be called after the * PBuffer has been realized. */ void setRenderToTextureFace(CubeMapFace face); // END TEMPORARY PBUFFER RENDER TO TEXTURE SUPPORT /** * Get the (const) vector of user-defined PBuffer attributes. */ const std::vector<int> &getPBufferUserAttributes() const; /** * Get the vector of user-defined PBuffer attributes. This * vector will be used to initialize the PBuffer's attribute list.*/ std::vector<int> &getPBufferUserAttributes(); private : unsigned int _refreshRate;#ifdef _X11_IMPLEMENTATION int (*__glxGetRefreshRateSGI)(unsigned int *); int (*__glxGetVideoSyncSGI)(unsigned int *); int (*__glxWaitVideoSyncSGI)(int,int,unsigned int *); void testVSync( void );#endif#if 0 bool _checkEvents( Display *); void _setBorder( bool flag ); void _setWindowName( const std::string & ); void _useCursor(bool); void _setCursor(Cursor); void _setCursorToDefault(); void _positionPointer(int x, int y); void _resizeWindow();#endif bool _overrideRedirectFlag; protected : virtual ~RenderSurface( void ); // void _useOverrideRedirect( bool ); DrawableType _drawableType; std::string _hostname; int _displayNum; float _windowLeft, _windowRight, _windowBottom, _windowTop; int _windowX, _windowY; unsigned int _windowWidth, _windowHeight; unsigned int _screenWidth, _screenHeight; bool _useCustomFullScreen; int _customFullScreenOriginX; int _customFullScreenOriginY; unsigned int _customFullScreenWidth; unsigned int _customFullScreenHeight; int _screen;#if 0 Display * _dpy; Window _win; Window _parent;#endif RenderSurface *_readDrawableRenderSurface; unsigned int _parentWindowHeight; bool _realized; osg::ref_ptr< VisualChooser > _visualChooser;#if 0 VisualInfo * _visualInfo; unsigned int _visualID; GLContext _glcontext; GLContext _sharedGLContext; Cursor _currentCursor; Cursor _nullCursor; Cursor _defaultCursor;#endif bool _decorations; bool _useCursorFlag; std::string _windowName; unsigned int _frameCount; bool _mayFullScreen; bool _isFullScreen; bool _bindInputRectangleToWindowSize; // Temporary "Pbuffer support for Win32 RenderToTextureMode _rtt_mode; RenderToTextureTarget _rtt_target; RenderToTextureOptions _rtt_options; int _rtt_mipmap; CubeMapFace _rtt_face; bool _rtt_dirty_mipmap; bool _rtt_dirty_face;#ifdef _OSX_AGL_IMPLEMENTATION GLContext _windowGlcontext; GLContext _fullscreenGlcontext; CFDictionaryRef _oldDisplayMode; bool _captureDisplayOrWindow(); void _releaseDisplayOrWindow();#endif // user-defined PBuffer attributes std::vector<int> _user_pbattr; bool _useConfigEventThread; bool _checkOwnEvents; bool _useDefaultEsc; InputRectangle _inputRectangle; // void _computeScreenSize( unsigned int &width, unsigned int &height ) const;#if 0 bool _createVisualInfo(); virtual bool _init(); virtual void _fini(); virtual void run(); static void _initThreads();#endif#ifdef _WIN32_IMPLEMENTATION class Client : public Producer::Referenced { public: Client(unsigned long mask); unsigned int mask() { return _mask; } EventQueue *getQueue() { return q.get(); } void queue( ref_ptr<Event> ev ); private : unsigned int _mask; Producer::ref_ptr<EventQueue> q; }; std::vector < Producer::ref_ptr<Client> >clients; void dispatch( ref_ptr<Event> ); int _ownWindow; int _ownVisualChooser; int _ownVisualInfo; HDC _hdc; HINSTANCE _hinstance; BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag); void KillGLWindow(); LONG WINAPI proc( Window, UINT, WPARAM, LPARAM ); static LONG WINAPI s_proc( Window, UINT, WPARAM, LPARAM ); static std::map <Window, RenderSurface *>registry; /* mouse things */ int _mx, _my; unsigned int _mbutton; WNDPROC _oldWndProc;public: EventQueue * selectInput( unsigned int mask ); // if _parent is set, resize the window to // fill the client area of the parent void resizeToParent();#endif static bool _shareAllGLContexts;};}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -