gee_display_lists.h

Go to the documentation of this file.
00001 /* COPYRIGHT
00002  *
00003  * This file is part of the Visual Effects Engine - VEE
00004  *
00005  * Read the "VEE-LICENSE" file for the license.
00006  *
00007  * Authors & Copyright:   
00008  *
00009  * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 
00010  * Janne Kontkanen 2001-2004
00011  *
00012  * Additional copyrights: Tekes 2003-2004
00013  *
00014  * firstname.lastname@hut.fi
00015  *
00016  */
00017 
00018 #ifndef VEE_GL_DISPLAY_LISTS_HPP
00019 #define VEE_GL_DISPLAY_LISTS_HPP
00020 
00021 #include <gee_renderer.h>
00022 
00023 #include <vee_reference_object.h>
00024 
00025 #include <GL/gl.h>
00026 
00027 #include <map>
00028 #include <set>
00029 
00030 class VEE_GarbageBin;
00031 
00032 class GEE_GlDisplayList
00033 {
00034  public:
00035   GEE_GlDisplayList() : m_list(0), m_generation(-1) {}
00036       
00037   bool hasList() { return m_list != 0; }
00038   void freeList() 
00039     { if(m_list) glDeleteLists(m_list, 1); m_list = 0; m_generation = -1;}
00040 
00041   bool needsUpdate(int generation) 
00042     { return m_generation != generation; }
00043       
00044   GLuint listId()
00045     { if(!m_list) m_list = glGenLists(1); return m_list; }
00046 
00047   void setGeneration(long generation) { m_generation = generation; }
00048 
00049   long generation() const { return m_generation; }
00050 
00051  protected:
00052 
00053   GLuint m_list;
00054   long    m_generation;
00055 };
00056 
00057 class GEE_GlDisplayLists 
00058 {
00059 public:
00060 
00061   GEE_GlDisplayLists();
00062   ~GEE_GlDisplayLists();
00063 
00064   void freeLists(VEE_GarbageBin *items);
00065 
00066   GEE_GlDisplayList & getList(void *id);
00067   GEE_GlDisplayList * getListPtr(void *id);
00068 
00069   uint size() const { return m_storage.size(); }
00070 
00071 protected:
00072 
00073   typedef std::map<void *, VEE_ReferenceObject<GEE_GlDisplayList> >::iterator iterator;
00074 
00075   std::map<void *, VEE_ReferenceObject<GEE_GlDisplayList> > m_storage;
00076 
00077 };
00078 
00079 #endif

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