X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fselect.cpp;h=e905729d84229877e09ce0fb7b1ad69a0c3d0939;hb=ceae2a27dfc58310c5bab7e3aa3fedf0fa9a1f49;hp=e989de4e99b59a931fc18cbd750656240acd513c;hpb=7adcad3b40a03000a82e32db4523761c218309b8;p=libs%2Fgl.git diff --git a/source/select.cpp b/source/select.cpp index e989de4e..e905729d 100644 --- a/source/select.cpp +++ b/source/select.cpp @@ -1,14 +1,26 @@ -#include +/* $Id$ + +This file is part of libmspgl +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +#include "except.h" +#include "gl.h" #include "select.h" using namespace std; +namespace { + +vector *select_buf=0; +vector select_buf_int; + +} + namespace Msp { namespace GL { -vector *select_buf=0; -vector select_buf_int; - void select_buffer(vector &buf) { select_buf_int.resize(1024); @@ -16,14 +28,34 @@ void select_buffer(vector &buf) select_buf=&buf; } -void parse_select_records(const uint *buf, uint count, vector &tbuf) +void init_names() +{ + glInitNames(); +} + +void push_name(unsigned n) +{ + glPushName(n); +} + +void pop_name() +{ + glPopName(); +} + +void load_name(unsigned n) +{ + glLoadName(n); +} + +void parse_select_records(const unsigned *buf, unsigned count, vector &tbuf) { - uint i=0; + unsigned i=0; while(count--) { SelectRecord record; - uint n_names=buf[i++]; + unsigned n_names=buf[i++]; record.min_depth=buf[i++]; record.max_depth=buf[i++]; @@ -35,11 +67,10 @@ void parse_select_records(const uint *buf, uint count, vector &tbu } } -void _parse_internal_select_records(uint count) +void _parse_internal_select_records(unsigned count) { if(!select_buf) - //XXX throw InvalidOperation(); - return; + throw InvalidState("No select buffer specified"); parse_select_records(&select_buf_int[0], count, *select_buf); }