/* I seem to need this for glGenBuffers as per http://www.gamedev.net/community/forums/topic.asp?topic_id=422358 */ #define GL_GLEXT_PROTOTYPES #include "exp004processhits.h" #include "selection_to_db.h" #include "../view/exp004state0.h" #include /* * A simple alias to make the code more readable. */ #define S exp004state0 /* * The implementation of this function is based on * [Angel,2008,pp80-81]. */ void exp004processhits (GLint hits, GLuint buffer[]) { printf ("Hits: %d\n", hits); GLuint *hitlist = buffer; for (int i = 0; i < hits; i++) { hitlist += 3; /* * Report the hit to the terminal. */ printf ("Hit %i: %s\n", i + 1, S.gi_data[*hitlist]); /* * Add the hits to the selection. */ S.selection[*hitlist] = true; S.base_colors_data[*hitlist][0] = SELECT_COLOR_R; S.base_colors_data[*hitlist][1] = SELECT_COLOR_G; S.base_colors_data[*hitlist][2] = SELECT_COLOR_B; S.base_colors_data[*hitlist][3] = SELECT_COLOR_A; hitlist++; } selection_to_db (); glBindBuffer (GL_ARRAY_BUFFER, S.buffers[BASE_COLORS]); glColorPointer (4, GL_FLOAT, 0, 0); glBufferData (GL_ARRAY_BUFFER, sizeof (S.base_colors_data), S.base_colors_data, GL_STATIC_DRAW); printf ("\n"); return; }