]> git.tdb.fi Git - libs/gl.git/blobdiff - source/select.cpp
Inherit Loaders from the ObjectLoader classes
[libs/gl.git] / source / select.cpp
index e989de4e99b59a931fc18cbd750656240acd513c..51fe0b60525c3ec829bb09136ae0a12d1da27da8 100644 (file)
@@ -1,14 +1,26 @@
-#include <GL/gl.h>
+/* $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<Msp::GL::SelectRecord> *select_buf=0;
+vector<Msp::GL::uint> select_buf_int;
+
+}
+
 namespace Msp {
 namespace GL {
 
-vector<SelectRecord> *select_buf=0;
-vector<uint> select_buf_int;
-
 void select_buffer(vector<SelectRecord> &buf)
 {
        select_buf_int.resize(1024);
@@ -16,6 +28,26 @@ void select_buffer(vector<SelectRecord> &buf)
        select_buf=&buf;
 }
 
+void init_names()
+{
+       glInitNames();
+}
+
+void push_name(uint n)
+{
+       glPushName(n);
+}
+
+void pop_name()
+{
+       glPopName();
+}
+
+void load_name(uint n)
+{
+       glLoadName(n);
+}
+
 void parse_select_records(const uint *buf, uint count, vector<SelectRecord> &tbuf)
 {
        uint i=0;
@@ -38,8 +70,7 @@ void parse_select_records(const uint *buf, uint count, vector<SelectRecord> &tbu
 void _parse_internal_select_records(uint count)
 {
        if(!select_buf)
-               //XXX throw InvalidOperation();
-               return;
+               throw InvalidState("No select buffer specified");
        parse_select_records(&select_buf_int[0], count, *select_buf);
 }