00001 /* 00002 * ExNihilo 3D Engine 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 * Please read AUTHORS file !!! 00019 * 00020 * $Id: ExCTexture.cpp,v 1.6 2002/07/31 12:10:31 data Exp $ 00021 * 00022 */ 00023 00024 #include "ExCTexture.h" 00025 00026 00027 ExCTexture::ExCTexture(void) 00028 { 00029 Guard(ExCTexture::ExCTexture(void)) 00030 SetFileName("NoName"); 00031 UnGuard 00032 } 00033 00034 ExCTexture::ExCTexture(const char * name) 00035 { 00036 Guard(ExCTexture::ExCTexture(const char * name)) 00037 SetFileName(name); 00038 UnGuard 00039 } 00040 00041 ExCTexture::~ExCTexture(void) 00042 { 00043 Guard(ExCTexture::~ExCTexture(void)) 00044 UnGuard 00045 } 00046 00047 void ExCTexture::SetFileName(const char * name) 00048 { 00049 Guard(void ExCTexture::SetFileName(const char * name)) 00050 std::string FileName(name); 00051 if(FileName.find(".")<FileName.length())//if extension remove them 00052 { 00053 m_FileName=new char[strlen(name)-4]; 00054 memset(m_FileName,0,strlen(name)-4); 00055 FileName.erase(FileName.find("."),FileName.length()-FileName.find(".")); 00056 sprintf(m_FileName,"%s",FileName.data()); 00057 }else 00058 { 00059 m_FileName=new char[strlen(name)]; 00060 sprintf(m_FileName,"%s",name); 00061 //std::cout<<"filename:"<<m_FileName<<std::endl; 00062 } 00063 UnGuard 00064 } 00065 00066 char *ExCTexture::GetFileName(void) 00067 { 00068 Guard(char *ExCTexture::GetFileName(void)) 00069 return m_FileName; 00070 UnGuard 00071 } 00072 00073 void ExCTexture::SetActive(void) 00074 { 00075 Guard(ExCTexture::SetActive(void)) 00076 00077 glBindTexture(GL_TEXTURE_2D,m_Texture); 00078 UnGuard 00079 }