Then use the const_cast to get rid of "const" or create your arrays on heap:
std::vector <GLfloat*> position;
GLfloat *pos new GLfloat[4];
pos[0] = 0.0;
pos[1] = 1.0;
pos[2] = 0.0;
pos[3] = 0.0;
position.push_back(pos);
std::vector <GLfloat*> position;
GLfloat *pos new GLfloat[4];
pos[0] = 0.0;
pos[1] = 1.0;
pos[2] = 0.0;
pos[3] = 0.0;
position.push_back(pos);
To copy to clipboard, switch view to plain text mode
And remember to delete[] the array when you no longer need it to avoid memory leaks.
Or better yet, make your own class, something like:
struct MyData {
MyData(GLfloat d1, GLfloat d2, GLfloat d3, GLfloat d4){ d[0] = d1; d[1]=d2; d[2]=d3; d[3]=d4;}
GLfloat d[4];
GLfloat & operator[](int i){ return d[i]; }
}
std::vector<MyData> pos;
pos.push_back(MyData(0.0, 1.0, 2.0, 3.0));
struct MyData {
MyData(GLfloat d1, GLfloat d2, GLfloat d3, GLfloat d4){ d[0] = d1; d[1]=d2; d[2]=d3; d[3]=d4;}
GLfloat d[4];
GLfloat & operator[](int i){ return d[i]; }
}
std::vector<MyData> pos;
pos.push_back(MyData(0.0, 1.0, 2.0, 3.0));
To copy to clipboard, switch view to plain text mode
Bookmarks