GlDisplayLists.hpp

Go to the documentation of this file.
00001 /* COPYRIGHT
00002  *
00003  * This file is part of the Simple Object Loader and Renderer - SOLAR
00004  *
00005  * Read the file "SOLAR-LICENSE" for the license.
00006  *
00007  * Authors & Copyright:
00008  *
00009  * Tommi Ilmonen, 2001-2003, except LWO-code by RJ, 2001-2003
00010  *
00011  * Tommi's email: firstname.lastname@hut.fi
00012  *
00013  */
00014 
00015 #ifndef SOLAR_GL_DISPLAY_LISTS_HPP
00016 #define SOLAR_GL_DISPLAY_LISTS_HPP
00017 
00018 #include <Solar/Renderer.hpp>
00019 
00020 #include <vee_reference_object.h>
00021 
00022 #include <GL/gl.h>
00023 
00024 #include <map>
00025 #include <set>
00026 
00027 namespace Solar {
00028 
00029   class GarbageBin;
00030 
00031   class GlDisplayLists 
00032   {
00033   public:
00034     
00035     class List
00036     {
00037     public:
00038       List() : m_list(0), m_buffer(0), m_generation(-1) {}
00039       
00040       bool hasList() { return m_list != 0; }
00041       void freeList();
00042 
00043       bool needsUpdate(int generation) 
00044       { return m_generation != generation; }
00045       
00046       GLuint listId();
00047       GLuint bufferId();
00048 
00049       void setGeneration(int generation) { m_generation = generation; }
00050 
00051     protected:
00052 
00053       GLuint m_list;
00054       GLuint m_buffer;
00055       int    m_generation;
00056     };
00057 
00058     GlDisplayLists();
00059     ~GlDisplayLists();
00060 
00061     void freeLists(GarbageBin *items);
00062 
00063     List & getList(void *id);
00064 
00065     uint size() const { return m_storage.size(); }
00066 
00067   protected:
00068 
00069     typedef std::map<void *, VEE_ReferenceObject<List> >::iterator iterator;
00070 
00071     std::map<void *, VEE_ReferenceObject<List> > m_storage;
00072 
00073   };
00074   
00075 
00076 }
00077 
00078 #endif

Generated on Mon Mar 12 21:09:00 2007 for VEE - The Visual Effects Engine by  doxygen 1.4.6