I cannot find a single glIndexPointer example. I wish to know how is it used exactly.
I have a real world terrain model and a color spectrum array for visually indicating the height of the terrain.
The spectrum has just 56 colors (float, float, float) and the terrain has 1200x1200 vertices. I figured that it will be good if i can store just an index into the spectrum in each Vertex.
Is glIndexPointer for this purpose? If so, how do I use it?
my current code crashes on glDrawElements():
struct Vertex3{ Vector3 position; Vector3 normal; int spectrum_index; // if this were Color color; // and index pointer not used, it will run correct.};class Spectrum { public: const static Colors[]; }Vertex3 terrain[1200x1200];..glColorArray(3, GL_FLOAT, 0, Spectrum::Colors);glIndexPointer(GL_INT, sizeof(Vertex3), &(terrain[0].spectrum_index));...
Thanks!