00001 //=========================================================================== 00002 /* 00003 This file is part of the CHAI 3D visualization and haptics libraries. 00004 Copyright (C) 2003-2009 by CHAI 3D. All rights reserved. 00005 00006 This library is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License("GPL") version 2 00008 as published by the Free Software Foundation. 00009 00010 For using the CHAI 3D libraries with software that can not be combined 00011 with the GNU GPL, and for taking advantage of the additional benefits 00012 of our support services, please contact CHAI 3D about acquiring a 00013 Professional Edition License. 00014 00015 \author <http://www.chai3d.org> 00016 \author Francois Conti 00017 \author Dan Morris 00018 \version 2.0.0 $Rev: 251 $ 00019 */ 00020 //=========================================================================== 00021 00022 //--------------------------------------------------------------------------- 00023 #ifndef CTexture2DH 00024 #define CTexture2DH 00025 //--------------------------------------------------------------------------- 00026 #include "files/CImageLoader.h" 00027 #include "graphics/CColor.h" 00028 #include "graphics/CGenericTexture.h" 00029 #include <string> 00030 #include <stdio.h> 00031 //--------------------------------------------------------------------------- 00032 00033 //=========================================================================== 00041 //=========================================================================== 00042 00043 //=========================================================================== 00051 //=========================================================================== 00052 class cTexture2D : public cGenericTexture 00053 { 00054 public: 00055 00056 //----------------------------------------------------------------------- 00057 // CONSTRUCTOR & DESTRUCTOR: 00058 //----------------------------------------------------------------------- 00059 00061 cTexture2D(); 00062 00064 ~cTexture2D(); 00065 00066 00067 //----------------------------------------------------------------------- 00068 // METHODS: 00069 //----------------------------------------------------------------------- 00070 00072 bool loadFromFile(const char* a_fileName); 00073 00075 void render(); 00076 00078 void markForUpdate() { m_updateTextureFlag = true; } 00079 00081 void setEnvironmentMode(const GLint& a_environmentMode) { m_environmentMode = a_environmentMode; } 00082 00084 GLint getEnvironmentMode() { return (m_environmentMode); } 00085 00087 void setWrapMode(const GLint& a_wrapSmode, const GLint& a_wrapTmode); 00088 00090 GLint getWrapSmode() { return (m_wrapSmode); } 00091 00093 GLint getWrapTmode() { return (m_wrapSmode); } 00094 00096 void setMagnificationFunction(GLint a_magnificationFunction); 00097 00099 GLint getMagnificationFunction() { return (m_magnificationFunction); } 00100 00102 void setMinifyingFunction(GLint a_minifyingFunction); 00103 00105 GLint getMinifyingFunction() { return (m_minifyingFunction); } 00106 00108 void setSphericalMappingEnabled(bool a_enabled) { m_useSphericalMapping = a_enabled; } 00109 00111 bool getSphericalMappingEnabled() { return (m_useSphericalMapping); } 00112 00114 cImageLoader m_image; 00115 00117 cColorf m_color; 00118 00119 private: 00120 00121 //----------------------------------------------------------------------- 00122 // METHODS: 00123 //----------------------------------------------------------------------- 00124 00126 void reset(); 00127 00129 void update(); 00130 00131 00132 //----------------------------------------------------------------------- 00133 // MEMBERS: 00134 //----------------------------------------------------------------------- 00135 00137 bool m_updateTextureFlag; 00138 00140 GLuint m_textureID; 00141 00143 GLint m_wrapSmode; 00144 00146 GLint m_wrapTmode; 00147 00149 GLint m_magnificationFunction; 00150 00152 GLint m_minifyingFunction; 00153 00155 bool m_useMipmaps; 00156 00158 bool m_useSphericalMapping; 00159 00161 GLint m_environmentMode; 00162 }; 00163 00164 //--------------------------------------------------------------------------- 00165 #endif 00166 //--------------------------------------------------------------------------- 00167