PixelBufferX11
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
/* Note, elements of PixelBufferX11 have used Prodcer/RenderSurface_X11.cpp as both
* a guide to use of X11/GLX and copiying directly in the case of setBorder().
* These elements are license under OSGPL as above, with Copyright (C) 2001-2004 Don Burns.
*/
#ifndef OSGVIEWER_PIXELBUFFERX11
#define OSGVIEWER_PIXELBUFFERX11 1
#include <osg/GraphicsContext>
#include <osgViewer/api/X11/GraphicsHandleX11>
namespace osgViewer
{
class OSGVIEWER_EXPORT PixelBufferX11 : public osg::GraphicsContext, public osgViewer::GraphicsHandleX11
{
public:
PixelBufferX11(osg::GraphicsContext::Traits* traits);
virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const PixelBufferX11*>(object)!=0; }
virtual const char* libraryName() const { return "osgViewer"; }
virtual const char* className() const { return "PixelBufferX11"; }
virtual bool valid() const { return _valid; }
virtual bool realizeImplementation();
virtual bool isRealizedImplementation() const { return _realized; }
virtual void closeImplementation();
virtual bool makeCurrentImplementation();
virtual bool makeContextCurrentImplementation(osg::GraphicsContext* readContext);
virtual bool releaseContextImplementation();
virtual void bindPBufferToTextureImplementation(GLenum buffer);
virtual void swapBuffersImplementation();
public:
// X11 specific aces functions
Pbuffer& getPbuffer() { return _pbuffer; }
protected:
~PixelBufferX11();
bool createVisualInfo();
void init();
bool _valid;
Pbuffer _pbuffer;
XVisualInfo* _visualInfo;
bool _initialized;
bool _realized;
bool _useGLX1_3;
bool _useSGIX;
#ifdef GLX_SGIX_pbuffer
typedef Pbuffer ( *GLXCreateGLXPbufferSGIX_FuncPtr) (Display *dpy, GLXFBConfig config, unsigned int, unsigned height, int* attrib_list);
typedef void ( *GLXDestroyGLXPbufferSGIX_FuncPtr) (Display *dpy, Pbuffer pbuf);
typedef int ( *GLXQueryGLXPbufferSGIX_FuncCPtr) (Display *dpy, Pbuffer pbuf, int attribute, unsigned int *value);
typedef GLXFBConfig ( *GLXGetFBConfigFromVisualSGIX_FuncPtr) (Display *dpy, XVisualInfo *vis);
GLXCreateGLXPbufferSGIX_FuncPtr _glXCreateGLXPbufferSGIX;
GLXDestroyGLXPbufferSGIX_FuncPtr _glXDestroyGLXPbufferSGIX;
GLXQueryGLXPbufferSGIX_FuncCPtr _glXQueryGLXPbufferSGIX;
GLXGetFBConfigFromVisualSGIX_FuncPtr _glXGetFBConfigFromVisualSGIX;
#endif
};
}
#endif
GraphicsContext
GraphicsHandleX11
osgViewer::GraphicsHandleX11
Definition GraphicsHandleX11:45
osgViewer::GraphicsHandleX11::Pbuffer
GLXPbuffer Pbuffer
Definition GraphicsHandleX11:63
osgViewer::PixelBufferX11::_realized
bool _realized
Definition PixelBufferX11:83
osgViewer::PixelBufferX11::_initialized
bool _initialized
Definition PixelBufferX11:82
osgViewer::PixelBufferX11::~PixelBufferX11
~PixelBufferX11()
osgViewer::PixelBufferX11::releaseContextImplementation
virtual bool releaseContextImplementation()
osgViewer::PixelBufferX11::createVisualInfo
bool createVisualInfo()
osgViewer::PixelBufferX11::bindPBufferToTextureImplementation
virtual void bindPBufferToTextureImplementation(GLenum buffer)
osgViewer::PixelBufferX11::className
virtual const char * className() const
Definition PixelBufferX11:36
osgViewer::PixelBufferX11::swapBuffersImplementation
virtual void swapBuffersImplementation()
osgViewer::PixelBufferX11::init
void init()
osgViewer::PixelBufferX11::isRealizedImplementation
virtual bool isRealizedImplementation() const
Definition PixelBufferX11:44
osgViewer::PixelBufferX11::getPbuffer
Pbuffer & getPbuffer()
Definition PixelBufferX11:68
osgViewer::PixelBufferX11::_useSGIX
bool _useSGIX
Definition PixelBufferX11:86
osgViewer::PixelBufferX11::_useGLX1_3
bool _useGLX1_3
Definition PixelBufferX11:85
osgViewer::PixelBufferX11::_pbuffer
Pbuffer _pbuffer
Definition PixelBufferX11:79
osgViewer::PixelBufferX11::isSameKindAs
virtual bool isSameKindAs(const Object *object) const
Definition PixelBufferX11:34
osgViewer::PixelBufferX11::closeImplementation
virtual void closeImplementation()
osgViewer::PixelBufferX11::_visualInfo
XVisualInfo * _visualInfo
Definition PixelBufferX11:80
osgViewer::PixelBufferX11::valid
virtual bool valid() const
Definition PixelBufferX11:38
osgViewer::PixelBufferX11::makeCurrentImplementation
virtual bool makeCurrentImplementation()
osgViewer::PixelBufferX11::realizeImplementation
virtual bool realizeImplementation()
osgViewer::PixelBufferX11::makeContextCurrentImplementation
virtual bool makeContextCurrentImplementation(osg::GraphicsContext *readContext)
osgViewer::PixelBufferX11::_valid
bool _valid
Definition PixelBufferX11:78
osgViewer::PixelBufferX11::libraryName
virtual const char * libraryName() const
Definition PixelBufferX11:35
osgViewer::PixelBufferX11::PixelBufferX11
PixelBufferX11(osg::GraphicsContext::Traits *traits)
osg::GraphicsContext
Definition GraphicsContext:30
osg::Object::Object
Object()
Definition Object:69
osgViewer
OSGVIEWER_EXPORT
#define OSGVIEWER_EXPORT
Definition osgViewer/Export:40
osg::GraphicsContext::Traits
Definition GraphicsContext:70