openscenegraph
PixelBufferWin32
Go to the documentation of this file.
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
14/* Note, elements of PixeBufferWin32 have used Producer/RenderSurface_Win32.cpp as both
15 * a guide to use of X11/GLX and copiying directly in the case of setBorder().
16 * These elements are license under OSGPL as above, with Copyright (C) 2001-2004 Don Burns.
17 */
18
19#ifndef OSGVIEWER_PIXELBUFFERWIN32
20#define OSGVIEWER_PIXELBUFFERWIN32 1
21
22#include <osg/GraphicsContext>
23#include <osgViewer/api/Win32/GraphicsHandleWin32>
24
25namespace osgViewer
26{
27
28class OSGVIEWER_EXPORT PixelBufferWin32 : public osg::GraphicsContext, public osgViewer::GraphicsHandleWin32
29{
30 public:
31
32 PixelBufferWin32(osg::GraphicsContext::Traits* traits);
33
34 virtual ~PixelBufferWin32();
35
36 virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const PixelBufferWin32*>(object)!=0; }
37 virtual const char* libraryName() const { return "osgViewer"; }
38 virtual const char* className() const { return "PixelBufferWin32"; }
39
40 virtual bool valid() const { return _valid; }
41
42 /** Realize the GraphicsContext.*/
43 virtual bool realizeImplementation();
44
45 /** Return true if the graphics context has been realized and is ready to use.*/
46 virtual bool isRealizedImplementation() const { return _realized; }
47
48 /** Close the graphics context.*/
49 virtual void closeImplementation();
50
51 /** Make this graphics context current.*/
52 virtual bool makeCurrentImplementation();
53 virtual bool makeContextCurrentImplementation( GraphicsContext* /*readContext*/ );
54
55 /** Release the graphics context.*/
56 virtual bool releaseContextImplementation();
57
58 /** Swap the front and back buffers.*/
59 virtual void swapBuffersImplementation();
60
61 virtual void bindPBufferToTextureImplementation( GLenum /*buffer*/ );
62
63 protected:
64
65 void init();
66
67 bool _initialized;
68 bool _valid;
69 bool _realized;
70 int _boundBuffer;
71};
72
73}
74
75#endif