- /*
- * ===========================================================================
- * PRODUCTION $Log: gloscontext.hpp,v $
- * PRODUCTION Revision 1000.0 2003/10/31 20:33:03 gouriano
- * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.2
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef __GL_OS_RENDERER__HPP
- #define __GL_OS_RENDERER__HPP
- /* $Id: gloscontext.hpp,v 1000.0 2003/10/31 20:33:03 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Mike DiCuccio
- *
- * File Description:
- * CGlOsContext -- wrapper for Mesa3D's off-screen rendering extension
- */
- #include <corelib/ncbiobj.hpp>
- #include <util/image/image.hpp>
- #include <GL/osmesa.h>
- BEGIN_NCBI_SCOPE
- //
- // class CGlOsContext defines a simple interface for off-screen rendering.
- //
- // The current implementation depends on using the Off-Screen Mesa
- // implementation that comes standard with the Mesa3D package, available at
- // http://www.mesa3d.org/. This interface provides for a simple virtualized
- // frame-buffer. The user establishes the buffer on their own; Mesa3D then
- // uses this image as its framebuffer.
- //
- class CGlOsContext : public CObject
- {
- public:
- // initialize our renderer with a virtual frame buffer of a given size.
- // This frame buffer will always be initialized as an RGBA image.
- CGlOsContext(size_t width, size_t height);
- // destructor for cleaning up our OSMesa context
- virtual ~CGlOsContext();
- // make the current frame buffer the active buffer for rendering
- bool MakeCurrent(void);
- // access the image we use for the virtual frame buffer
- const CImage& GetBuffer(void) const;
- CImage& SetBuffer(void);
- private:
- // our image
- CRef<CImage> m_Image;
- // the OSMesa context. This is a hook to Mesa3D's internals.
- OSMesaContext m_Ctx;
- };
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: gloscontext.hpp,v $
- * Revision 1000.0 2003/10/31 20:33:03 gouriano
- * PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.2
- *
- * Revision 1.2 2003/06/12 19:44:15 dicuccio
- * Added non-const accessor for the image buffer
- *
- * Revision 1.1 2003/06/09 19:31:41 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */
- #endif // __GL_OS_RENDERER__HPP