⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glteximage.hpp

📁 ncbi源码
💻 HPP
字号:
/* * =========================================================================== * PRODUCTION $Log: glteximage.hpp,v $ * PRODUCTION Revision 1000.1  2004/06/01 19:50:21  gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * PRODUCTION * =========================================================================== */#ifndef GUI_OPENGL___GL_TEX_IMAGE___HPP#define GUI_OPENGL___GL_TEX_IMAGE___HPP/*  $Id: glteximage.hpp,v 1000.1 2004/06/01 19:50:21 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: * */#include <util/image/image.hpp>#include <gui/opengl.h>#include <gui/gui.hpp>/** @addtogroup GUI_OPENGL * * @{ */BEGIN_NCBI_SCOPE//// class CTexImage defines a specialization of CImage that is useful for// textures.//// This class holds a CImage as well as its texture information.//class NCBI_GUIOPENGL_EXPORT CTexImage : public CObject{public:    // default ctor    CTexImage();    // create a texture from a file    explicit CTexImage(const string& filename);    // create a texture around an existing image    explicit CTexImage(CImage* image);    // create a texture of a given dimension    CTexImage(size_t w, size_t h, size_t d);    // initialize our image.    // Here, depth is in channels (3 = 24-bit, 4 = 32-bit)    void Init(size_t w, size_t h, size_t depth);    // reset our internal structures    void Clear();    // "swallow" an image - explicitly assigns the image we wrap    void Swallow(CImage *image);    // make this texture the current texture for OpenGL work    void MakeCurrent();    // load an image.  this creates a new display list or tex object    void Load();    // unload an image.  this destroys the current binding    void Unload();    // access the filename    const string&   GetFileName(void) const;    // access our image    const CImage*   GetImage(void) const;    CImage*         SetImage(void);    //    // OpenGL specifics    //    // filtering - magnification / minification    void   SetFilterMin(GLenum f);    void   SetFilterMag(GLenum f);    GLenum GetFilterMin(void) const;    GLenum GetFilterMag(void) const;    // texture wrapping - in two directions, S and T    void   SetWrapS(GLenum e);    void   SetWrapT(GLenum e);    GLenum GetWrapS(void) const;    GLenum GetWrapT(void) const;    // texture environment mode    void   SetTexEnv(GLenum e);    GLenum GetTexEnv(void) const;protected:    // our filename (may be empty)    string m_FileName;    // the CImage we wrap    CRef<CImage>    m_Image;    // OpenGL stuff:    // the texture id - either object or display list    GLuint m_TexId;    // texture wrapping (S and T directions)    GLenum m_WrapS;    GLenum m_WrapT;    // texture filtering for magnification / minification    GLenum m_FilterMin;    GLenum m_FilterMag;    // texture environment (modulation vs. decal, for example)    GLenum m_TexEnv;    // flag: can we use texture objects?    // this is an enumerated value indicating the state of texturing support    enum ETexSupport {        eNotChecked,        eTexObj,        eTexDisplayList    };    static ETexSupport sm_TexObjFlag;    // initialize texture object ability:    void x_InitTexObj();private:    // forbidden    CTexImage (const CTexImage&);    CTexImage& operator= (const CTexImage&);};////// inline accessors////inlineCImage* CTexImage::SetImage(void){    return m_Image;}inlineconst CImage* CTexImage::GetImage(void) const{    return m_Image;}inlineconst string& CTexImage::GetFileName(void) const{    return m_FileName;}inlinevoid CTexImage::SetWrapS(GLenum e){    m_WrapS = e;}inlinevoid CTexImage::SetWrapT(GLenum e){    m_WrapT = e;}inlinevoid CTexImage::SetFilterMin(GLenum e){    m_FilterMin = e;}inlinevoid CTexImage::SetFilterMag(GLenum e){    m_FilterMag = e;}inlinevoid CTexImage::SetTexEnv(GLenum e){    m_TexEnv = e;}inlineGLenum CTexImage::GetWrapS(void) const{    return m_WrapS;}inlineGLenum CTexImage::GetWrapT(void) const{    return m_WrapT;}inlineGLenum CTexImage::GetFilterMin(void) const{    return m_FilterMin;}inlineGLenum CTexImage::GetFilterMag(void) const{    return m_FilterMag;}inlineGLenum CTexImage::GetTexEnv(void) const{    return m_TexEnv;}END_NCBI_SCOPE/* @} *//* * =========================================================================== * $Log: glteximage.hpp,v $ * Revision 1000.1  2004/06/01 19:50:21  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.4 * * Revision 1.4  2004/05/11 18:54:22  dicuccio * Added doxygne modules info * * Revision 1.3  2004/05/03 12:43:59  dicuccio * Added #include for gui/gui.hpp * * Revision 1.2  2003/06/03 19:36:38  dicuccio * Added export specifiers.  Fixed errant #include of <GL/...> files * * Revision 1.1  2003/06/03 17:42:54  dicuccio * Added texture support.  Added classes to handle OpenGL camera setup, viewport * specification * * =========================================================================== */#endif	// GUI_OPENGL___GL_TEX_IMAGE___HPP

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -