]> git.tdb.fi Git - libs/gl.git/blobdiff - source/select.cpp
Style update: add spaces around assignment operators
[libs/gl.git] / source / select.cpp
index f19dd3ef62819c4f32d5356b7c838a3294e3e5a3..65ce6ce62433174088863b6e1af1e0711342a1be 100644 (file)
@@ -5,18 +5,16 @@ Copyright © 2007  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
-#include <GL/gl.h>
-#include "error.h"
+#include "except.h"
+#include "gl.h"
 #include "select.h"
 
 using namespace std;
 
 namespace {
 
-using namespace Msp::GL;
-
-vector<SelectRecord> *select_buf=0;
-vector<uint> select_buf_int;
+vector<Msp::GL::SelectRecord> *select_buf = 0;
+vector<unsigned> select_buf_int;
 
 }
 
@@ -27,19 +25,39 @@ void select_buffer(vector<SelectRecord> &buf)
 {
        select_buf_int.resize(1024);
        glSelectBuffer(select_buf_int.size(), &select_buf_int[0]);
-       select_buf=&buf;
+       select_buf = &buf;
+}
+
+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 uint *buf, uint count, vector<SelectRecord> &tbuf)
+void parse_select_records(const unsigned *buf, unsigned count, vector<SelectRecord> &tbuf)
 {
-       uint i=0;
+       unsigned i = 0;
        while(count--)
        {
                SelectRecord record;
 
-               uint n_names=buf[i++];
-               record.min_depth=buf[i++];
-               record.max_depth=buf[i++];
+               unsigned n_names = buf[i++];
+               record.min_depth = buf[i++];
+               record.max_depth = buf[i++];
 
                record.names.reserve(n_names);
                while(n_names--)
@@ -49,10 +67,10 @@ void parse_select_records(const uint *buf, uint count, vector<SelectRecord> &tbu
        }
 }
 
-void _parse_internal_select_records(uint count)
+void _parse_internal_select_records(unsigned count)
 {
        if(!select_buf)
-               throw InvalidOperation("No select buffer specified");
+               throw InvalidState("No select buffer specified");
        parse_select_records(&select_buf_int[0], count, *select_buf);
 }