openscenegraph
PixelBufferX11
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 PixelBufferX11 have used Prodcer/RenderSurface_X11.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_PIXELBUFFERX11
20#define OSGVIEWER_PIXELBUFFERX11 1
21
22#include <osg/GraphicsContext>
24
25namespace osgViewer
26{
27
29{
30 public:
31
33
34 virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const PixelBufferX11*>(object)!=0; }
35 virtual const char* libraryName() const { return "osgViewer"; }
36 virtual const char* className() const { return "PixelBufferX11"; }
37
38 virtual bool valid() const { return _valid; }
39
41 virtual bool realizeImplementation();
42
44 virtual bool isRealizedImplementation() const { return _realized; }
45
47 virtual void closeImplementation();
48
51
54
57
59 virtual void bindPBufferToTextureImplementation(GLenum buffer);
60
63
64 public:
65
66 // X11 specific aces functions
67
68 Pbuffer& getPbuffer() { return _pbuffer; }
69
70 protected:
71
73
75
76 void init();
77
78 bool _valid;
80 XVisualInfo* _visualInfo;
81
84
87
88#ifdef GLX_SGIX_pbuffer
89 typedef Pbuffer ( *GLXCreateGLXPbufferSGIX_FuncPtr) (Display *dpy, GLXFBConfig config, unsigned int, unsigned height, int* attrib_list);
90 typedef void ( *GLXDestroyGLXPbufferSGIX_FuncPtr) (Display *dpy, Pbuffer pbuf);
91 typedef int ( *GLXQueryGLXPbufferSGIX_FuncCPtr) (Display *dpy, Pbuffer pbuf, int attribute, unsigned int *value);
92 typedef GLXFBConfig ( *GLXGetFBConfigFromVisualSGIX_FuncPtr) (Display *dpy, XVisualInfo *vis);
93
94 GLXCreateGLXPbufferSGIX_FuncPtr _glXCreateGLXPbufferSGIX;
95 GLXDestroyGLXPbufferSGIX_FuncPtr _glXDestroyGLXPbufferSGIX;
96 GLXQueryGLXPbufferSGIX_FuncCPtr _glXQueryGLXPbufferSGIX;
97 GLXGetFBConfigFromVisualSGIX_FuncPtr _glXGetFBConfigFromVisualSGIX;
98#endif
99};
100
101}
102
103#endif
Definition GraphicsHandleX11:45
GLXPbuffer Pbuffer
Definition GraphicsHandleX11:63
Definition PixelBufferX11:29
bool _realized
Definition PixelBufferX11:83
bool _initialized
Definition PixelBufferX11:82
virtual bool releaseContextImplementation()
virtual void bindPBufferToTextureImplementation(GLenum buffer)
virtual const char * className() const
Definition PixelBufferX11:36
virtual void swapBuffersImplementation()
virtual bool isRealizedImplementation() const
Definition PixelBufferX11:44
Pbuffer & getPbuffer()
Definition PixelBufferX11:68
bool _useSGIX
Definition PixelBufferX11:86
bool _useGLX1_3
Definition PixelBufferX11:85
Pbuffer _pbuffer
Definition PixelBufferX11:79
virtual bool isSameKindAs(const Object *object) const
Definition PixelBufferX11:34
virtual void closeImplementation()
XVisualInfo * _visualInfo
Definition PixelBufferX11:80
virtual bool valid() const
Definition PixelBufferX11:38
virtual bool makeCurrentImplementation()
virtual bool realizeImplementation()
virtual bool makeContextCurrentImplementation(osg::GraphicsContext *readContext)
bool _valid
Definition PixelBufferX11:78
virtual const char * libraryName() const
Definition PixelBufferX11:35
PixelBufferX11(osg::GraphicsContext::Traits *traits)
Definition GraphicsContext:30
#define OSGVIEWER_EXPORT
Definition osgViewer/Export:40
Definition GraphicsContext:70