/*********************************************************************** * Method : DLhandler::valid * Params : * Returns: bool * Effects: ***********************************************************************/ bool DLhandler::valid(CVIEWptr &v, int cmp_stamp) const { const int view_id = dl_per_view ? v->view_id() : 0; ((DLhandler *) this)->make_dl_stamp_big_enough(view_id); return ((_dl_stamp_array[view_id] != -1) && (_dl_stamp_array[view_id] >= cmp_stamp)); }
/*********************************************************************** * Method : DLhandler::delete_dl * Params : * Returns: void * Effects: ***********************************************************************/ void DLhandler::delete_dl(CVIEWptr &v) { const int view_id = dl_per_view ? v->view_id() : 0; if (_dl_array.valid_index(view_id)) { if (_dl_array[view_id]) { glDeleteLists(_dl_array[view_id], 1); _dl_array[view_id] = 0; } _dl_stamp_array[view_id] = -1; } return; }
/*********************************************************************** * Method : DLhandler::get_dl * Params : * Returns: int * Effects: Gets a display list - if one doesn't already exist, one * is created ***********************************************************************/ int DLhandler::get_dl(CVIEWptr &v, int num_dls, int set_stamp) { const int view_id = dl_per_view ? v->view_id() : 0; // If we're all set, don't panic: if (valid(v, set_stamp)) return _dl_array[view_id]; // Not all set, create a display list: make_dl_big_enough(view_id); if (_dl_array[view_id] == 0) { _dl_array[view_id] = glGenLists(num_dls); } make_dl_stamp_big_enough(view_id); _dl_stamp_array[view_id] = _dl_array[view_id] == 0 ? 0 : set_stamp; return _dl_array[view_id]; }
/*********************************************************************** * Method : DLhandler::dl * Params : * Returns: int * Effects: ***********************************************************************/ int DLhandler::dl(CVIEWptr &v) const { const int view_id = dl_per_view ? v->view_id() : 0; return _dl_array[view_id]; }