00001 ///////////////////////////////////////////////////////////////////// 00002 // 6/12/02 Aaron Lefohn Scientific Computing and Imaging Institute 00003 // School of Computing University of Utah 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //////////////////////////////////////////////////////////////////////// 00019 00020 #include <state/stateGLI.h> 00021 00022 using namespace glift; 00023 00024 namespace glift { 00025 extern bool g_compiling; 00026 } 00027 00028 StateGLI::StateGLI() 00029 :m_isBound(false), m_err(&std::cerr) 00030 {} 00031 00032 StateGLI::~StateGLI() {} 00033 00034 void StateGLI::bind() 00035 { 00036 /*if( g_compiling == false ) { 00037 if( m_bindList.isCompiled() ) { 00038 m_bindList.issue(); 00039 } 00040 else { 00041 bindDef(); 00042 } 00043 } 00044 else { /// We are compiling so only call 'compilable' code 00045 bindDef(); 00046 }*/ 00047 m_isBound = true; 00048 00049 if( m_bindList.isCompiled() ) { 00050 m_bindList.issue(); 00051 } 00052 else { 00053 bindDef(); 00054 } 00055 } 00056 00057 void StateGLI::release() 00058 { 00059 /*if( g_compiling == false ) { 00060 if( m_releaseList.isCompiled() ) { 00061 m_releaseList.issue(); 00062 } 00063 else { 00064 releaseDef(); 00065 } 00066 } 00067 else { /// We are compiling so only call 'compilable' code 00068 releaseDef(); 00069 }*/ 00070 00071 m_isBound = false; 00072 00073 if( m_bindList.isCompiled() ) { 00074 m_bindList.issue(); 00075 } 00076 else { 00077 releaseDef(); 00078 } 00079 } 00080 00081 void StateGLI::compile() 00082 { 00083 g_compiling = true; 00084 00085 /// Force deletion/construction of new objects in case 00086 /// a display list already exists for this object. 00087 m_bindList = DispList(); 00088 m_releaseList = DispList(); 00089 00090 /// Compile new disply lists 00091 m_bindList.compile( new MemberCommand0<StateGLI>(this, &StateGLI::bind) ); 00092 m_releaseList.compile( new MemberCommand0<StateGLI>(this, &StateGLI::release) ); 00093 00094 g_compiling = false; 00095 } 00096 00097 GenState::~GenState() {} 00098 00099 PixelShader::~PixelShader() {} 00100 00101 VertexShader::~VertexShader() {} 00102 00103