00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _PICKING_H
00014 #define _PICKING_H
00015
00016 #include <GL/glut.h>
00017
00018 class Picking
00019 {
00020 enum { invalid_selected_id = -1 };
00021 enum { hit_buff_sz = 1024 };
00022 int selected_id;
00023
00024 GLuint selectBuf[hit_buff_sz];
00025 int processHits(int hits);
00026
00027 public:
00028 Picking() : selected_id(invalid_selected_id) { }
00029
00030
00031 int operator() (int x, int y, double width=2, double height=2);
00032
00033 int GetSelected() { return selected_id; }
00034 void UnSelect() { selected_id = invalid_selected_id; }
00035 };
00036
00037 #endif
00038