PixelBufferWin32 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. /* Note, elements of PixeBufferWin32 have used Producer/RenderSurface_Win32.cpp as both
  14. * a guide to use of X11/GLX and copiying directly in the case of setBorder().
  15. * These elements are license under OSGPL as above, with Copyright (C) 2001-2004 Don Burns.
  16. */
  17. #ifndef OSGVIEWER_PIXELBUFFERWIN32
  18. #define OSGVIEWER_PIXELBUFFERWIN32 1
  19. #include <osg/GraphicsContext>
  20. #include <osgViewer/api/Win32/GraphicsHandleWin32>
  21. namespace osgViewer
  22. {
  23. class OSGVIEWER_EXPORT PixelBufferWin32 : public osg::GraphicsContext, public osgViewer::GraphicsHandleWin32
  24. {
  25. public:
  26. PixelBufferWin32(osg::GraphicsContext::Traits* traits);
  27. virtual ~PixelBufferWin32();
  28. virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const PixelBufferWin32*>(object)!=0; }
  29. virtual const char* libraryName() const { return "osgViewer"; }
  30. virtual const char* className() const { return "PixelBufferWin32"; }
  31. virtual bool valid() const { return _valid; }
  32. /** Realize the GraphicsContext.*/
  33. virtual bool realizeImplementation();
  34. /** Return true if the graphics context has been realized and is ready to use.*/
  35. virtual bool isRealizedImplementation() const { return _realized; }
  36. /** Close the graphics context.*/
  37. virtual void closeImplementation();
  38. /** Make this graphics context current.*/
  39. virtual bool makeCurrentImplementation();
  40. virtual bool makeContextCurrentImplementation( GraphicsContext* /*readContext*/ );
  41. /** Release the graphics context.*/
  42. virtual bool releaseContextImplementation();
  43. /** Swap the front and back buffers.*/
  44. virtual void swapBuffersImplementation();
  45. virtual void bindPBufferToTextureImplementation( GLenum /*buffer*/ );
  46. protected:
  47. void init();
  48. bool _initialized;
  49. bool _valid;
  50. bool _realized;
  51. int _boundBuffer;
  52. };
  53. }
  54. #endif