00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00021 #ifndef OPENGLCACHE_H
00022 #define OPENGLCACHE_H
00023 
00024 #include <stdlib.h>
00025 #include "OpenGLExtensions.h"
00026 
00027 #define GLCACHE_FAIL 0
00028 
00032 class OpenGLCache {
00033 private:
00034   struct idlink {
00035     idlink *next;           
00036     int used;               
00037     const unsigned long id; 
00038     const GLuint gltag;     
00039 
00040     idlink(unsigned long theid, GLuint tag, idlink *thenext)
00041     : next(thenext), used(1), id(theid), gltag(tag) {}
00042   };
00043 
00044   idlink * cache;           
00045 
00046 public:
00047   OpenGLCache();
00048   ~OpenGLCache(); 
00049 
00050   void encache(unsigned long id, GLuint tag); 
00051   void markUnused();                 
00052   GLuint markUsed(unsigned long id); 
00053   GLuint deleteUnused();             
00054 };
00055 
00056 #endif