arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

dispList.h

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////
00002 // 6/6/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 #ifndef DISP_LIST___H__
00020 #define DISP_LIST___H__
00021 
00022 #include "../core/gliftObject.h"
00023 #include "command.h"
00024 #include <GL/glew.h>
00025 #include <assert.h>
00026 
00027 namespace glift {
00028 
00029 //////////////////////////////////////////////////////////////////////////
00030 ///
00031 /// dispList.h: interface for the DispList class.
00032 /// 
00033 /// - This class encapsulates using a display list with any allowable OpenGL calls.
00034 /// - The OpenGL call sequence is defined in the callback passed to the 'compile()' fcn.
00035 /// - The callback is of type 'void name()' or 'void CallType::name() const' and the
00036 ///   'compile' command is called as:
00037 ///   
00038 ///     1) compile( name )
00039 ///     2) compile( new MemberCommand0<CallType>(objPtr, &CallType::name) )
00040 ///     
00041 /// - This class is NOT meant to be subclassed!
00042 ///////////////////////////////////////////////////////////////////////
00043 
00044 class _export_ DispList : public GliftObject /// Final
00045 {
00046 public:
00047    DispList();
00048    ~DispList();
00049 
00050    inline void issue(); /// Issue OpenGL commands via displayList (only if compiled).
00051 
00052    /// Compile OpenGL display list 'glCommands()'
00053    void compile( void (*glCommands)() );
00054    void compile( Command* glCommands ); //Deletes 'glCommands'!!
00055    bool isCompiled() const {return m_isCompiled;}
00056 
00057 private:        
00058    GLuint    m_dispList;        /// The OpenGL display list ID
00059    bool   m_isCompiled;
00060 };
00061 
00062 inline void DispList::issue()
00063 {
00064    assert( m_dispList > 0 );
00065 
00066    glCallList( m_dispList );
00067 }
00068 
00069 } /// End of namespace glift
00070 
00071 #endif 

Send questions, comments, and bug reports to:
jmk