00001 /* *********************************************************************************** 00002 Writer: Sebastien Bloc 00003 Copyright: 2003-2004 00004 eMail: sebastien.bloc@free.fr 00005 URL: http://mignonsoft.free.fr 00006 00007 This program is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License 00009 as published by the Free Software Foundation; either version 2 00010 of the License, or (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 http://www.gnu.org/copyleft/gpl.html 00017 *********************************************************************************** */ 00018 00019 #include "3d.h" 00020 #include "recorder.h" 00021 00022 Recorder::Recorder() 00023 { 00024 Zero(); 00025 } 00026 00027 void Recorder::Zero() 00028 { 00029 id=0; 00030 } 00031 00032 Recorder::~Recorder() 00033 { 00034 Delete(); 00035 } 00036 00037 void Recorder::operator=(Recorder &src) 00038 { 00039 id=src.id; 00040 } 00041 00042 BOOL Recorder::BeginRecord(BOOL andExecute) 00043 { 00044 Delete(); 00045 id = glGenLists(1); 00046 if (!id) return FALSE; 00047 glNewList(id,andExecute?GL_COMPILE_AND_EXECUTE:GL_COMPILE); 00048 return TRUE; 00049 } 00050 00051 void Recorder::EndRecord() 00052 { 00053 glEndList(); 00054 } 00055 00056 void Recorder::Play() 00057 { 00058 glCallList(id); 00059 } 00060 00061 BOOL Recorder::Delete() 00062 { 00063 if (!id) return FALSE; 00064 glDeleteLists(id,1); 00065 Zero(); 00066 return TRUE; 00067 }