00001 /*************************************************************************** 00002 texture.cpp 00003 ------------------- 00004 begin : 2004-04-16 00005 copyright : (C) 2004-2005 by Michael Menne 00006 email : menne@users.sourceforge.net 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 ***************************************************************************/ 00024 00025 #include "texture.h" 00026 00027 extern ofstream logFile; 00028 00029 namespace WDS 00030 { 00031 00032 /*----------------------------------------------------------------------------/ 00033 Constructor/Destructor 00034 -----------------------------------------------------------------------------*/ 00035 00036 CTexture::CTexture( string strName ) 00037 { 00038 m_nTexureID = 0; 00039 m_nRefCount = 0; 00040 m_nWidth = 0; 00041 m_nHeigth = 0; 00042 m_nOriginalWidth = 0; 00043 m_nOriginalHeigth = 0; 00044 m_strName = strName; 00045 } 00046 00047 CTexture::~CTexture() 00048 { 00049 if( m_nRefCount != 0) 00050 { 00051 logFile << "ERROR: " << m_strName << ": hat immer noch " << m_nRefCount << " Referenzen!" << endl 00052 << "=> Textur immer mit render.DeleteTextur löschen.!" << endl; 00053 } 00054 } 00055 00056 /*----------------------------------------------------------------------------/ 00057 Member Funktionen 00058 -----------------------------------------------------------------------------*/ 00059 00060 void CTexture::Bind() const 00061 { 00062 glBindTexture( GL_TEXTURE_2D, m_nTexureID ); 00063 } 00064 00065 void CTexture::IncRefCount() 00066 { 00067 m_nRefCount++; 00068 } 00069 00070 void CTexture::DecRefCount() 00071 { 00072 if( m_nRefCount > 0 ) 00073 m_nRefCount--; 00074 } 00075 00076 } 00077 // kate: space-indent off; tab-width 4; replace-tabs off; 00078